Commit 59922548 authored by Jean-Paul Saman's avatar Jean-Paul Saman

debian: splice point generation

Add patch for splice point generation in muxing TS streams.
parent 62594344
...@@ -3,6 +3,8 @@ vlc (1.2.0-1ubuntu1) lucid-proposed; urgency=low ...@@ -3,6 +3,8 @@ vlc (1.2.0-1ubuntu1) lucid-proposed; urgency=low
* Current master git for threaded decoding with ffmpeg * Current master git for threaded decoding with ffmpeg
- depends on ffmpeg being built with threaded decoding enabled - depends on ffmpeg being built with threaded decoding enabled
(also known as ffmpeg-mt). (also known as ffmpeg-mt).
* Splice point generation
- simplistic method for splice point generation
vlc (1.0.6-1ubuntu1.2) lucid-security; urgency=low vlc (1.0.6-1ubuntu1.2) lucid-security; urgency=low
......
From 8613243ee5271d502bc97605c353dfdb4ccdd6f4 Mon Sep 17 00:00:00 2001
From: Jean-Paul Saman <jean-paul.saman@m2x.nl>
Date: Thu, 9 Sep 2010 13:04:51 +0200
Subject: [PATCH] mux/mpeg/ts.c: Generate splice points
ISO/IEC 13818-1:2007 page 25
Generate splicing_point_flag and splice_countdown for every AUDIO and VIDEO pid
in the stream at the beginning of the file. Since it is easier to generate a
negative countdown from 0 to -127, then to forcast when to start counting down.
When -127 is reached the splicing_point_flag is no longer set.
The simplistic method is good enough for now.
---
mux_ts_splice_points.patch | 114 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 114 insertions(+), 0 deletions(-)
create mode 100644 mux_ts_splice_points.patch
diff --git a/mux_ts_splice_points.patch b/mux_ts_splice_points.patch
new file mode 100644
index 0000000..6eb1747
--- /dev/null
+++ b/mux_ts_splice_points.patch
@@ -0,0 +1,114 @@
+diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
+index eb0ce12..7e349e1 100644
+--- a/modules/mux/mpeg/ts.c
++++ b/modules/mux/mpeg/ts.c
+@@ -346,6 +346,10 @@ typedef struct ts_stream_t
+ int i_continuity_counter;
+ bool b_discontinuity;
+
++ /* splice points */
++ bool b_splicing_point;
++ int8_t i_splice_countdown;
++
+ /* to be used for carriege of DIV3 */
+ vlc_fourcc_t i_bih_codec;
+ int i_bih_width, i_bih_height;
+@@ -975,6 +979,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
+ p_stream->i_codec = p_input->p_fmt->i_codec;
+ p_stream->i_continuity_counter = 0;
+ p_stream->b_discontinuity = false;
++ p_stream->b_splicing_point = true;
++ p_stream->i_splice_countdown = 0;
+ p_stream->i_decoder_specific_info = 0;
+ p_stream->p_decoder_specific_info = NULL;
+
+@@ -1621,7 +1627,7 @@ static int Mux( sout_mux_t *p_mux )
+ i_max_pes_size = INT_MAX;
+ }
+
+- EStoPES ( p_mux->p_sout, &p_data, p_data,
++ EStoPES ( p_mux->p_sout, &p_data, p_data,
+ p_input->p_fmt, p_stream->i_stream_id,
+ 1, b_data_alignment, i_header_size,
+ i_max_pes_size );
+@@ -2002,8 +2008,11 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
+
+ bool b_new_pes = false;
+ bool b_adaptation_field = false;
++ bool b_splicing_point = p_stream->b_splicing_point;
+
+- int i_payload_max = 184 - ( b_pcr ? 8 : 0 );
++ int i_payload_max = 184 - ( b_pcr ?
++ ( b_splicing_point ? 9 : 8 ) :
++ ( b_splicing_point ? 3 : 0 ) );
+ int i_payload;
+
+ if( p_stream->i_pes_used <= 0 )
+@@ -2013,7 +2022,7 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
+ i_payload = __MIN( (int)p_pes->i_buffer - p_stream->i_pes_used,
+ i_payload_max );
+
+- if( b_pcr || i_payload < i_payload_max )
++ if( b_pcr || b_splicing_point || i_payload < i_payload_max )
+ {
+ b_adaptation_field = true;
+ }
+@@ -2044,10 +2053,11 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
+ if( b_pcr )
+ {
+ int i_stuffing = i_payload_max - i_payload;
++ int i_stuffing_start = b_splicing_point ? 13 : 12;
+
+ p_ts->i_flags |= BLOCK_FLAG_CLOCK;
+
+- p_ts->p_buffer[4] = 7 + i_stuffing;
++ p_ts->p_buffer[4] = (b_splicing_point ? 8 : 7) + i_stuffing;
+ p_ts->p_buffer[5] = 0x10; /* flags */
+ if( p_stream->b_discontinuity )
+ {
+@@ -2061,20 +2071,41 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
+ p_ts->p_buffer[10]= ( ( 0 )&0x80 ) | 0x7e;
+ p_ts->p_buffer[11]= 0;
+
+- for( i = 12; i < 12 + i_stuffing; i++ )
++ if( b_splicing_point )
+ {
+- p_ts->p_buffer[i] = 0xff;
++ p_ts->p_buffer[5] |= 0x04; /* flag splicing point */
++ /* in (+) or out (-) point */
++ p_ts->p_buffer[12] = p_stream->i_splice_countdown > 0 ?
++ (0x80 | (p_stream->i_splice_countdown & 0x7f)) : 0;
++ p_stream->b_splicing_point = !(p_stream->i_splice_countdown == 127);
++ p_stream->i_splice_countdown++;
++ }
++
++ for( i = i_stuffing_start; i < i_stuffing_start + i_stuffing; i++ )
++ {
++ p_ts->p_buffer[i] = 0xff;
+ }
+ }
+ else
+ {
+ int i_stuffing = i_payload_max - i_payload;
++ int i_stuffing_start = b_splicing_point ? 7 : 6;
+
+- p_ts->p_buffer[4] = i_stuffing - 1;
++ p_ts->p_buffer[4] = i_stuffing + (b_splicing_point ? 2 : -1);
+ if( i_stuffing > 1 )
+ {
+ p_ts->p_buffer[5] = 0x00;
+- for( i = 6; i < 6 + i_stuffing - 2; i++ )
++ if( b_splicing_point )
++ {
++ p_ts->p_buffer[5] |= 0x04; /* flag splicing point */
++ /* in (+) or out (-) point */
++ p_ts->p_buffer[6] = p_stream->i_splice_countdown > 0 ?
++ (0x80 | (p_stream->i_splice_countdown & 0x7f)) : 0;
++ p_stream->b_splicing_point = !(p_stream->i_splice_countdown == 127);
++ p_stream->i_splice_countdown++;
++ }
++
++ for( i = i_stuffing_start; i < i_stuffing_start + i_stuffing; i++ )
+ {
+ p_ts->p_buffer[i] = 0xff;
+ }
--
1.7.2.2
...@@ -16,3 +16,4 @@ ...@@ -16,3 +16,4 @@
#525-Mozilla-more-fixes.patch #525-Mozilla-more-fixes.patch
#600-drop-OJI-xul-192.patch #600-drop-OJI-xul-192.patch
#CVE-2010-2937.patch #CVE-2010-2937.patch
0001-mux-mpeg-ts.c-Generate-splice-points.patch
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment