[vlc-commits] demux: ts: split SL specific code
Francois Cartegnie
git at videolan.org
Wed Jun 21 21:33:56 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jun 19 16:35:50 2017 +0200| [2cf52d0c6fafa379766c09adc50f7b81ca861387] | committer: Francois Cartegnie
demux: ts: split SL specific code
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2cf52d0c6fafa379766c09adc50f7b81ca861387
---
modules/demux/mpeg/ts.c | 32 +-------------------------------
modules/demux/mpeg/ts_sl.c | 37 +++++++++++++++++++++++++++++++++++++
modules/demux/mpeg/ts_sl.h | 3 +++
3 files changed, 41 insertions(+), 31 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index acf0698e3c..7337880cb9 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1573,37 +1573,7 @@ static void ParsePESDataChain( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes )
if( pid->u.p_pes->i_stream_type == 0x12 &&
((i_stream_id & 0xFE) == 0xFA) /* 0xFA || 0xFB */ )
{
- const es_mpeg4_descriptor_t *p_desc = GetMPEG4DescByEsId( p_pmt, p_es->i_sl_es_id );
- if(!p_desc)
- {
- block_Release( p_block );
- p_block = NULL;
- }
- else
- {
- sl_header_data header = DecodeSLHeader( p_block->i_buffer, p_block->p_buffer,
- &p_mpeg4desc->sl_descr );
- p_block->i_buffer -= header.i_size;
- p_block->p_buffer += header.i_size;
- p_block->i_dts = header.i_dts ? header.i_dts : p_block->i_dts;
- p_block->i_pts = header.i_pts ? header.i_pts : p_block->i_pts;
-
- /* Assemble access units */
- if( header.b_au_start && pid->u.p_pes->sl.p_data )
- {
- block_ChainRelease( pid->u.p_pes->sl.p_data );
- pid->u.p_pes->sl.p_data = NULL;
- pid->u.p_pes->sl.pp_last = &pid->u.p_pes->sl.p_data;
- }
- block_ChainLastAppend( &pid->u.p_pes->sl.pp_last, p_block );
- p_block = NULL;
- if( header.b_au_end )
- {
- p_block = block_ChainGather( pid->u.p_pes->sl.p_data );
- pid->u.p_pes->sl.p_data = NULL;
- pid->u.p_pes->sl.pp_last = &pid->u.p_pes->sl.p_data;
- }
- }
+ p_block = SLProcessPacketized( pid->u.p_pes, p_es, p_block );
}
else
/* Some codecs might need xform or AU splitting */
diff --git a/modules/demux/mpeg/ts_sl.c b/modules/demux/mpeg/ts_sl.c
index aa57fe13ad..60308a8be8 100644
--- a/modules/demux/mpeg/ts_sl.c
+++ b/modules/demux/mpeg/ts_sl.c
@@ -205,3 +205,40 @@ void SLPackets_Section_Handler( demux_t *p_demux,
}
}
+block_t * SLProcessPacketized( ts_pes_t *p_pes, ts_pes_es_t *p_es, block_t *p_block )
+{
+ ts_pmt_t *p_pmt = p_es->p_program;
+ const es_mpeg4_descriptor_t *p_desc = GetMPEG4DescByEsId( p_pmt, p_es->i_sl_es_id );
+ if(!p_desc)
+ {
+ block_Release( p_block );
+ p_block = NULL;
+ }
+ else
+ {
+ sl_header_data header = DecodeSLHeader( p_block->i_buffer, p_block->p_buffer,
+ &p_desc->sl_descr );
+ p_block->i_buffer -= header.i_size;
+ p_block->p_buffer += header.i_size;
+ p_block->i_dts = header.i_dts ? header.i_dts : p_block->i_dts;
+ p_block->i_pts = header.i_pts ? header.i_pts : p_block->i_pts;
+
+ /* Assemble access units */
+ if( header.b_au_start && p_pes->sl.p_data )
+ {
+ block_ChainRelease( p_pes->sl.p_data );
+ p_pes->sl.p_data = NULL;
+ p_pes->sl.pp_last = &p_pes->sl.p_data;
+ }
+ block_ChainLastAppend( &p_pes->sl.pp_last, p_block );
+ p_block = NULL;
+ if( header.b_au_end )
+ {
+ p_block = block_ChainGather( p_pes->sl.p_data );
+ p_pes->sl.p_data = NULL;
+ p_pes->sl.pp_last = &p_pes->sl.p_data;
+ }
+ }
+
+ return p_block;
+}
diff --git a/modules/demux/mpeg/ts_sl.h b/modules/demux/mpeg/ts_sl.h
index 9e2c2fcbc6..009f118710 100644
--- a/modules/demux/mpeg/ts_sl.h
+++ b/modules/demux/mpeg/ts_sl.h
@@ -29,4 +29,7 @@ void SLPackets_Section_Handler( demux_t *p_demux,
void * );
bool SetupISO14496LogicalStream( demux_t *, const decoder_config_descriptor_t *,
es_format_t * );
+
+block_t * SLProcessPacketized( ts_pes_t *p_pes, ts_pes_es_t *p_es, block_t *p_block );
+
#endif
More information about the vlc-commits
mailing list