Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
6984b615
Commit
6984b615
authored
Aug 20, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/control: Various events addition.
parent
49eb715c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
9 deletions
+81
-9
include/vlc/libvlc_structures.h
include/vlc/libvlc_structures.h
+14
-1
src/control/media_instance.c
src/control/media_instance.c
+41
-0
src/control/media_list_player.c
src/control/media_list_player.c
+26
-8
No files found.
include/vlc/libvlc_structures.h
View file @
6984b615
...
...
@@ -301,12 +301,19 @@ typedef enum libvlc_event_type_t {
libvlc_MediaDescriptorMetaChanged
,
libvlc_MediaDescriptorSubItemAdded
,
libvlc_MediaInstancePlayed
,
libvlc_MediaInstancePaused
,
libvlc_MediaInstanceReachedEnd
,
libvlc_MediaInstancePositionChanged
,
libvlc_MediaListItemAdded
,
libvlc_MediaListItemDeleted
,
libvlc_MediaListItemChanged
,
libvlc_MediaListPlayerPlayed
,
libvlc_MediaListPlayerNextItemSet
,
libvlc_MediaListPlayerStopped
,
libvlc_TreeSubtreeAdded
,
libvlc_TreeSubtreeDeleted
,
libvlc_TreeItemValueChanged
,
...
...
@@ -336,6 +343,12 @@ typedef struct libvlc_event_t
libvlc_media_descriptor_t
*
new_child
;
}
media_descriptor_subitem_added
;
/* media instance */
struct
{
uint64_t
new_position
;
}
media_instance_position_changed
;
/* media list */
struct
{
...
...
src/control/media_instance.c
View file @
6984b615
...
...
@@ -125,6 +125,12 @@ input_state_changed( vlc_object_t * p_this, char const * psz_cmd,
case
END_S
:
event
.
type
=
libvlc_MediaInstanceReachedEnd
;
break
;
case
PAUSE_S
:
event
.
type
=
libvlc_MediaInstancePaused
;
break
;
case
PLAYING_S
:
event
.
type
=
libvlc_MediaInstancePlayed
;
break
;
default:
return
VLC_SUCCESS
;
}
...
...
@@ -133,6 +139,40 @@ input_state_changed( vlc_object_t * p_this, char const * psz_cmd,
return
VLC_SUCCESS
;
}
/*
* input_position_changed (Private) (input var "intf-change" Callback)
*/
static
int
input_position_changed
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_userdata
)
{
libvlc_media_instance_t
*
p_mi
=
p_userdata
;
vlc_value_t
val
;
if
(
!
strcmp
(
psz_cmd
,
"intf"
/* "-change" no need to go further */
))
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
var_Get
(
p_input
,
"position"
,
&
val
);
if
((
val
.
i_time
%
I64C
(
500000
))
!=
0
)
return
VLC_SUCCESS
;
/* No need to have a better precision */
var_Get
(
p_input
,
"state"
,
&
val
);
if
(
val
.
i_int
!=
PLAYING_S
)
return
VLC_SUCCESS
;
/* Don't send the position while stopped */
}
else
val
.
i_time
=
newval
.
i_time
;
libvlc_event_t
event
;
event
.
type
=
libvlc_MediaInstancePositionChanged
;
event
.
u
.
media_instance_position_changed
.
new_position
=
val
.
i_time
;
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
event
);
return
VLC_SUCCESS
;
}
/**************************************************************************
* Create a Media Instance object
**************************************************************************/
...
...
@@ -419,6 +459,7 @@ void libvlc_media_instance_play( libvlc_media_instance_t *p_mi,
var_Set
(
p_input_thread
,
"drawable"
,
val
);
}
var_AddCallback
(
p_input_thread
,
"state"
,
input_state_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"intf-change"
,
input_position_changed
,
p_mi
);
/* will be released in media_instance_release() */
vlc_object_yield
(
p_input_thread
);
...
...
src/control/media_list_player.c
View file @
6984b615
...
...
@@ -138,6 +138,7 @@ uninstall_media_instance_observer( libvlc_media_list_player_t * p_mlp )
libvlc_MediaInstanceReachedEnd
,
media_instance_reached_end
,
p_mlp
,
NULL
);
}
/**************************************************************************
* Stop (Public)
**************************************************************************/
...
...
@@ -191,7 +192,7 @@ media_list_player_set_next( libvlc_media_list_player_t * p_mlp, int index,
*/
/**************************************************************************
*
libvlc_media_list_player_
new (Public)
* new (Public)
**************************************************************************/
libvlc_media_list_player_t
*
libvlc_media_list_player_new
(
libvlc_instance_t
*
p_instance
,
...
...
@@ -204,12 +205,19 @@ libvlc_media_list_player_new( libvlc_instance_t * p_instance,
p_mlp
->
p_mi
=
NULL
;
p_mlp
->
p_mlist
=
NULL
;
vlc_mutex_init
(
p_instance
->
p_libvlc_int
,
&
p_mlp
->
object_lock
);
p_mlp
->
p_event_manager
=
libvlc_event_manager_new
(
p_mlp
,
p_instance
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mlp
->
p_event_manager
,
libvlc_MediaListPlayerNextItemSet
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mlp
->
p_event_manager
,
libvlc_MediaListPlayerNextItemSet
,
p_e
);
return
p_mlp
;
}
/**************************************************************************
*
libvlc_media_list_player_
release (Public)
* release (Public)
**************************************************************************/
void
libvlc_media_list_player_release
(
libvlc_media_list_player_t
*
p_mlp
)
{
...
...
@@ -217,7 +225,7 @@ void libvlc_media_list_player_release( libvlc_media_list_player_t * p_mlp )
}
/**************************************************************************
*
libvlc_media_list_player_
set_media_instance (Public)
* set_media_instance (Public)
**************************************************************************/
void
libvlc_media_list_player_set_media_instance
(
libvlc_media_list_player_t
*
p_mlp
,
...
...
@@ -240,7 +248,7 @@ void libvlc_media_list_player_set_media_instance(
}
/**************************************************************************
*
Set a play
list (Public)
*
set_media_
list (Public)
**************************************************************************/
void
libvlc_media_list_player_set_media_list
(
libvlc_media_list_player_t
*
p_mlp
,
...
...
@@ -274,9 +282,7 @@ void libvlc_media_list_player_play( libvlc_media_list_player_t * p_mlp,
if
(
p_mlp
->
i_current_playing_index
<
0
)
{
libvlc_media_list_player_next
(
p_mlp
,
p_e
);
if
(
libvlc_exception_raised
(
p_e
)
)
return
;
return
;
/* Will set to play */
}
libvlc_media_instance_play
(
p_mlp
->
p_mi
,
p_e
);
...
...
@@ -297,6 +303,11 @@ void libvlc_media_list_player_play_item_at_index(
if
(
libvlc_exception_raised
(
p_e
)
)
return
;
/* Send the next item event */
libvlc_event_t
event
;
event
.
type
=
libvlc_MediaListPlayerNextItemSet
;
libvlc_event_send
(
p_mlp
->
p_event_manager
,
&
event
);
libvlc_media_instance_play
(
p_mlp
->
p_mi
,
p_e
);
}
...
...
@@ -336,6 +347,13 @@ void libvlc_media_list_player_next( libvlc_media_list_player_t * p_mlp,
media_list_player_set_next
(
p_mlp
,
index
,
p_e
);
libvlc_media_instance_play
(
p_mlp
->
p_mi
,
p_e
);
libvlc_media_list_unlock
(
p_mlp
->
p_mlist
);
/* Send the next item event */
libvlc_event_t
event
;
event
.
type
=
libvlc_MediaListPlayerNextItemSet
;
libvlc_event_send
(
p_mlp
->
p_event_manager
,
&
event
);
}
Write
Preview
Markdown
is supported
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