[vlc-devel] [PATCH 9/9] modules: use es_format_Replace when copying an es_format_t on an initialized one
Steve Lhomme
robux4 at videolabs.io
Wed Jul 12 16:54:12 CEST 2017
---
modules/codec/ddummy.c | 2 +-
modules/codec/rawvideo.c | 2 +-
modules/codec/xwd.c | 2 +-
modules/demux/mpeg/ts_psi.c | 4 ++--
modules/demux/mpeg/ts_sl.c | 4 ++--
modules/demux/ogg.c | 4 +---
modules/hw/mmal/deinterlace.c | 2 +-
modules/mux/mp4/mp4.c | 2 +-
modules/stream_out/transcode/video.c | 2 +-
modules/video_chroma/chain.c | 5 ++---
modules/video_filter/canvas.c | 2 +-
11 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/modules/codec/ddummy.c b/modules/codec/ddummy.c
index 266e636b49..e8dff49ca2 100644
--- a/modules/codec/ddummy.c
+++ b/modules/codec/ddummy.c
@@ -111,7 +111,7 @@ static int OpenDecoderCommon( vlc_object_t *p_this, bool b_force_dump )
/* Set callbacks */
p_dec->pf_decode = DecodeBlock;
- es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
+ es_format_Replace( &p_dec->fmt_out, &p_dec->fmt_in );
return VLC_SUCCESS;
}
diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index 3db4c94d0b..bb2572a896 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -101,7 +101,7 @@ static int OpenCommon( decoder_t *p_dec, bool b_packetizer )
p_dec->fmt_in.video.i_visible_height = p_dec->fmt_in.video.i_height;
if ( !b_packetizer )
- es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
+ es_format_Replace( &p_dec->fmt_out, &p_dec->fmt_in );
date_Init( &p_sys->pts, p_dec->fmt_out.video.i_frame_rate,
p_dec->fmt_out.video.i_frame_rate_base );
diff --git a/modules/codec/xwd.c b/modules/codec/xwd.c
index 3e26b0be9f..8ba44402d9 100644
--- a/modules/codec/xwd.c
+++ b/modules/codec/xwd.c
@@ -50,7 +50,7 @@ static int Open(vlc_object_t *obj)
return VLC_EGENERIC;
dec->pf_decode = Decode;
- es_format_Copy(&dec->fmt_out, &dec->fmt_in);
+ es_format_Replace( &dec->fmt_out, &dec->fmt_in );
dec->fmt_out.i_codec = VLC_CODEC_RGB32;
return VLC_SUCCESS;
}
diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index 622f4a13ee..dbf4ad5cb7 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -681,7 +681,7 @@ static void PMTSetupEsTeletext( demux_t *p_demux, ts_stream_t *p_pes,
if( !p_page_es )
break;
- es_format_Copy( &p_page_es->fmt, p_fmt );
+ es_format_Replace( &p_page_es->fmt, p_fmt );
free( p_page_es->fmt.psz_language );
free( p_page_es->fmt.psz_description );
p_page_es->fmt.psz_language = NULL;
@@ -757,7 +757,7 @@ static void PMTSetupEsDvbSubtitle( demux_t *p_demux, ts_stream_t *p_pes,
if( !p_subs_es )
break;
- es_format_Copy( &p_subs_es->fmt, p_fmt );
+ es_format_Replace( &p_subs_es->fmt, p_fmt );
free( p_subs_es->fmt.psz_language );
free( p_subs_es->fmt.psz_description );
p_subs_es->fmt.psz_language = NULL;
diff --git a/modules/demux/mpeg/ts_sl.c b/modules/demux/mpeg/ts_sl.c
index 03369be178..e5dbcfa209 100644
--- a/modules/demux/mpeg/ts_sl.c
+++ b/modules/demux/mpeg/ts_sl.c
@@ -172,8 +172,7 @@ void SLPackets_Section_Handler( demux_t *p_demux,
{
fmt.i_id = p_es->fmt.i_id;
fmt.i_group = p_es->fmt.i_group;
- es_format_Clean( &p_es->fmt );
- p_es->fmt = fmt;
+ es_format_Replace( &p_es->fmt, &fmt );
if( p_es->id )
es_out_Del( p_demux->out, p_es->id );
@@ -181,6 +180,7 @@ void SLPackets_Section_Handler( demux_t *p_demux,
p_es->id = es_out_Add( p_demux->out, &p_es->fmt );
b_changed = true;
}
+ es_format_Clean( &fmt );
}
}
diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 38b06006b4..632eb344c6 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -2118,9 +2118,7 @@ static void Ogg_CreateES( demux_t *p_demux )
p_stream->b_reinit = false;
p_stream->b_initializing = false;
p_stream->i_pre_skip = 0;
- es_format_Change( &p_stream->fmt_old, p_old_stream->fmt.i_cat,
- p_old_stream->fmt.i_codec );
- es_format_Copy( &p_stream->fmt_old, &p_old_stream->fmt );
+ es_format_Replace( &p_stream->fmt_old, &p_old_stream->fmt );
bool b_resetdecoder = Ogg_LogicalStreamResetEsFormat( p_demux, p_stream );
p_old_stream->p_es = NULL;
diff --git a/modules/hw/mmal/deinterlace.c b/modules/hw/mmal/deinterlace.c
index 4caf508d3a..099295ca1d 100644
--- a/modules/hw/mmal/deinterlace.c
+++ b/modules/hw/mmal/deinterlace.c
@@ -149,7 +149,7 @@ static int Open(filter_t *filter)
sys->input->format->es->video.par.num = filter->fmt_in.video.i_sar_num;
sys->input->format->es->video.par.den = filter->fmt_in.video.i_sar_den;
- es_format_Copy(&filter->fmt_out, &filter->fmt_in);
+ es_format_Replace(&filter->fmt_out, &filter->fmt_in);
filter->fmt_out.video.i_frame_rate *= 2;
status = mmal_port_format_commit(sys->input);
diff --git a/modules/mux/mp4/mp4.c b/modules/mux/mp4/mp4.c
index fd8d144f11..9b3e0cabb6 100644
--- a/modules/mux/mp4/mp4.c
+++ b/modules/mux/mp4/mp4.c
@@ -410,7 +410,7 @@ static int AddStream(sout_mux_t *p_mux, sout_input_t *p_input)
return VLC_ENOMEM;
}
- es_format_Copy(&p_stream->mux.fmt, p_input->p_fmt);
+ es_format_Replace(&p_stream->mux.fmt, p_input->p_fmt);
p_stream->i_length_neg = 0;
p_stream->i_first_dts = VLC_TS_INVALID;
switch( p_stream->mux.fmt.i_cat )
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index ec00e08acb..2e7e27c5d9 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -357,7 +357,7 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
}
filter_chain_AppendFromString( id->p_uf_chain, p_stream->p_sys->psz_vf2 );
p_fmt_out = filter_chain_GetFmtOut( id->p_uf_chain );
- es_format_Copy( &id->p_encoder->fmt_in, p_fmt_out );
+ es_format_Replace( &id->p_encoder->fmt_in, p_fmt_out );
id->p_encoder->fmt_out.video.i_width =
id->p_encoder->fmt_in.video.i_width;
id->p_encoder->fmt_out.video.i_height =
diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c
index a79c666cea..62f9837723 100644
--- a/modules/video_chroma/chain.c
+++ b/modules/video_chroma/chain.c
@@ -360,9 +360,8 @@ static int BuildFilterChain( filter_t *p_filter )
}
if (i_ret == VLC_SUCCESS)
{
- es_format_Clean( &p_filter->fmt_out );
- es_format_Copy( &p_filter->fmt_out,
- filter_chain_GetFmtOut( p_filter->p_sys->p_chain ) );
+ es_format_Replace( &p_filter->fmt_out,
+ filter_chain_GetFmtOut( p_filter->p_sys->p_chain ) );
}
else
filter_chain_Reset( p_filter->p_sys->p_chain, &p_filter->fmt_in, &p_filter->fmt_out );
diff --git a/modules/video_filter/canvas.c b/modules/video_filter/canvas.c
index b3096d2ede..7dd0dac53a 100644
--- a/modules/video_filter/canvas.c
+++ b/modules/video_filter/canvas.c
@@ -350,7 +350,7 @@ static int Activate( vlc_object_t *p_this )
}
fmt = *filter_chain_GetFmtOut( p_sys->p_chain );
- es_format_Copy( &p_filter->fmt_out, &fmt );
+ es_format_Replace( &p_filter->fmt_out, &fmt );
vlc_ureduce( &p_filter->fmt_out.video.i_sar_num,
&p_filter->fmt_out.video.i_sar_den,
--
2.12.1
More information about the vlc-devel
mailing list