]> git.sesse.net Git - vlc/commitdiff
* modules/access_output/udp.c: When using --udp-group, do not send two PCRs
authorChristophe Massiot <massiot@videolan.org>
Fri, 7 Jan 2005 20:04:46 +0000 (20:04 +0000)
committerChristophe Massiot <massiot@videolan.org>
Fri, 7 Jan 2005 20:04:46 +0000 (20:04 +0000)
  at once. This requires the export of the PCR block_flag.

include/vlc_block.h
modules/access_output/udp.c
modules/mux/mpeg/ts.c

index 4f705c60f77e537b614e231e2be1ccd1d0b7259f..831f37269c23ee2aaa4095241c8a6f7c2bc633f2 100644 (file)
@@ -60,8 +60,14 @@ typedef struct block_sys_t block_sys_t;
 #define BLOCK_FLAG_HEADER        0x0020
 /** This is the last block of the frame */
 #define BLOCK_FLAG_END_OF_FRAME  0x0040
-/** No keyframes present */
+/** This is not a key frame for bitrate shaping */
 #define BLOCK_FLAG_NO_KEYFRAME   0x0080
+/** This is the last block of the GOP */
+#define BLOCK_FLAG_END_OF_GOP    0x0100
+/** This block contains a clock reference */
+#define BLOCK_FLAG_CLOCK         0x0200
+/** This block is scrambled */
+#define BLOCK_FLAG_SCRAMBLED     0x0400
 
 #define BLOCK_FLAG_PRIVATE_MASK  0xffff0000
 #define BLOCK_FLAG_PRIVATE_SHIFT 16
index ca9ea83266e744857a48ba3a0589c8af4c0554a2..9c4d5270bdf6b2a1d0858c87ae4649ae81b64e76 100644 (file)
@@ -382,6 +382,8 @@ static int Write( sout_access_out_t *p_access, block_t *p_buffer )
             p_sys->p_buffer->i_buffer += i_write;
             p_buffer->p_buffer += i_write;
             p_buffer->i_buffer -= i_write;
+            if ( p_buffer->i_flags & BLOCK_FLAG_CLOCK )
+                p_sys->p_buffer->i_flags |= BLOCK_FLAG_CLOCK;
 
             if( p_sys->p_buffer->i_buffer == p_sys->i_mtu || i_packets > 1 )
             {
@@ -491,7 +493,7 @@ static void ThreadWrite( vlc_object_t *p_this )
                 i_dropped_packets++;
                 continue;
             }
-            else if( i_date - i_date_last < 0 )
+            else if( i_date - i_date_last < -15000 )
             {
                 if( !i_dropped_packets )
                     msg_Dbg( p_thread, "mmh, packets in the past ("I64Fd")"
@@ -519,7 +521,7 @@ static void ThreadWrite( vlc_object_t *p_this )
         }
 
         i_to_send--;
-        if ( !i_to_send )
+        if ( !i_to_send || (p_pk->i_flags & BLOCK_FLAG_CLOCK) )
         {
             mwait( i_date );
             i_to_send = p_thread->i_group;
@@ -532,7 +534,7 @@ static void ThreadWrite( vlc_object_t *p_this )
             i_dropped_packets = 0;
         }
 
-#if 0
+#if 1
         i_sent = mdate();
         if ( i_sent > i_date + 20000 )
         {
index f27ddadd777982243c6aedd185d865394ad783e2..320c9a4285e095a02f1199f7097d18abb1474da8 100644 (file)
@@ -176,8 +176,6 @@ static const char *ppsz_sout_options[] = {
     NULL
 };
 
-#define SOUT_BUFFER_FLAGS_PRIVATE_PCR  ( 1 << BLOCK_FLAG_PRIVATE_SHIFT )
-#define SOUT_BUFFER_FLAGS_PRIVATE_CSA  ( 2 << BLOCK_FLAG_PRIVATE_SHIFT )
 typedef struct
 {
     int     i_depth;
@@ -1258,7 +1256,7 @@ static int Mux( sout_mux_t *p_mux )
             if( p_sys->csa != NULL &&
                  (p_input->p_fmt->i_cat != AUDIO_ES || p_sys->b_crypt_audio) )
             {
-                p_ts->i_flags |= SOUT_BUFFER_FLAGS_PRIVATE_CSA;
+                p_ts->i_flags |= BLOCK_FLAG_SCRAMBLED;
             }
             i_packet_pos++;
 
@@ -1376,12 +1374,12 @@ static void TSDate( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts,
         p_ts->i_dts    = i_new_dts;
         p_ts->i_length = i_pcr_length / i_packet_count;
 
-        if( p_ts->i_flags & SOUT_BUFFER_FLAGS_PRIVATE_PCR )
+        if( p_ts->i_flags & BLOCK_FLAG_CLOCK )
         {
             /* msg_Dbg( p_mux, "pcr=%lld ms", p_ts->i_dts / 1000 ); */
             TSSetPCR( p_ts, p_ts->i_dts - p_sys->i_dts_delay );
         }
-        if( p_ts->i_flags & SOUT_BUFFER_FLAGS_PRIVATE_CSA )
+        if( p_ts->i_flags & BLOCK_FLAG_SCRAMBLED )
         {
             csa_Encrypt( p_sys->csa, p_ts->p_buffer, 0 );
         }
@@ -1437,7 +1435,7 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
         {
             int     i_stuffing = i_payload_max - i_payload;
 
-            p_ts->i_flags |= SOUT_BUFFER_FLAGS_PRIVATE_PCR;
+            p_ts->i_flags |= BLOCK_FLAG_CLOCK;
 
             p_ts->p_buffer[4] = 7 + i_stuffing;
             p_ts->p_buffer[5] = 0x10;   /* flags */