Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
786cd054
Commit
786cd054
authored
Oct 24, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: allocate master source like slaves sources
parent
419ceeea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
84 deletions
+88
-84
src/input/input.c
src/input/input.c
+87
-83
src/input/input_internal.h
src/input/input_internal.h
+1
-1
No files found.
src/input/input.c
View file @
786cd054
...
@@ -173,7 +173,7 @@ int input_Preparse( vlc_object_t *p_parent, input_item_t *p_item )
...
@@ -173,7 +173,7 @@ int input_Preparse( vlc_object_t *p_parent, input_item_t *p_item )
bool
b_is_playlist
=
false
;
bool
b_is_playlist
=
false
;
if
(
input_item_ShouldPreparseSubItems
(
p_item
)
if
(
input_item_ShouldPreparseSubItems
(
p_item
)
&&
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
&&
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_IS_PLAYLIST
,
DEMUX_IS_PLAYLIST
,
&
b_is_playlist
)
)
&
b_is_playlist
)
)
b_is_playlist
=
false
;
b_is_playlist
=
false
;
...
@@ -257,6 +257,8 @@ static void input_Destructor( vlc_object_t *obj )
...
@@ -257,6 +257,8 @@ static void input_Destructor( vlc_object_t *obj )
free
(
psz_name
);
free
(
psz_name
);
#endif
#endif
free
(
p_input
->
p
->
master
);
if
(
p_input
->
p
->
p_es_out_display
)
if
(
p_input
->
p
->
p_es_out_display
)
es_out_Delete
(
p_input
->
p
->
p_es_out_display
);
es_out_Delete
(
p_input
->
p
->
p_es_out_display
);
...
@@ -357,16 +359,17 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
...
@@ -357,16 +359,17 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
p_input
->
p
->
p_item
=
p_item
;
p_input
->
p
->
p_item
=
p_item
;
/* Init Input fields */
/* Init Input fields */
p_input
->
p
->
input
.
p_demux
=
NULL
;
p_input
->
p
->
master
=
InputSourceNew
(
p_input
);
p_input
->
p
->
input
.
b_title_demux
=
false
;
if
(
unlikely
(
p_input
->
p
->
master
==
NULL
)
)
p_input
->
p
->
input
.
i_title
=
0
;
{
p_input
->
p
->
input
.
title
=
NULL
;
free
(
p_input
->
psz_header
);
p_input
->
p
->
input
.
i_title_offset
=
p_input
->
p
->
input
.
i_seekpoint_offset
=
0
;
free
(
p_input
->
p
);
p_input
->
p
->
input
.
b_can_pace_control
=
true
;
vlc_object_release
(
p_input
);
p_input
->
p
->
input
.
b_can_rate_control
=
true
;
return
NULL
;
p_input
->
p
->
input
.
b_rescale_ts
=
true
;
}
p_input
->
p
->
input
.
b_eof
=
false
;
p_input
->
p
->
master
->
b_can_pace_control
=
true
;
p_input
->
p
->
master
->
b_can_rate_control
=
true
;
p_input
->
p
->
master
->
b_rescale_ts
=
true
;
vlc_mutex_lock
(
&
p_item
->
lock
);
vlc_mutex_lock
(
&
p_item
->
lock
);
if
(
!
p_item
->
p_stats
)
if
(
!
p_item
->
p_stats
)
...
@@ -547,18 +550,18 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t i_
...
@@ -547,18 +550,18 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t i_
(
p_input
->
p
->
i_run
>
0
&&
i_start_mdate
+
p_input
->
p
->
i_run
<
mdate
()
)
)
(
p_input
->
p
->
i_run
>
0
&&
i_start_mdate
+
p_input
->
p
->
i_run
<
mdate
()
)
)
i_ret
=
0
;
/* EOF */
i_ret
=
0
;
/* EOF */
else
else
i_ret
=
demux_Demux
(
p_input
->
p
->
input
.
p_demux
);
i_ret
=
demux_Demux
(
p_input
->
p
->
master
->
p_demux
);
if
(
i_ret
>
0
)
if
(
i_ret
>
0
)
{
{
if
(
p_input
->
p
->
input
.
p_demux
->
info
.
i_update
)
if
(
p_input
->
p
->
master
->
p_demux
->
info
.
i_update
)
{
{
if
(
p_input
->
p
->
input
.
p_demux
->
info
.
i_update
&
INPUT_UPDATE_TITLE_LIST
)
if
(
p_input
->
p
->
master
->
p_demux
->
info
.
i_update
&
INPUT_UPDATE_TITLE_LIST
)
{
{
UpdateTitleListfromDemux
(
p_input
);
UpdateTitleListfromDemux
(
p_input
);
p_input
->
p
->
input
.
p_demux
->
info
.
i_update
&=
~
INPUT_UPDATE_TITLE_LIST
;
p_input
->
p
->
master
->
p_demux
->
info
.
i_update
&=
~
INPUT_UPDATE_TITLE_LIST
;
}
}
if
(
p_input
->
p
->
input
.
b_title_demux
)
if
(
p_input
->
p
->
master
->
b_title_demux
)
{
{
i_ret
=
UpdateTitleSeekpointFromDemux
(
p_input
);
i_ret
=
UpdateTitleSeekpointFromDemux
(
p_input
);
*
pb_changed
=
true
;
*
pb_changed
=
true
;
...
@@ -570,7 +573,7 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t i_
...
@@ -570,7 +573,7 @@ static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t i_
if
(
i_ret
==
0
)
/* EOF */
if
(
i_ret
==
0
)
/* EOF */
{
{
msg_Dbg
(
p_input
,
"EOF reached"
);
msg_Dbg
(
p_input
,
"EOF reached"
);
p_input
->
p
->
input
.
b_eof
=
true
;
p_input
->
p
->
master
->
b_eof
=
true
;
es_out_Eos
(
p_input
->
p
->
p_es_out
);
es_out_Eos
(
p_input
->
p
->
p_es_out
);
}
}
else
if
(
i_ret
<
0
)
else
if
(
i_ret
<
0
)
...
@@ -598,15 +601,15 @@ static int MainLoopTryRepeat( input_thread_t *p_input, mtime_t *pi_start_mdate )
...
@@ -598,15 +601,15 @@ static int MainLoopTryRepeat( input_thread_t *p_input, mtime_t *pi_start_mdate )
}
}
/* Seek to start title/seekpoint */
/* Seek to start title/seekpoint */
val
.
i_int
=
p_input
->
p
->
input
.
i_title_start
-
val
.
i_int
=
p_input
->
p
->
master
->
i_title_start
-
p_input
->
p
->
input
.
i_title_offset
;
p_input
->
p
->
master
->
i_title_offset
;
if
(
val
.
i_int
<
0
||
val
.
i_int
>=
p_input
->
p
->
input
.
i_title
)
if
(
val
.
i_int
<
0
||
val
.
i_int
>=
p_input
->
p
->
master
->
i_title
)
val
.
i_int
=
0
;
val
.
i_int
=
0
;
input_ControlPush
(
p_input
,
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_TITLE
,
&
val
);
INPUT_CONTROL_SET_TITLE
,
&
val
);
val
.
i_int
=
p_input
->
p
->
input
.
i_seekpoint_start
-
val
.
i_int
=
p_input
->
p
->
master
->
i_seekpoint_start
-
p_input
->
p
->
input
.
i_seekpoint_offset
;
p_input
->
p
->
master
->
i_seekpoint_offset
;
if
(
val
.
i_int
>
0
/* TODO: check upper boundary */
)
if
(
val
.
i_int
>
0
/* TODO: check upper boundary */
)
input_ControlPush
(
p_input
,
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_SEEKPOINT
,
&
val
);
INPUT_CONTROL_SET_SEEKPOINT
,
&
val
);
...
@@ -638,16 +641,16 @@ static void MainLoopStatistics( input_thread_t *p_input )
...
@@ -638,16 +641,16 @@ static void MainLoopStatistics( input_thread_t *p_input )
mtime_t
i_length
=
0
;
mtime_t
i_length
=
0
;
/* update input status variables */
/* update input status variables */
if
(
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
if
(
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_GET_POSITION
,
&
f_position
)
)
DEMUX_GET_POSITION
,
&
f_position
)
)
f_position
=
0
.
0
;
f_position
=
0
.
0
;
if
(
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
if
(
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_GET_TIME
,
&
i_time
)
)
DEMUX_GET_TIME
,
&
i_time
)
)
i_time
=
0
;
i_time
=
0
;
p_input
->
p
->
i_time
=
i_time
;
p_input
->
p
->
i_time
=
i_time
;
if
(
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
if
(
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_GET_LENGTH
,
&
i_length
)
)
DEMUX_GET_LENGTH
,
&
i_length
)
)
i_length
=
0
;
i_length
=
0
;
...
@@ -686,11 +689,12 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
...
@@ -686,11 +689,12 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
* is paused -> this may cause problem with some of them
* is paused -> this may cause problem with some of them
* The same problem can be seen when seeking while paused */
* The same problem can be seen when seeking while paused */
if
(
b_paused
)
if
(
b_paused
)
b_paused
=
!
es_out_GetBuffering
(
p_input
->
p
->
p_es_out
)
||
p_input
->
p
->
input
.
b_eof
;
b_paused
=
!
es_out_GetBuffering
(
p_input
->
p
->
p_es_out
)
||
p_input
->
p
->
master
->
b_eof
;
if
(
!
b_paused
)
if
(
!
b_paused
)
{
{
if
(
!
p_input
->
p
->
input
.
b_eof
)
if
(
!
p_input
->
p
->
master
->
b_eof
)
{
{
bool
b_force_update
=
false
;
bool
b_force_update
=
false
;
...
@@ -739,7 +743,7 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
...
@@ -739,7 +743,7 @@ static void MainLoop( input_thread_t *p_input, bool b_interactive )
/* Postpone seeking until ES buffering is complete or at most
/* Postpone seeking until ES buffering is complete or at most
* 125 ms. */
* 125 ms. */
bool
b_postpone
=
es_out_GetBuffering
(
p_input
->
p
->
p_es_out
)
bool
b_postpone
=
es_out_GetBuffering
(
p_input
->
p
->
p_es_out
)
&&
!
p_input
->
p
->
input
.
b_eof
;
&&
!
p_input
->
p
->
master
->
b_eof
;
if
(
b_postpone
)
if
(
b_postpone
)
{
{
mtime_t
now
=
mdate
();
mtime_t
now
=
mdate
();
...
@@ -846,7 +850,7 @@ static int InitSout( input_thread_t * p_input )
...
@@ -846,7 +850,7 @@ static int InitSout( input_thread_t * p_input )
static
void
InitTitle
(
input_thread_t
*
p_input
)
static
void
InitTitle
(
input_thread_t
*
p_input
)
{
{
input_source_t
*
p_master
=
&
p_input
->
p
->
input
;
input_source_t
*
p_master
=
p_input
->
p
->
master
;
if
(
p_input
->
b_preparsing
)
if
(
p_input
->
b_preparsing
)
return
;
return
;
...
@@ -876,13 +880,13 @@ static void StartTitle( input_thread_t * p_input )
...
@@ -876,13 +880,13 @@ static void StartTitle( input_thread_t * p_input )
vlc_value_t
val
;
vlc_value_t
val
;
/* Start title/chapter */
/* Start title/chapter */
val
.
i_int
=
p_input
->
p
->
input
.
i_title_start
-
val
.
i_int
=
p_input
->
p
->
master
->
i_title_start
-
p_input
->
p
->
input
.
i_title_offset
;
p_input
->
p
->
master
->
i_title_offset
;
if
(
val
.
i_int
>
0
&&
val
.
i_int
<
p_input
->
p
->
input
.
i_title
)
if
(
val
.
i_int
>
0
&&
val
.
i_int
<
p_input
->
p
->
master
->
i_title
)
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_TITLE
,
&
val
);
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_TITLE
,
&
val
);
val
.
i_int
=
p_input
->
p
->
input
.
i_seekpoint_start
-
val
.
i_int
=
p_input
->
p
->
master
->
i_seekpoint_start
-
p_input
->
p
->
input
.
i_seekpoint_offset
;
p_input
->
p
->
master
->
i_seekpoint_offset
;
if
(
val
.
i_int
>
0
/* TODO: check upper boundary */
)
if
(
val
.
i_int
>
0
/* TODO: check upper boundary */
)
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_SEEKPOINT
,
&
val
);
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_SEEKPOINT
,
&
val
);
...
@@ -1054,7 +1058,7 @@ static void UpdatePtsDelay( input_thread_t *p_input )
...
@@ -1054,7 +1058,7 @@ static void UpdatePtsDelay( input_thread_t *p_input )
input_thread_private_t
*
p_sys
=
p_input
->
p
;
input_thread_private_t
*
p_sys
=
p_input
->
p
;
/* Get max pts delay from input source */
/* Get max pts delay from input source */
mtime_t
i_pts_delay
=
p_sys
->
input
.
i_pts_delay
;
mtime_t
i_pts_delay
=
p_sys
->
master
->
i_pts_delay
;
for
(
int
i
=
0
;
i
<
p_sys
->
i_slave
;
i
++
)
for
(
int
i
=
0
;
i
<
p_sys
->
i_slave
;
i
++
)
i_pts_delay
=
__MAX
(
i_pts_delay
,
p_sys
->
slave
[
i
]
->
i_pts_delay
);
i_pts_delay
=
__MAX
(
i_pts_delay
,
p_sys
->
slave
[
i
]
->
i_pts_delay
);
...
@@ -1120,17 +1124,17 @@ static void InitPrograms( input_thread_t * p_input )
...
@@ -1120,17 +1124,17 @@ static void InitPrograms( input_thread_t * p_input )
/* Inform the demuxer about waited group (needed only for DVB) */
/* Inform the demuxer about waited group (needed only for DVB) */
if
(
i_es_out_mode
==
ES_OUT_MODE_ALL
)
if
(
i_es_out_mode
==
ES_OUT_MODE_ALL
)
{
{
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
DEMUX_SET_GROUP
,
-
1
,
NULL
);
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_GROUP
,
-
1
,
NULL
);
}
}
else
if
(
i_es_out_mode
==
ES_OUT_MODE_PARTIAL
)
else
if
(
i_es_out_mode
==
ES_OUT_MODE_PARTIAL
)
{
{
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
DEMUX_SET_GROUP
,
-
1
,
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_GROUP
,
-
1
,
&
list
);
&
list
);
TAB_CLEAN
(
list
.
i_count
,
list
.
p_values
);
TAB_CLEAN
(
list
.
i_count
,
list
.
p_values
);
}
}
else
else
{
{
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
DEMUX_SET_GROUP
,
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_GROUP
,
es_out_GetGroupForced
(
p_input
->
p
->
p_es_out
),
NULL
);
es_out_GetGroupForced
(
p_input
->
p
->
p_es_out
),
NULL
);
}
}
}
}
...
@@ -1165,7 +1169,7 @@ static int Init( input_thread_t * p_input )
...
@@ -1165,7 +1169,7 @@ static int Init( input_thread_t * p_input )
input_SendEventCache
(
p_input
,
0
.
0
);
input_SendEventCache
(
p_input
,
0
.
0
);
/* */
/* */
if
(
InputSourceInit
(
p_input
,
&
p_input
->
p
->
input
,
if
(
InputSourceInit
(
p_input
,
p_input
->
p
->
master
,
p_input
->
p
->
p_item
->
psz_uri
,
NULL
,
false
)
)
p_input
->
p
->
p_item
->
psz_uri
,
NULL
,
false
)
)
{
{
goto
error
;
goto
error
;
...
@@ -1176,7 +1180,7 @@ static int Init( input_thread_t * p_input )
...
@@ -1176,7 +1180,7 @@ static int Init( input_thread_t * p_input )
/* Load master infos */
/* Load master infos */
/* Init length */
/* Init length */
mtime_t
i_length
;
mtime_t
i_length
;
if
(
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
DEMUX_GET_LENGTH
,
if
(
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_GET_LENGTH
,
&
i_length
)
)
&
i_length
)
)
i_length
=
0
;
i_length
=
0
;
if
(
i_length
<=
0
)
if
(
i_length
<=
0
)
...
@@ -1222,7 +1226,7 @@ static int Init( input_thread_t * p_input )
...
@@ -1222,7 +1226,7 @@ static int Init( input_thread_t * p_input )
InputMetaUser
(
p_input
,
p_meta
);
InputMetaUser
(
p_input
,
p_meta
);
/* Get meta data from master input */
/* Get meta data from master input */
InputSourceMeta
(
p_input
,
&
p_input
->
p
->
input
,
p_meta
);
InputSourceMeta
(
p_input
,
p_input
->
p
->
master
,
p_meta
);
/* And from slave */
/* And from slave */
for
(
int
i
=
0
;
i
<
p_input
->
p
->
i_slave
;
i
++
)
for
(
int
i
=
0
;
i
<
p_input
->
p
->
i_slave
;
i
++
)
...
@@ -1286,7 +1290,7 @@ error:
...
@@ -1286,7 +1290,7 @@ error:
}
}
/* Mark them deleted */
/* Mark them deleted */
p_input
->
p
->
input
.
p_demux
=
NULL
;
p_input
->
p
->
master
->
p_demux
=
NULL
;
p_input
->
p
->
p_es_out
=
NULL
;
p_input
->
p
->
p_es_out
=
NULL
;
p_input
->
p
->
p_sout
=
NULL
;
p_input
->
p
->
p_sout
=
NULL
;
...
@@ -1310,7 +1314,7 @@ static void End( input_thread_t * p_input )
...
@@ -1310,7 +1314,7 @@ static void End( input_thread_t * p_input )
es_out_SetMode
(
p_input
->
p
->
p_es_out
,
ES_OUT_MODE_NONE
);
es_out_SetMode
(
p_input
->
p
->
p_es_out
,
ES_OUT_MODE_NONE
);
/* Clean up master */
/* Clean up master */
InputSourceClean
(
&
p_input
->
p
->
input
);
InputSourceClean
(
p_input
->
p
->
master
);
/* Delete slave */
/* Delete slave */
for
(
i
=
0
;
i
<
p_input
->
p
->
i_slave
;
i
++
)
for
(
i
=
0
;
i
<
p_input
->
p
->
i_slave
;
i
++
)
...
@@ -1534,7 +1538,7 @@ static void ControlPause( input_thread_t *p_input, mtime_t i_control_date )
...
@@ -1534,7 +1538,7 @@ static void ControlPause( input_thread_t *p_input, mtime_t i_control_date )
if
(
p_input
->
p
->
b_can_pause
)
if
(
p_input
->
p
->
b_can_pause
)
{
{
demux_t
*
p_demux
=
p_input
->
p
->
input
.
p_demux
;
demux_t
*
p_demux
=
p_input
->
p
->
master
->
p_demux
;
if
(
demux_Control
(
p_demux
,
DEMUX_SET_PAUSE_STATE
,
true
)
)
if
(
demux_Control
(
p_demux
,
DEMUX_SET_PAUSE_STATE
,
true
)
)
{
{
...
@@ -1559,7 +1563,7 @@ static void ControlUnpause( input_thread_t *p_input, mtime_t i_control_date )
...
@@ -1559,7 +1563,7 @@ static void ControlUnpause( input_thread_t *p_input, mtime_t i_control_date )
{
{
if
(
p_input
->
p
->
b_can_pause
)
if
(
p_input
->
p
->
b_can_pause
)
{
{
demux_t
*
p_demux
=
p_input
->
p
->
input
.
p_demux
;
demux_t
*
p_demux
=
p_input
->
p
->
master
->
p_demux
;
if
(
demux_Control
(
p_demux
,
DEMUX_SET_PAUSE_STATE
,
false
)
)
if
(
demux_Control
(
p_demux
,
DEMUX_SET_PAUSE_STATE
,
false
)
)
{
{
...
@@ -1601,7 +1605,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1601,7 +1605,7 @@ static bool Control( input_thread_t *p_input,
f_pos
=
1
.
f
;
f_pos
=
1
.
f
;
/* Reset the decoders states and clock sync (before calling the demuxer */
/* Reset the decoders states and clock sync (before calling the demuxer */
es_out_SetTime
(
p_input
->
p
->
p_es_out
,
-
1
);
es_out_SetTime
(
p_input
->
p
->
p_es_out
,
-
1
);
if
(
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
DEMUX_SET_POSITION
,
if
(
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_POSITION
,
(
double
)
f_pos
,
!
p_input
->
p
->
b_fast_seek
)
)
(
double
)
f_pos
,
!
p_input
->
p
->
b_fast_seek
)
)
{
{
msg_Err
(
p_input
,
"INPUT_CONTROL_SET_POSITION(_OFFSET) "
msg_Err
(
p_input
,
"INPUT_CONTROL_SET_POSITION(_OFFSET) "
...
@@ -1611,7 +1615,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1611,7 +1615,7 @@ static bool Control( input_thread_t *p_input,
{
{
if
(
p_input
->
p
->
i_slave
>
0
)
if
(
p_input
->
p
->
i_slave
>
0
)
SlaveSeek
(
p_input
);
SlaveSeek
(
p_input
);
p_input
->
p
->
input
.
b_eof
=
false
;
p_input
->
p
->
master
->
b_eof
=
false
;
b_force_update
=
true
;
b_force_update
=
true
;
}
}
...
@@ -1636,7 +1640,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1636,7 +1640,7 @@ static bool Control( input_thread_t *p_input,
/* Reset the decoders states and clock sync (before calling the demuxer */
/* Reset the decoders states and clock sync (before calling the demuxer */
es_out_SetTime
(
p_input
->
p
->
p_es_out
,
-
1
);
es_out_SetTime
(
p_input
->
p
->
p_es_out
,
-
1
);
i_ret
=
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
i_ret
=
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_TIME
,
i_time
,
DEMUX_SET_TIME
,
i_time
,
!
p_input
->
p
->
b_fast_seek
);
!
p_input
->
p
->
b_fast_seek
);
if
(
i_ret
)
if
(
i_ret
)
...
@@ -1644,11 +1648,11 @@ static bool Control( input_thread_t *p_input,
...
@@ -1644,11 +1648,11 @@ static bool Control( input_thread_t *p_input,
int64_t
i_length
;
int64_t
i_length
;
/* Emulate it with a SET_POS */
/* Emulate it with a SET_POS */
if
(
!
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
if
(
!
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_GET_LENGTH
,
&
i_length
)
&&
i_length
>
0
)
DEMUX_GET_LENGTH
,
&
i_length
)
&&
i_length
>
0
)
{
{
double
f_pos
=
(
double
)
i_time
/
(
double
)
i_length
;
double
f_pos
=
(
double
)
i_time
/
(
double
)
i_length
;
i_ret
=
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
i_ret
=
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_POSITION
,
f_pos
,
DEMUX_SET_POSITION
,
f_pos
,
!
p_input
->
p
->
b_fast_seek
);
!
p_input
->
p
->
b_fast_seek
);
}
}
...
@@ -1662,7 +1666,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1662,7 +1666,7 @@ static bool Control( input_thread_t *p_input,
{
{
if
(
p_input
->
p
->
i_slave
>
0
)
if
(
p_input
->
p
->
i_slave
>
0
)
SlaveSeek
(
p_input
);
SlaveSeek
(
p_input
);
p_input
->
p
->
input
.
b_eof
=
false
;
p_input
->
p
->
master
->
b_eof
=
false
;
b_force_update
=
true
;
b_force_update
=
true
;
}
}
...
@@ -1712,7 +1716,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1712,7 +1716,7 @@ static bool Control( input_thread_t *p_input,
/* Apply direction */
/* Apply direction */
if
(
i_rate_sign
<
0
)
if
(
i_rate_sign
<
0
)
{
{
if
(
p_input
->
p
->
input
.
b_rescale_ts
)
if
(
p_input
->
p
->
master
->
b_rescale_ts
)
{
{
msg_Dbg
(
p_input
,
"cannot set negative rate"
);
msg_Dbg
(
p_input
,
"cannot set negative rate"
);
i_rate
=
p_input
->
p
->
i_rate
;
i_rate
=
p_input
->
p
->
i_rate
;
...
@@ -1725,7 +1729,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1725,7 +1729,7 @@ static bool Control( input_thread_t *p_input,
}
}
if
(
i_rate
!=
INPUT_RATE_DEFAULT
&&
if
(
i_rate
!=
INPUT_RATE_DEFAULT
&&
(
(
!
p_input
->
p
->
b_can_rate_control
&&
!
p_input
->
p
->
input
.
b_rescale_ts
)
||
(
(
!
p_input
->
p
->
b_can_rate_control
&&
!
p_input
->
p
->
master
->
b_rescale_ts
)
||
(
p_input
->
p
->
p_sout
&&
!
p_input
->
p
->
b_out_pace_control
)
)
)
(
p_input
->
p
->
p_sout
&&
!
p_input
->
p
->
b_out_pace_control
)
)
)
{
{
msg_Dbg
(
p_input
,
"cannot change rate"
);
msg_Dbg
(
p_input
,
"cannot change rate"
);
...
@@ -1734,16 +1738,16 @@ static bool Control( input_thread_t *p_input,
...
@@ -1734,16 +1738,16 @@ static bool Control( input_thread_t *p_input,
if
(
i_rate
!=
p_input
->
p
->
i_rate
&&
if
(
i_rate
!=
p_input
->
p
->
i_rate
&&
!
p_input
->
p
->
b_can_pace_control
&&
p_input
->
p
->
b_can_rate_control
)
!
p_input
->
p
->
b_can_pace_control
&&
p_input
->
p
->
b_can_rate_control
)
{
{
demux_t
*
p_demux
=
p_input
->
p
->
input
.
p_demux
;
demux_t
*
p_demux
=
p_input
->
p
->
master
->
p_demux
;
int
i_ret
=
VLC_EGENERIC
;
int
i_ret
=
VLC_EGENERIC
;
if
(
p_demux
->
s
==
NULL
)
if
(
p_demux
->
s
==
NULL
)
{
{
if
(
!
p_input
->
p
->
input
.
b_rescale_ts
)
if
(
!
p_input
->
p
->
master
->
b_rescale_ts
)
es_out_Control
(
p_input
->
p
->
p_es_out
,
ES_OUT_RESET_PCR
);
es_out_Control
(
p_input
->
p
->
p_es_out
,
ES_OUT_RESET_PCR
);
i_ret
=
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
i_ret
=
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_RATE
,
&
i_rate
);
DEMUX_SET_RATE
,
&
i_rate
);
}
}
if
(
i_ret
)
if
(
i_ret
)
{
{
...
@@ -1758,7 +1762,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1758,7 +1762,7 @@ static bool Control( input_thread_t *p_input,
p_input
->
p
->
i_rate
=
i_rate
;
p_input
->
p
->
i_rate
=
i_rate
;
input_SendEventRate
(
p_input
,
i_rate
);
input_SendEventRate
(
p_input
,
i_rate
);
if
(
p_input
->
p
->
input
.
b_rescale_ts
)
if
(
p_input
->
p
->
master
->
b_rescale_ts
)
{
{
const
int
i_rate_source
=
(
p_input
->
p
->
b_can_pace_control
||
p_input
->
p
->
b_can_rate_control
)
?
i_rate
:
INPUT_RATE_DEFAULT
;
const
int
i_rate_source
=
(
p_input
->
p
->
b_can_pace_control
||
p_input
->
p
->
b_can_rate_control
)
?
i_rate
:
INPUT_RATE_DEFAULT
;
es_out_SetRate
(
p_input
->
p
->
p_es_out
,
i_rate_source
,
i_rate
);
es_out_SetRate
(
p_input
->
p
->
p_es_out
,
i_rate_source
,
i_rate
);
...
@@ -1774,7 +1778,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1774,7 +1778,7 @@ static bool Control( input_thread_t *p_input,
es_out_Control
(
p_input
->
p
->
p_es_out
,
es_out_Control
(
p_input
->
p
->
p_es_out
,
ES_OUT_SET_GROUP
,
val
.
i_int
);
ES_OUT_SET_GROUP
,
val
.
i_int
);
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
DEMUX_SET_GROUP
,
val
.
i_int
,
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_GROUP
,
val
.
i_int
,
NULL
);
NULL
);
break
;
break
;
...
@@ -1783,7 +1787,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1783,7 +1787,7 @@ static bool Control( input_thread_t *p_input,
es_out_Control
(
p_input
->
p
->
p_es_out_display
,
es_out_Control
(
p_input
->
p
->
p_es_out_display
,
ES_OUT_SET_ES_BY_ID
,
(
int
)
val
.
i_int
);
ES_OUT_SET_ES_BY_ID
,
(
int
)
val
.
i_int
);
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
DEMUX_SET_ES
,
(
int
)
val
.
i_int
);
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_ES
,
(
int
)
val
.
i_int
);
break
;
break
;
case
INPUT_CONTROL_RESTART_ES
:
case
INPUT_CONTROL_RESTART_ES
:
...
@@ -1810,21 +1814,21 @@ static bool Control( input_thread_t *p_input,
...
@@ -1810,21 +1814,21 @@ static bool Control( input_thread_t *p_input,
msg_Err
(
p_input
,
"INPUT_CONTROL_SET_TITLE(*) ignored while recording"
);
msg_Err
(
p_input
,
"INPUT_CONTROL_SET_TITLE(*) ignored while recording"
);
break
;
break
;
}
}
if
(
p_input
->
p
->
input
.
i_title
<=
0
)
if
(
p_input
->
p
->
master
->
i_title
<=
0
)
break
;
break
;
int
i_title
=
p_input
->
p
->
input
.
p_demux
->
info
.
i_title
;
int
i_title
=
p_input
->
p
->
master
->
p_demux
->
info
.
i_title
;
if
(
i_type
==
INPUT_CONTROL_SET_TITLE_PREV
)
if
(
i_type
==
INPUT_CONTROL_SET_TITLE_PREV
)
i_title
--
;
i_title
--
;
else
if
(
i_type
==
INPUT_CONTROL_SET_TITLE_NEXT
)
else
if
(
i_type
==
INPUT_CONTROL_SET_TITLE_NEXT
)
i_title
++
;
i_title
++
;
else
else
i_title
=
val
.
i_int
;
i_title
=
val
.
i_int
;
if
(
i_title
<
0
||
i_title
>=
p_input
->
p
->
input
.
i_title
)
if
(
i_title
<
0
||
i_title
>=
p_input
->
p
->
master
->
i_title
)
break
;
break
;
es_out_SetTime
(
p_input
->
p
->
p_es_out
,
-
1
);
es_out_SetTime
(
p_input
->
p
->
p_es_out
,
-
1
);
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_TITLE
,
i_title
);
DEMUX_SET_TITLE
,
i_title
);
input_SendEventTitle
(
p_input
,
i_title
);
input_SendEventTitle
(
p_input
,
i_title
);
break
;
break
;
...
@@ -1838,17 +1842,17 @@ static bool Control( input_thread_t *p_input,
...
@@ -1838,17 +1842,17 @@ static bool Control( input_thread_t *p_input,
msg_Err
(
p_input
,
"INPUT_CONTROL_SET_SEEKPOINT(*) ignored while recording"
);
msg_Err
(
p_input
,
"INPUT_CONTROL_SET_SEEKPOINT(*) ignored while recording"
);
break
;
break
;
}
}
if
(
p_input
->
p
->
input
.
i_title
<=
0
)
if
(
p_input
->
p
->
master
->
i_title
<=
0
)
break
;
break
;
demux_t
*
p_demux
=
p_input
->
p
->
input
.
p_demux
;
demux_t
*
p_demux
=
p_input
->
p
->
master
->
p_demux
;
int
i_title
=
p_demux
->
info
.
i_title
;
int
i_title
=
p_demux
->
info
.
i_title
;
int
i_seekpoint
=
p_demux
->
info
.
i_seekpoint
;
int
i_seekpoint
=
p_demux
->
info
.
i_seekpoint
;
if
(
i_type
==
INPUT_CONTROL_SET_SEEKPOINT_PREV
)
if
(
i_type
==
INPUT_CONTROL_SET_SEEKPOINT_PREV
)
{
{
int64_t
i_seekpoint_time
=
p_input
->
p
->
input
.
title
[
i_title
]
->
seekpoint
[
i_seekpoint
]
->
i_time_offset
;
int64_t
i_seekpoint_time
=
p_input
->
p
->
master
->
title
[
i_title
]
->
seekpoint
[
i_seekpoint
]
->
i_time_offset
;
int64_t
i_input_time
=
var_GetInteger
(
p_input
,
"time"
);
int64_t
i_input_time
=
var_GetInteger
(
p_input
,
"time"
);
if
(
i_seekpoint_time
>=
0
&&
i_input_time
>=
0
)
if
(
i_seekpoint_time
>=
0
&&
i_input_time
>=
0
)
{
{
...
@@ -1863,11 +1867,11 @@ static bool Control( input_thread_t *p_input,
...
@@ -1863,11 +1867,11 @@ static bool Control( input_thread_t *p_input,
else
else
i_seekpoint
=
val
.
i_int
;
i_seekpoint
=
val
.
i_int
;
if
(
i_seekpoint
<
0
if
(
i_seekpoint
<
0
||
i_seekpoint
>=
p_input
->
p
->
input
.
title
[
i_title
]
->
i_seekpoint
)
||
i_seekpoint
>=
p_input
->
p
->
master
->
title
[
i_title
]
->
i_seekpoint
)
break
;
break
;
es_out_SetTime
(
p_input
->
p
->
p_es_out
,
-
1
);
es_out_SetTime
(
p_input
->
p
->
p_es_out
,
-
1
);
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_SEEKPOINT
,
i_seekpoint
);
DEMUX_SET_SEEKPOINT
,
i_seekpoint
);
input_SendEventSeekpoint
(
p_input
,
i_title
,
i_seekpoint
);
input_SendEventSeekpoint
(
p_input
,
i_title
,
i_seekpoint
);
break
;
break
;
...
@@ -1892,7 +1896,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1892,7 +1896,7 @@ static bool Control( input_thread_t *p_input,
msg_Dbg
(
p_input
,
"adding %s as slave on the fly"
,
uri
);
msg_Dbg
(
p_input
,
"adding %s as slave on the fly"
,
uri
);
/* Set position */
/* Set position */
if
(
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
if
(
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_GET_TIME
,
&
i_time
)
)
DEMUX_GET_TIME
,
&
i_time
)
)
{
{
msg_Err
(
p_input
,
"demux doesn't like DEMUX_GET_TIME"
);
msg_Err
(
p_input
,
"demux doesn't like DEMUX_GET_TIME"
);
...
@@ -1925,9 +1929,9 @@ static bool Control( input_thread_t *p_input,
...
@@ -1925,9 +1929,9 @@ static bool Control( input_thread_t *p_input,
case
INPUT_CONTROL_SET_RECORD_STATE
:
case
INPUT_CONTROL_SET_RECORD_STATE
:
if
(
!!
p_input
->
p
->
b_recording
!=
!!
val
.
b_bool
)
if
(
!!
p_input
->
p
->
b_recording
!=
!!
val
.
b_bool
)
{
{
if
(
p_input
->
p
->
input
.
b_can_stream_record
)
if
(
p_input
->
p
->
master
->
b_can_stream_record
)
{
{
if
(
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
if
(
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_SET_RECORD_STATE
,
val
.
b_bool
)
)
DEMUX_SET_RECORD_STATE
,
val
.
b_bool
)
)
val
.
b_bool
=
false
;
val
.
b_bool
=
false
;
}
}
...
@@ -1988,7 +1992,7 @@ static bool Control( input_thread_t *p_input,
...
@@ -1988,7 +1992,7 @@ static bool Control( input_thread_t *p_input,
case
INPUT_CONTROL_NAV_DOWN
:
case
INPUT_CONTROL_NAV_DOWN
:
case
INPUT_CONTROL_NAV_LEFT
:
case
INPUT_CONTROL_NAV_LEFT
:
case
INPUT_CONTROL_NAV_RIGHT
:
case
INPUT_CONTROL_NAV_RIGHT
:
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
i_type
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
i_type
-
INPUT_CONTROL_NAV_ACTIVATE
+
DEMUX_NAV_ACTIVATE
);
-
INPUT_CONTROL_NAV_ACTIVATE
+
DEMUX_NAV_ACTIVATE
);
break
;
break
;
...
@@ -2007,10 +2011,10 @@ static bool Control( input_thread_t *p_input,
...
@@ -2007,10 +2011,10 @@ static bool Control( input_thread_t *p_input,
static
int
UpdateTitleSeekpoint
(
input_thread_t
*
p_input
,
static
int
UpdateTitleSeekpoint
(
input_thread_t
*
p_input
,
int
i_title
,
int
i_seekpoint
)
int
i_title
,
int
i_seekpoint
)
{
{
int
i_title_end
=
p_input
->
p
->
input
.
i_title_end
-
int
i_title_end
=
p_input
->
p
->
master
->
i_title_end
-
p_input
->
p
->
input
.
i_title_offset
;
p_input
->
p
->
master
->
i_title_offset
;
int
i_seekpoint_end
=
p_input
->
p
->
input
.
i_seekpoint_end
-
int
i_seekpoint_end
=
p_input
->
p
->
master
->
i_seekpoint_end
-
p_input
->
p
->
input
.
i_seekpoint_offset
;
p_input
->
p
->
master
->
i_seekpoint_offset
;
if
(
i_title_end
>=
0
&&
i_seekpoint_end
>=
0
)
if
(
i_title_end
>=
0
&&
i_seekpoint_end
>=
0
)
{
{
...
@@ -2035,7 +2039,7 @@ static int UpdateTitleSeekpoint( input_thread_t *p_input,
...
@@ -2035,7 +2039,7 @@ static int UpdateTitleSeekpoint( input_thread_t *p_input,
*****************************************************************************/
*****************************************************************************/
static
int
UpdateTitleSeekpointFromDemux
(
input_thread_t
*
p_input
)
static
int
UpdateTitleSeekpointFromDemux
(
input_thread_t
*
p_input
)
{
{
demux_t
*
p_demux
=
p_input
->
p
->
input
.
p_demux
;
demux_t
*
p_demux
=
p_input
->
p
->
master
->
p_demux
;
/* TODO event-like */
/* TODO event-like */
if
(
p_demux
->
info
.
i_update
&
INPUT_UPDATE_TITLE
)
if
(
p_demux
->
info
.
i_update
&
INPUT_UPDATE_TITLE
)
...
@@ -2059,7 +2063,7 @@ static int UpdateTitleSeekpointFromDemux( input_thread_t *p_input )
...
@@ -2059,7 +2063,7 @@ static int UpdateTitleSeekpointFromDemux( input_thread_t *p_input )
static
void
UpdateGenericFromDemux
(
input_thread_t
*
p_input
)
static
void
UpdateGenericFromDemux
(
input_thread_t
*
p_input
)
{
{
demux_t
*
p_demux
=
p_input
->
p
->
input
.
p_demux
;
demux_t
*
p_demux
=
p_input
->
p
->
master
->
p_demux
;
if
(
p_demux
->
info
.
i_update
&
INPUT_UPDATE_META
)
if
(
p_demux
->
info
.
i_update
&
INPUT_UPDATE_META
)
{
{
...
@@ -2077,7 +2081,7 @@ static void UpdateGenericFromDemux( input_thread_t *p_input )
...
@@ -2077,7 +2081,7 @@ static void UpdateGenericFromDemux( input_thread_t *p_input )
static
void
UpdateTitleListfromDemux
(
input_thread_t
*
p_input
)
static
void
UpdateTitleListfromDemux
(
input_thread_t
*
p_input
)
{
{
input_source_t
*
in
=
&
p_input
->
p
->
input
;
input_source_t
*
in
=
p_input
->
p
->
master
;
/* Delete the preexisting titles */
/* Delete the preexisting titles */
if
(
in
->
i_title
>
0
)
if
(
in
->
i_title
>
0
)
...
@@ -2139,7 +2143,7 @@ static int InputSourceInit( input_thread_t *p_input,
...
@@ -2139,7 +2143,7 @@ static int InputSourceInit( input_thread_t *p_input,
MRLSections
(
psz_anchor
,
&
in
->
i_title_start
,
&
in
->
i_title_end
,
MRLSections
(
psz_anchor
,
&
in
->
i_title_start
,
&
in
->
i_title_end
,
&
in
->
i_seekpoint_start
,
&
in
->
i_seekpoint_end
);
&
in
->
i_seekpoint_start
,
&
in
->
i_seekpoint_end
);
if
(
&
p_input
->
p
->
input
==
in
)
if
(
p_input
->
p
->
master
==
in
)
{
/* On master stream only, use input-list */
{
/* On master stream only, use input-list */
char
*
str
=
var_InheritString
(
p_input
,
"input-list"
);
char
*
str
=
var_InheritString
(
p_input
,
"input-list"
);
if
(
str
!=
NULL
)
if
(
str
!=
NULL
)
...
@@ -2381,7 +2385,7 @@ static void SlaveDemux( input_thread_t *p_input )
...
@@ -2381,7 +2385,7 @@ static void SlaveDemux( input_thread_t *p_input )
int64_t
i_time
;
int64_t
i_time
;
int
i
;
int
i
;
if
(
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
DEMUX_GET_TIME
,
&
i_time
)
)
if
(
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_GET_TIME
,
&
i_time
)
)
{
{
msg_Err
(
p_input
,
"demux doesn't like DEMUX_GET_TIME"
);
msg_Err
(
p_input
,
"demux doesn't like DEMUX_GET_TIME"
);
return
;
return
;
...
@@ -2437,7 +2441,7 @@ static void SlaveSeek( input_thread_t *p_input )
...
@@ -2437,7 +2441,7 @@ static void SlaveSeek( input_thread_t *p_input )
int64_t
i_time
;
int64_t
i_time
;
int
i
;
int
i
;
if
(
demux_Control
(
p_input
->
p
->
input
.
p_demux
,
DEMUX_GET_TIME
,
&
i_time
)
)
if
(
demux_Control
(
p_input
->
p
->
master
->
p_demux
,
DEMUX_GET_TIME
,
&
i_time
)
)
{
{
msg_Err
(
p_input
,
"demux doesn't like DEMUX_GET_TIME"
);
msg_Err
(
p_input
,
"demux doesn't like DEMUX_GET_TIME"
);
return
;
return
;
...
...
src/input/input_internal.h
View file @
786cd054
...
@@ -127,7 +127,7 @@ struct input_thread_private_t
...
@@ -127,7 +127,7 @@ struct input_thread_private_t
input_item_t
*
p_item
;
input_item_t
*
p_item
;
/* Main source */
/* Main source */
input_source_t
input
;
input_source_t
*
master
;
/* Slave sources (subs, and others) */
/* Slave sources (subs, and others) */
int
i_slave
;
int
i_slave
;
input_source_t
**
slave
;
input_source_t
**
slave
;
...
...
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