From d8c6d82d54200230a80e362843ff73dfc63a28c1 Mon Sep 17 00:00:00 2001 From: Kieran Kunhya Date: Tue, 28 Feb 2012 22:48:05 +0000 Subject: [PATCH] Correct further issues with random_access_indicator flag --- libmpegts.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libmpegts.c b/libmpegts.c index 2d13f48..f69e477 100644 --- a/libmpegts.c +++ b/libmpegts.c @@ -238,7 +238,6 @@ static int write_adaptation_field( ts_writer_t *w, bs_t *s, ts_int_program_t *pr int start = bs_pos( s ); uint8_t temp[512], temp2[256]; bs_t q, r; - int64_t pcr = get_pcr( w, 7 ); /* 7 bytes until end of PCR field */ private_data_flag = write_dvb_au = random_access = priority = 0; @@ -246,11 +245,17 @@ static int write_adaptation_field( ts_writer_t *w, bs_t *s, ts_int_program_t *pr { ts_int_stream_t *stream = pes->stream; random_access = pes->random_access; + if( IS_VIDEO( stream ) ) + { + if( !write_pcr ) + random_access = 0; + + if( stream->dvb_au ) + private_data_flag = write_dvb_au = 1; + } + priority = pes->priority; pes->random_access = 0; /* don't write this flag again */ - - if( stream->dvb_au && ( stream->stream_format == LIBMPEGTS_VIDEO_MPEG2 || stream->stream_format == LIBMPEGTS_VIDEO_AVC ) ) - private_data_flag = write_dvb_au = 1; } /* initialise temporary bitstream */ @@ -258,6 +263,7 @@ static int write_adaptation_field( ts_writer_t *w, bs_t *s, ts_int_program_t *pr if( flags ) { + int64_t pcr = get_pcr( w, 7 ); /* 7 bytes until end of PCR field */ bs_write1( &q, discontinuity ); // discontinuity_indicator bs_write1( &q, random_access ); // random_access_indicator bs_write1( &q, priority ); // elementary_stream_priority_indicator