at once. This requires the export of the PCR block_flag.
#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
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 )
{
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")"
}
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;
i_dropped_packets = 0;
}
-#if 0
+#if 1
i_sent = mdate();
if ( i_sent > i_date + 20000 )
{
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;
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++;
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 );
}
{
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 */