[vlc-commits] access: bluray: add discontinuity handler in es_out
Francois Cartegnie
git at videolan.org
Tue Oct 30 18:12:39 CET 2018
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct 22 19:54:10 2018 +0200| [f7bb1745ca002046c5ead588262b56141ebbbbba] | committer: Francois Cartegnie
access: bluray: add discontinuity handler in es_out
(cherry picked from commit 21161cdce8d1302e9911a45f71fc0a03f67ca5cb)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=f7bb1745ca002046c5ead588262b56141ebbbbba
---
modules/access/bluray.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 966a79a468..237e8f86eb 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -202,6 +202,7 @@ typedef struct
{
es_format_t fmt;
es_out_id_t *p_es;
+ int i_next_block_flags;
} es_pair_t;
static bool es_pair_Add(vlc_array_t *p_array, const es_format_t *p_fmt,
@@ -211,6 +212,7 @@ static bool es_pair_Add(vlc_array_t *p_array, const es_format_t *p_fmt,
if (likely(p_pair != NULL))
{
p_pair->p_es = p_es;
+ p_pair->i_next_block_flags = 0;
if(vlc_array_append(p_array, p_pair) != VLC_SUCCESS)
{
free(p_pair);
@@ -1070,6 +1072,7 @@ typedef struct
vlc_object_t *p_obj;
vlc_array_t es; /* es_pair_t */
void *priv;
+ bool b_discontinuity;
bool b_disable_output;
vlc_mutex_t lock;
struct
@@ -1084,6 +1087,7 @@ enum
{
BLURAY_ES_OUT_CONTROL_SET_ES_BY_PID = ES_OUT_PRIVATE_START,
BLURAY_ES_OUT_CONTROL_UNSET_ES_BY_PID,
+ BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY,
BLURAY_ES_OUT_CONTROL_ENABLE_OUTPUT,
BLURAY_ES_OUT_CONTROL_DISABLE_OUTPUT,
};
@@ -1154,6 +1158,16 @@ static int bluray_esOutSend(es_out_t *p_out, es_out_id_t *p_es, block_t *p_block
bluray_esout_sys_t *esout_sys = (bluray_esout_sys_t *)p_out->p_sys;
vlc_mutex_lock(&esout_sys->lock);
+
+ if(esout_sys->b_discontinuity)
+ esout_sys->b_discontinuity = false;
+
+ es_pair_t *p_pair = getEsPairByES(&esout_sys->es, p_es);
+ if(p_pair && p_pair->i_next_block_flags)
+ {
+ p_block->i_flags |= p_pair->i_next_block_flags;
+ p_pair->i_next_block_flags = 0;
+ }
if(esout_sys->b_disable_output)
{
block_Release(p_block);
@@ -1167,9 +1181,12 @@ static void bluray_esOutDel(es_out_t *p_out, es_out_id_t *p_es)
{
bluray_esout_sys_t *esout_sys = (bluray_esout_sys_t *)p_out->p_sys;
- es_pair_t *p_pair = getEsPairByES(&esout_sys->es, p_es);
vlc_mutex_lock(&esout_sys->lock);
+ if(esout_sys->b_discontinuity)
+ esout_sys->b_discontinuity = false;
+
+ es_pair_t *p_pair = getEsPairByES(&esout_sys->es, p_es);
if (p_pair)
es_pair_Remove(&esout_sys->es, p_pair);
@@ -1191,6 +1208,9 @@ static int bluray_esOutControl(es_out_t *p_out, int i_query, va_list args)
return VLC_EGENERIC;
}
+ if(esout_sys->b_discontinuity)
+ esout_sys->b_discontinuity = false;
+
switch(i_query)
{
case BLURAY_ES_OUT_CONTROL_SET_ES_BY_PID:
@@ -1226,6 +1246,12 @@ static int bluray_esOutControl(es_out_t *p_out, int i_query, va_list args)
break;
};
+ case BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY:
+ {
+ esout_sys->b_discontinuity = true;
+ i_ret = VLC_SUCCESS;
+ } break;
+
case BLURAY_ES_OUT_CONTROL_ENABLE_OUTPUT:
case BLURAY_ES_OUT_CONTROL_DISABLE_OUTPUT:
{
@@ -1288,6 +1314,7 @@ static es_out_t *esOutNew(vlc_object_t *p_obj, es_out_t *p_dst_out, void *priv)
esout_sys->p_dst_out = p_dst_out;
esout_sys->p_obj = p_obj;
esout_sys->priv = priv;
+ esout_sys->b_discontinuity = false;
esout_sys->b_disable_output = false;
esout_sys->selected.i_audio_pid = -1;
esout_sys->selected.i_video_pid = -1;
@@ -2040,6 +2067,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
}
blurayRestartParser(p_demux, true);
notifyDiscontinuityToParser(p_sys);
+ es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY);
break;
}
case DEMUX_SET_SEEKPOINT:
@@ -2093,6 +2121,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
bd_seek_time(p_sys->bluray, TO_TICKS(i_time));
blurayRestartParser(p_demux, true);
notifyDiscontinuityToParser(p_sys);
+ es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY);
return VLC_SUCCESS;
}
case DEMUX_GET_TIME:
@@ -2121,6 +2150,7 @@ static int blurayControl(demux_t *p_demux, int query, va_list args)
bd_seek_time(p_sys->bluray, TO_TICKS(f_position*CUR_LENGTH));
blurayRestartParser(p_demux, true);
notifyDiscontinuityToParser(p_sys);
+ es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY);
return VLC_SUCCESS;
}
@@ -2553,6 +2583,7 @@ static void blurayHandleEvent(demux_t *p_demux, const BD_EVENT *e)
case BD_EVENT_DISCONTINUITY:
/* reset demuxer (partially decoded PES packets must be dropped) */
blurayRestartParser(p_demux, false);
+ es_out_Control(p_sys->p_out, BLURAY_ES_OUT_CONTROL_FLAG_DISCONTINUITY);
break;
case BD_EVENT_END_OF_TITLE:
p_sys->b_pl_playing = false;
More information about the vlc-commits
mailing list