[vlc-commits] demux: ts: add stream_processor
Francois Cartegnie
git at videolan.org
Wed Jun 21 21:34:08 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 20 10:22:46 2017 +0200| [19345363c35ac5732a7bffabda26c5e4f0c05fcc] | committer: Francois Cartegnie
demux: ts: add stream_processor
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=19345363c35ac5732a7bffabda26c5e4f0c05fcc
---
modules/demux/mpeg/ts.c | 18 ++++++++++--------
modules/demux/mpeg/ts_streams.c | 4 ++++
modules/demux/mpeg/ts_streams.h | 26 ++++++++++++++++++++++++++
modules/demux/mpeg/ts_streams_private.h | 1 +
4 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 7ba4c02258..30a20c803d 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -1562,20 +1562,21 @@ static void ParsePESDataChain( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes )
p_block->i_pts += FROM_SCALE_NZ(p_pmt->pcr.i_pcroffset);
}
+ /*** From here, block can become a chain again though conversion below ***/
+
+ if( pid->u.p_stream->p_proc )
+ {
+ if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
+ ts_stream_processor_Reset( pid->u.p_stream->p_proc );
+ p_block = ts_stream_processor_Push( pid->u.p_stream->p_proc, i_stream_id, p_block );
+ }
/* METADATA in PES */
- if( pid->u.p_stream->i_stream_type == 0x15 && i_stream_id == 0xbd )
+ else if( pid->u.p_stream->i_stream_type == 0x15 && i_stream_id == 0xbd )
{
ProcessMetadata( p_demux->out, p_es->metadata.i_format, p_pmt->i_number,
p_block->p_buffer, p_block->i_buffer );
}
else
- /* SL in PES */
- if( pid->u.p_stream->i_stream_type == 0x12 &&
- ((i_stream_id & 0xFE) == 0xFA) /* 0xFA || 0xFB */ )
- {
- p_block = SLProcessPacketized( pid->u.p_stream, p_es, p_block );
- }
- else
/* Some codecs might need xform or AU splitting */
{
p_block = ConvertPESBlock( p_demux, p_es, i_pes_size, i_stream_id, p_block );
@@ -1820,6 +1821,7 @@ static void ReadyQueuesPostSeek( demux_t *p_demux )
}
ts_sections_processor_Reset( pid->u.p_stream->p_sections_proc );
+ ts_stream_processor_Reset( pid->u.p_stream->p_proc );
FlushESBuffer( pid->u.p_stream );
}
diff --git a/modules/demux/mpeg/ts_streams.c b/modules/demux/mpeg/ts_streams.c
index 30fe3153ed..d057d2842a 100644
--- a/modules/demux/mpeg/ts_streams.c
+++ b/modules/demux/mpeg/ts_streams.c
@@ -283,6 +283,7 @@ ts_stream_t *ts_stream_New( demux_t *p_demux, ts_pmt_t *p_program )
pes->b_broken_PUSI_conformance = false;
pes->b_always_receive = false;
pes->p_sections_proc = NULL;
+ pes->p_proc = NULL;
pes->prepcr.p_head = NULL;
pes->prepcr.pp_last = &pes->prepcr.p_head;
pes->sl.p_data = NULL;
@@ -301,6 +302,9 @@ void ts_stream_Del( demux_t *p_demux, ts_stream_t *pes )
if( pes->p_sections_proc )
ts_sections_processor_ChainDelete( pes->p_sections_proc );
+ if( pes->p_proc )
+ ts_stream_processor_Delete( pes->p_proc );
+
if( pes->prepcr.p_head )
block_ChainRelease( pes->prepcr.p_head );
diff --git a/modules/demux/mpeg/ts_streams.h b/modules/demux/mpeg/ts_streams.h
index 36e547ee1b..982c1a0576 100644
--- a/modules/demux/mpeg/ts_streams.h
+++ b/modules/demux/mpeg/ts_streams.h
@@ -26,6 +26,32 @@ typedef struct ts_stream_t ts_stream_t;
typedef struct ts_si_t ts_si_t;
typedef struct ts_psip_t ts_psip_t;
+typedef struct ts_stream_processor_t ts_stream_processor_t;
+struct ts_stream_processor_t
+{
+ void *priv;
+ void (*pf_delete)(ts_stream_processor_t *);
+ void (*pf_reset) (ts_stream_processor_t *);
+ block_t * (*pf_push) (ts_stream_processor_t *, uint8_t, block_t * );
+};
+
+static inline void ts_stream_processor_Delete( ts_stream_processor_t *sp )
+{
+ if( sp )
+ sp->pf_delete( sp );
+}
+
+static inline void ts_stream_processor_Reset( ts_stream_processor_t *sp )
+{
+ if( sp && sp->pf_reset )
+ sp->pf_reset( sp );
+}
+
+static inline block_t * ts_stream_processor_Push( ts_stream_processor_t *sp, uint8_t i_stream_id, block_t *b )
+{
+ return (sp) ? sp->pf_push( sp, i_stream_id, b ) : b;
+}
+
/* Structs */
ts_pat_t *ts_pat_New( demux_t * );
void ts_pat_Del( demux_t *, ts_pat_t * );
diff --git a/modules/demux/mpeg/ts_streams_private.h b/modules/demux/mpeg/ts_streams_private.h
index 2db0d94ba7..e9dac45672 100644
--- a/modules/demux/mpeg/ts_streams_private.h
+++ b/modules/demux/mpeg/ts_streams_private.h
@@ -123,6 +123,7 @@ struct ts_stream_t
bool b_always_receive;
bool b_broken_PUSI_conformance;
ts_sections_processor_t *p_sections_proc;
+ ts_stream_processor_t *p_proc;
struct
{
More information about the vlc-commits
mailing list