Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Samo Golež
VLC
Commits
53abf4bb
Commit
53abf4bb
authored
Apr 09, 2019
by
Felix Paul Kühne
Browse files
macosx/player controller: add program support
parent
7267669a
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/gui/macosx/playlist/VLCPlayerController.h
View file @
53abf4bb
...
...
@@ -27,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
@class
VLCInputStats
;
@class
VLCTrackMetaData
;
@class
VLCProgramMetaData
;
/**
* Listen to VLCPlayerCurrentMediaItemChanged to notified if the current media item changes for the player
...
...
@@ -97,6 +98,18 @@ extern NSString *VLCPlayerTitleListChanged;
*/
extern
NSString
*
VLCPlayerChapterSelectionChanged
;
/**
* Listen to VLCPlayerProgramSelectionChanged to be notified if the selected program of the current media changes
* @note the affected player object will be the object of the notification
*/
extern
NSString
*
VLCPlayerProgramSelectionChanged
;
/**
* Listen to VLCPlayerProgramListChanged to be notified if the list of available programs of the current media changes
* @note the affected player object will be the object of the notification
*/
extern
NSString
*
VLCPlayerProgramListChanged
;
/**
* Listen to VLCPlayerABLoopStateChanged to be notified if the A→B loop state changes
* @note the affected player object will be the object of the notification
...
...
@@ -529,6 +542,35 @@ extern NSString *VLCPlayerMuteChanged;
*/
-
(
nullable
const
struct
vlc_player_chapter
*
)
chapterAtIndexForCurrentTitle
:(
size_t
)
index
;
/**
* returns the selected program ID, typically in the range 0 to 32,000
* @warning the counter does not necessarily start at 0 nor are programs numbered consecutively
* @note listen to VLCPlayerProgramSelectionChanged to be notified about changes to this property
*/
@property
(
readonly
)
int
selectedProgramID
;
/**
* select the program defined by the provided VLCProgramMetaData instance
* @note listen to VLCPlayerProgramSelectionChanged to be notified once the change takes effect
*/
-
(
void
)
selectProgram
:(
VLCProgramMetaData
*
)
program
;
/**
* returns the number of programs available for the current media
* @note listen to VLCPlayerProgramListChanged to be notified about changes to this property
*/
@property
(
readonly
)
size_t
numberOfPrograms
;
/**
* returns an instance of VLCProgramMetaData with details about the program at the specified index
*/
-
(
nullable
VLCProgramMetaData
*
)
programAtIndex
:(
size_t
)
index
;
/**
* returns an instance of VLCProgramMetaData with details about the program with the specified ID
*/
-
(
nullable
VLCProgramMetaData
*
)
programForID
:(
int
)
programID
;
/**
* exposes whether a teletext menu is available or not
* @note listen to VLCPlayerTeletextMenuAvailable to be notified about changes to this property
...
...
@@ -831,4 +873,15 @@ extern NSString *VLCPlayerMuteChanged;
@end
@interface
VLCProgramMetaData
:
NSObject
-
(
instancetype
)
initWithProgramStructure
:(
const
struct
vlc_player_program
*
)
structure
;
@property
(
readonly
)
int
group_id
;
@property
(
readonly
)
NSString
*
name
;
@property
(
readonly
)
BOOL
selected
;
@property
(
readonly
)
BOOL
scrambled
;
@end
NS_ASSUME_NONNULL_END
modules/gui/macosx/playlist/VLCPlayerController.m
View file @
53abf4bb
...
...
@@ -44,6 +44,8 @@ NSString *VLCPlayerLengthChanged = @"VLCPlayerLengthChanged";
NSString
*
VLCPlayerTitleSelectionChanged
=
@"VLCPlayerTitleSelectionChanged"
;
NSString
*
VLCPlayerTitleListChanged
=
@"VLCPlayerTitleListChanged"
;
NSString
*
VLCPlayerChapterSelectionChanged
=
@"VLCPlayerChapterSelectionChanged"
;
NSString
*
VLCPlayerProgramSelectionChanged
=
@"VLCPlayerProgramSelectionChanged"
;
NSString
*
VLCPlayerProgramListChanged
=
@"VLCPlayerProgramListChanged"
;
NSString
*
VLCPlayerABLoopStateChanged
=
@"VLCPlayerABLoopStateChanged"
;
NSString
*
VLCPlayerTeletextMenuAvailable
=
@"VLCPlayerTeletextMenuAvailable"
;
NSString
*
VLCPlayerTeletextEnabled
=
@"VLCPlayerTeletextEnabled"
;
...
...
@@ -107,6 +109,8 @@ NSString *VLCPlayerMuteChanged = @"VLCPlayerMuteChanged";
-
(
void
)
inputStatsUpdated
:(
VLCInputStats
*
)
inputStats
;
-
(
void
)
trackSelectionChanged
;
-
(
void
)
trackListChanged
;
-
(
void
)
programListChanged
;
-
(
void
)
programSelectionChanged
:(
int
)
selectedID
;
-
(
void
)
ABLoopStateChanged
:(
enum
vlc_player_abloop
)
abLoopState
;
-
(
void
)
stopActionChanged
:(
enum
vlc_player_media_stopped_action
)
stoppedAction
;
-
(
void
)
metaDataChangedForInput
:(
input_item_t
*
)
inputItem
;
...
...
@@ -376,6 +380,30 @@ static void cb_player_track_selection_changed(vlc_player_t *p_player,
});
}
static
void
cb_player_program_list_changed
(
vlc_player_t
*
p_player
,
enum
vlc_player_list_action
action
,
const
struct
vlc_player_program
*
prgm
,
void
*
p_data
)
{
VLC_UNUSED
(
p_player
);
VLC_UNUSED
(
action
);
VLC_UNUSED
(
prgm
);
dispatch_async
(
dispatch_get_main_queue
(),
^
{
VLCPlayerController
*
playerController
=
(
__bridge
VLCPlayerController
*
)
p_data
;
[
playerController
programListChanged
];
});
}
static
void
cb_player_program_selection_changed
(
vlc_player_t
*
p_player
,
int
unselected_id
,
int
selected_id
,
void
*
p_data
)
{
VLC_UNUSED
(
p_player
);
VLC_UNUSED
(
unselected_id
);
dispatch_async
(
dispatch_get_main_queue
(),
^
{
VLCPlayerController
*
playerController
=
(
__bridge
VLCPlayerController
*
)
p_data
;
[
playerController
programSelectionChanged
:
selected_id
];
});
}
static
void
cb_player_atobloop_changed
(
vlc_player_t
*
p_player
,
enum
vlc_player_abloop
new_state
,
vlc_tick_t
time
,
float
pos
,
...
...
@@ -435,8 +463,8 @@ static const struct vlc_player_cbs player_callbacks = {
cb_player_length_changed
,
cb_player_track_list_changed
,
cb_player_track_selection_changed
,
NULL
,
//
cb_player_program_list_changed,
NULL
,
//
cb_player_program_selection_changed,
cb_player_program_list_changed
,
cb_player_program_selection_changed
,
cb_player_titles_changed
,
cb_player_title_selection_changed
,
cb_player_chapter_selection_changed
,
...
...
@@ -1408,6 +1436,59 @@ static const struct vlc_player_aout_cbs player_aout_callbacks = {
return
[
self
tracksForCategory
:
SPU_ES
];
}
-
(
void
)
programListChanged
{
[
_defaultNotificationCenter
postNotificationName
:
VLCPlayerProgramListChanged
object:
self
];
}
-
(
void
)
programSelectionChanged
:(
int
)
selectedID
{
_selectedProgramID
=
selectedID
;
[
_defaultNotificationCenter
postNotificationName
:
VLCPlayerProgramSelectionChanged
object:
self
];
}
-
(
void
)
selectProgram
:(
VLCProgramMetaData
*
)
program
{
vlc_player_Lock
(
_p_player
);
vlc_player_SelectProgram
(
_p_player
,
program
.
group_id
);
vlc_player_Unlock
(
_p_player
);
}
-
(
size_t
)
numberOfPrograms
{
size_t
ret
=
0
;
vlc_player_Lock
(
_p_player
);
ret
=
vlc_player_GetProgramCount
(
_p_player
);
vlc_player_Unlock
(
_p_player
);
return
ret
;
}
-
(
nullable
VLCProgramMetaData
*
)
programAtIndex
:(
size_t
)
index
{
VLCProgramMetaData
*
programMetaData
=
nil
;
vlc_player_Lock
(
_p_player
);
const
struct
vlc_player_program
*
program
=
vlc_player_GetProgramAt
(
_p_player
,
index
);
if
(
program
!=
NULL
)
{
programMetaData
=
[[
VLCProgramMetaData
alloc
]
initWithProgramStructure
:
program
];
}
vlc_player_Unlock
(
_p_player
);
return
programMetaData
;
}
-
(
nullable
VLCProgramMetaData
*
)
programForID
:(
int
)
programID
{
VLCProgramMetaData
*
programMetaData
=
nil
;
vlc_player_Lock
(
_p_player
);
const
struct
vlc_player_program
*
program
=
vlc_player_GetProgram
(
_p_player
,
programID
);
if
(
program
!=
NULL
)
{
programMetaData
=
[[
VLCProgramMetaData
alloc
]
initWithProgramStructure
:
program
];
}
vlc_player_Unlock
(
_p_player
);
return
programMetaData
;
}
-
(
void
)
ABLoopStateChanged
:(
enum
vlc_player_abloop
)
abLoopState
{
_abLoopState
=
abLoopState
;
...
...
@@ -1629,3 +1710,24 @@ static const struct vlc_player_aout_cbs player_aout_callbacks = {
}
@end
@implementation
VLCProgramMetaData
-
(
instancetype
)
initWithProgramStructure
:(
const
struct
vlc_player_program
*
)
structure
{
self
=
[
super
init
];
if
(
structure
!=
NULL
)
{
_group_id
=
structure
->
group_id
;
_name
=
toNSStr
(
structure
->
name
);
_selected
=
structure
->
selected
;
_scrambled
=
structure
->
scrambled
;
}
return
self
;
}
-
(
NSString
*
)
description
{
return
[
NSString
stringWithFormat
:
@"%@: name: %@"
,
[
VLCProgramMetaData
className
],
self
.
name
];
}
@end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment