[vlc-devel] [RFC PATCHv2 10/18] demux: use a stable id for one-track modules
Thomas Guillem
thomas at gllm.fr
Tue Feb 18 17:11:23 CET 2020
These demux modules can only output one ES track.
Therefore, these ES tracks are necessarily identifiable by a stable id.
---
modules/demux/aiff.c | 1 +
modules/demux/au.c | 1 +
modules/demux/caf.c | 1 +
modules/demux/cdg.c | 1 +
modules/demux/flac.c | 1 +
modules/demux/mjpeg.c | 1 +
modules/demux/mpc.c | 1 +
modules/demux/mpeg/es.c | 1 +
modules/demux/mpeg/h26x.c | 1 +
modules/demux/nuv.c | 3 +++
modules/demux/rawaud.c | 1 +
modules/demux/smf.c | 1 +
modules/demux/stl.c | 1 +
modules/demux/subtitle.c | 1 +
modules/demux/ttml.c | 1 +
modules/demux/vc1.c | 1 +
modules/demux/wav.c | 1 +
modules/demux/webvtt.c | 1 +
18 files changed, 20 insertions(+)
diff --git a/modules/demux/aiff.c b/modules/demux/aiff.c
index 6986ded7d81..77fb9dfa2c2 100644
--- a/modules/demux/aiff.c
+++ b/modules/demux/aiff.c
@@ -205,6 +205,7 @@ static int Open( vlc_object_t *p_this )
}
/* */
+ p_sys->fmt.i_id = 0;
p_sys->es = es_out_Add( p_demux->out, &p_sys->fmt );
if( unlikely(p_sys->es == NULL) )
return VLC_ENOMEM;
diff --git a/modules/demux/au.c b/modules/demux/au.c
index 212d5c0c347..e2b4618976d 100644
--- a/modules/demux/au.c
+++ b/modules/demux/au.c
@@ -271,6 +271,7 @@ static int Open( vlc_object_t *p_this )
}
/* add the es */
+ p_sys->fmt.i_id = 0;
p_sys->es = es_out_Add( p_demux->out, &p_sys->fmt );
if( unlikely(p_sys->es == NULL) )
return VLC_ENOMEM;
diff --git a/modules/demux/caf.c b/modules/demux/caf.c
index 77b687e4b3b..268c5ae2702 100644
--- a/modules/demux/caf.c
+++ b/modules/demux/caf.c
@@ -897,6 +897,7 @@ static int Open( vlc_object_t *p_this )
goto caf_open_end;
}
+ p_sys->fmt.i_id = 0;
p_sys->es = es_out_Add( p_demux->out, &p_sys->fmt );
if( !p_sys->es )
diff --git a/modules/demux/cdg.c b/modules/demux/cdg.c
index 33def4d7c79..ae5cc1c2a4f 100644
--- a/modules/demux/cdg.c
+++ b/modules/demux/cdg.c
@@ -94,6 +94,7 @@ static int Open( vlc_object_t * p_this )
p_sys->fmt.video.i_visible_width = p_sys->fmt.video.i_width;
p_sys->fmt.video.i_visible_height = p_sys->fmt.video.i_height;
+ p_sys->fmt.i_id = 0;
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->fmt );
if( unlikely(p_sys->p_es == NULL) )
return VLC_ENOMEM;
diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index a8acb5ac60f..92ad0178f9f 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -174,6 +174,7 @@ static int Open( vlc_object_t * p_this )
vlc_meta_Set( p_sys->p_meta, vlc_meta_ArtworkURL, psz_url );
}
+ p_sys->p_packetizer->fmt_in.i_id = 0;
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->p_packetizer->fmt_in );
if( !p_sys->p_es )
goto error;
diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index 6d74088a606..d5e8dbdfcf9 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -381,6 +381,7 @@ static int Open( vlc_object_t * p_this )
es_format_Init( &p_sys->fmt, VIDEO_ES, VLC_CODEC_MJPG );
+ p_sys->fmt.i_id = 0;
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->fmt );
if( unlikely(p_sys->p_es == NULL) )
return VLC_ENOMEM;
diff --git a/modules/demux/mpc.c b/modules/demux/mpc.c
index a7507890b82..d7438c75588 100644
--- a/modules/demux/mpc.c
+++ b/modules/demux/mpc.c
@@ -189,6 +189,7 @@ static int Open( vlc_object_t * p_this )
#undef CONVERT_GAIN
#undef CONVERT_PEAK
+ fmt.i_id = 0;
p_sys->p_es = es_out_Add( p_demux->out, &fmt );
if( !p_sys->p_es )
goto error;
diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index 427685c68bc..f32d741043f 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -660,6 +660,7 @@ static bool Parse( demux_t *p_demux, block_t **pp_output )
if( !p_sys->p_es )
{
p_sys->p_packetizer->fmt_out.b_packetized = true;
+ p_sys->p_packetizer->fmt_out.i_id = 0;
p_sys->p_es = es_out_Add( p_demux->out,
&p_sys->p_packetizer->fmt_out);
diff --git a/modules/demux/mpeg/h26x.c b/modules/demux/mpeg/h26x.c
index bf0be713950..b9af7ccc882 100644
--- a/modules/demux/mpeg/h26x.c
+++ b/modules/demux/mpeg/h26x.c
@@ -443,6 +443,7 @@ static int Demux( demux_t *p_demux)
if( p_sys->p_es == NULL )
{
p_sys->p_packetizer->fmt_out.b_packetized = true;
+ p_sys->p_packetizer->fmt_out.i_id = 0;
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->p_packetizer->fmt_out );
if( !p_sys->p_es )
{
diff --git a/modules/demux/nuv.c b/modules/demux/nuv.c
index 7ef9c213409..0b0600d5087 100644
--- a/modules/demux/nuv.c
+++ b/modules/demux/nuv.c
@@ -296,6 +296,7 @@ static int Open( vlc_object_t * p_this )
}
/* Create audio/video (will work only with extended header and audio=mp3 */
+ int id = 0;
if( p_sys->hdr.i_video_blocks != 0 )
{
es_format_t fmt;
@@ -310,6 +311,7 @@ static int Open( vlc_object_t * p_this )
fmt.video.i_sar_num = p_sys->hdr.d_aspect * fmt.video.i_height;
fmt.video.i_sar_den = fmt.video.i_width;
+ fmt.i_id = id++;
p_sys->p_es_video = es_out_Add( p_demux->out, &fmt );
}
if( p_sys->hdr.i_audio_blocks != 0 )
@@ -320,6 +322,7 @@ static int Open( vlc_object_t * p_this )
fmt.audio.i_rate = p_sys->exh.i_audio_sample_rate;
fmt.audio.i_bitspersample = p_sys->exh.i_audio_bits_per_sample;
+ fmt.i_id = id++;
p_sys->p_es_audio = es_out_Add( p_demux->out, &fmt );
}
if( p_sys->hdr.i_text_blocks != 0 )
diff --git a/modules/demux/rawaud.c b/modules/demux/rawaud.c
index 87b21121020..0e39928f671 100644
--- a/modules/demux/rawaud.c
+++ b/modules/demux/rawaud.c
@@ -202,6 +202,7 @@ static int Open( vlc_object_t * p_this )
p_sys->fmt.i_bitrate);
/* add the es */
+ p_sys->fmt.i_id = 0;
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->fmt );
msg_Dbg( p_demux, "elementary stream added");
diff --git a/modules/demux/smf.c b/modules/demux/smf.c
index 9d38c523969..454a802623c 100644
--- a/modules/demux/smf.c
+++ b/modules/demux/smf.c
@@ -706,6 +706,7 @@ static int Open (vlc_object_t *obj)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MIDI);
fmt.audio.i_channels = 2;
fmt.audio.i_rate = 44100; /* dummy value */
+ fmt.i_id = 0;
sys->es = es_out_Add (demux->out, &fmt);
demux->pf_demux = Demux;
diff --git a/modules/demux/stl.c b/modules/demux/stl.c
index 02c10cd556f..a6357668727 100644
--- a/modules/demux/stl.c
+++ b/modules/demux/stl.c
@@ -314,6 +314,7 @@ static int Open(vlc_object_t *object)
fmt.i_extra = sizeof(header);
fmt.p_extra = header;
+ fmt.i_id = 0;
sys->es = es_out_Add(demux->out, &fmt);
fmt.i_extra = 0;
fmt.p_extra = NULL;
diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 9c2842a7971..968a356a596 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -707,6 +707,7 @@ static int Open ( vlc_object_t *p_this )
fmt.i_extra = strlen( p_sys->props.psz_header ) + 1;
}
+ fmt.i_id = 0;
p_sys->es = es_out_Add( p_demux->out, &fmt );
es_format_Clean( &fmt );
if( p_sys->es == NULL )
diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index 532c92d0d48..bc688f8b18a 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -536,6 +536,7 @@ int tt_OpenDemux( vlc_object_t* p_this )
es_format_t fmt;
es_format_Init( &fmt, SPU_ES, VLC_CODEC_TTML );
+ fmt.i_id = 0;
p_sys->p_es = es_out_Add( p_demux->out, &fmt );
if( !p_sys->p_es )
goto error;
diff --git a/modules/demux/vc1.c b/modules/demux/vc1.c
index 6cdbf409935..6902faf9fb7 100644
--- a/modules/demux/vc1.c
+++ b/modules/demux/vc1.c
@@ -166,6 +166,7 @@ static int Demux( demux_t *p_demux)
if( p_sys->p_es == NULL )
{
p_sys->p_packetizer->fmt_out.b_packetized = true;
+ p_sys->p_packetizer->fmt_out.i_id = 0;
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->p_packetizer->fmt_out);
}
diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index 3d6fbd8b688..7174cfb6817 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -428,6 +428,7 @@ static int Open( vlc_object_t * p_this )
p_sys->fmt.audio.i_rate * 8 / p_sys->i_frame_samples;
}
+ p_sys->fmt.i_id = 0;
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->fmt );
if( unlikely(p_sys->p_es == NULL) )
goto error;
diff --git a/modules/demux/webvtt.c b/modules/demux/webvtt.c
index e2e1219bd8a..dd835e2d126 100644
--- a/modules/demux/webvtt.c
+++ b/modules/demux/webvtt.c
@@ -669,6 +669,7 @@ int webvtt_OpenDemux ( vlc_object_t *p_this )
size_t i_extra = 0;
MakeExtradata( p_sys, &fmt.p_extra, &i_extra );
fmt.i_extra = i_extra;
+ fmt.i_id = 0;
p_sys->es = es_out_Add( p_demux->out, &fmt );
es_format_Clean( &fmt );
if( p_sys->es == NULL )
--
2.20.1
More information about the vlc-devel
mailing list