Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
85e74366
Commit
85e74366
authored
Jul 15, 2015
by
François Cartegnie
🤞
Browse files
demux: adaptative: add offset to streams
parent
052ac2b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/demux/adaptative/Streams.cpp
View file @
85e74366
...
...
@@ -308,6 +308,7 @@ BaseStreamOutput::BaseStreamOutput(demux_t *demux, const StreamFormat &format, c
restarting
=
false
;
demuxstream
=
NULL
;
b_drop
=
false
;
timestamps_offset
=
VLC_TS_INVALID
;
fakeesout
=
new
es_out_t
;
if
(
!
fakeesout
)
...
...
@@ -466,6 +467,13 @@ void BaseStreamOutput::sendToDecoderUnlocked(mtime_t nzdeadline)
}
}
void
BaseStreamOutput
::
setTimestampOffset
(
mtime_t
offset
)
{
vlc_mutex_lock
(
&
lock
);
timestamps_offset
=
VLC_TS_0
+
offset
;
vlc_mutex_unlock
(
&
lock
);
}
BaseStreamOutput
::
Demuxed
::
Demuxed
(
es_out_id_t
*
id
,
const
es_format_t
*
fmt
)
{
p_queue
=
NULL
;
...
...
@@ -551,6 +559,15 @@ int BaseStreamOutput::esOutSend(es_out_t *fakees, es_out_id_t *p_es, block_t *p_
}
else
{
if
(
me
->
timestamps_offset
>
VLC_TS_INVALID
)
{
if
(
p_block
->
i_dts
>
VLC_TS_INVALID
)
p_block
->
i_dts
+=
(
me
->
timestamps_offset
-
VLC_TS_0
);
if
(
p_block
->
i_pts
>
VLC_TS_INVALID
)
p_block
->
i_pts
+=
(
me
->
timestamps_offset
-
VLC_TS_0
);
}
std
::
list
<
Demuxed
*>::
const_iterator
it
;
for
(
it
=
me
->
queues
.
begin
();
it
!=
me
->
queues
.
end
();
++
it
)
{
...
...
@@ -604,17 +621,21 @@ int BaseStreamOutput::esOutControl(es_out_t *fakees, int i_query, va_list args)
BaseStreamOutput
*
me
=
(
BaseStreamOutput
*
)
fakees
->
p_sys
;
if
(
i_query
==
ES_OUT_SET_PCR
)
{
vlc_mutex_lock
(
&
me
->
lock
);
me
->
pcr
=
(
int64_t
)
va_arg
(
args
,
int64_t
);
vlc_mutex_unlock
(
&
me
->
lock
);
vlc_mutex_lock
(
&
lock
);
pcr
=
(
int64_t
)
va_arg
(
args
,
int64_t
);
if
(
me
->
pcr
>
VLC_TS_INVALID
&&
me
->
timestamps_offset
>
VLC_TS_INVALID
)
me
->
pcr
+=
(
me
->
timestamps_offset
-
VLC_TS_0
);
vlc_mutex_unlock
(
&
lock
);
return
VLC_SUCCESS
;
}
else
if
(
i_query
==
ES_OUT_SET_GROUP_PCR
)
{
vlc_mutex_lock
(
&
me
->
lock
);
vlc_mutex_lock
(
&
lock
);
me
->
group
=
(
int
)
va_arg
(
args
,
int
);
me
->
pcr
=
(
int64_t
)
va_arg
(
args
,
int64_t
);
vlc_mutex_unlock
(
&
me
->
lock
);
if
(
me
->
pcr
>
VLC_TS_INVALID
&&
me
->
timestamps_offset
>
VLC_TS_INVALID
)
me
->
pcr
+=
(
me
->
timestamps_offset
-
VLC_TS_0
);
vlc_mutex_unlock
(
&
lock
);
return
VLC_SUCCESS
;
}
else
if
(
i_query
==
ES_OUT_GET_ES_STATE
)
...
...
modules/demux/adaptative/Streams.hpp
View file @
85e74366
...
...
@@ -142,6 +142,7 @@ namespace adaptative
virtual
void
sendToDecoder
(
mtime_t
);
/* reimpl */
virtual
bool
reinitsOnSeek
()
const
;
/* reimpl */
virtual
bool
switchAllowed
()
const
;
/* reimpl */
void
setTimestampOffset
(
mtime_t
);
protected:
es_out_t
*
fakeesout
;
/* to intercept/proxy what is sent from demuxstream */
...
...
@@ -149,6 +150,7 @@ namespace adaptative
bool
seekable
;
std
::
string
name
;
bool
restarting
;
mtime_t
timestamps_offset
;
private:
static
es_out_id_t
*
esOutAdd
(
es_out_t
*
,
const
es_format_t
*
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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