[FFmpeg-soc] [soc]: r553 - in dvbmuxer/muxer_dev: Makefile dvbmuxer.diff mpeg_pes.h mpeg_pes_enc.c mpegtsenc.c

Baptiste Coudurier baptiste.coudurier at smartjog.com
Mon Jul 30 17:01:11 CEST 2007


Hi Xiaohui,

realsun wrote:
> Author: realsun
> Date: Mon Jul 30 14:50:30 2007
> New Revision: 553
> 
> Log:
> modified pcr calculation.
> generated ts stream still could not played well under vlc.
> 
> Modified:
>    dvbmuxer/muxer_dev/Makefile
>    dvbmuxer/muxer_dev/dvbmuxer.diff
>    dvbmuxer/muxer_dev/mpeg_pes.h
>    dvbmuxer/muxer_dev/mpeg_pes_enc.c
>    dvbmuxer/muxer_dev/mpegtsenc.c
> 
> Modified: dvbmuxer/muxer_dev/Makefile
> ==============================================================================
> --- dvbmuxer/muxer_dev/Makefile	(original)
> +++ dvbmuxer/muxer_dev/Makefile	Mon Jul 30 14:50:30 2007
> @@ -6,7 +6,7 @@ include ../config.mak
>  
> [...]
>

I think you need to run svn update.

> 
> Modified: dvbmuxer/muxer_dev/dvbmuxer.diff
> ==============================================================================
> --- dvbmuxer/muxer_dev/dvbmuxer.diff	(original)
> +++ dvbmuxer/muxer_dev/dvbmuxer.diff	Mon Jul 30 14:50:30 2007

Is the diff still useful ? If not you can remove it from svn, reviewing
diff of diffs is pretty difficult.

> [...]
>              if(stream->buffer_index < pkt_desc->size ||
>                 stream->predecode_packet == stream->premux_packet){
> -                av_log(ctx, AV_LOG_ERROR,
> +                   av_log(ctx, AV_LOG_ERROR,

Cosmetic, please take care, do several times svn diff before commit.

> [...]
> 
> Modified: dvbmuxer/muxer_dev/mpegtsenc.c
> ==============================================================================
> --- dvbmuxer/muxer_dev/mpegtsenc.c	(original)
> +++ dvbmuxer/muxer_dev/mpegtsenc.c	Mon Jul 30 14:50:30 2007
> @@ -62,8 +62,9 @@ static void mpegts_write_section(MpegTSS
>              b |= 0x40;
>          *q++ = b;
>          *q++ = s->pid;
> -        s->cc = (s->cc + 1) & 0xf;
> +        s->cc = (s->cc) & 0xf;
>          *q++ = 0x10 | s->cc;
> +        s->cc++;

What was the problem with previous code ?

> [...]
> -        int codec_rate;
>          st = s->streams[i];
>          ts_st = (MpegTSWriteStream*) st->priv_data;
> -
> -        if(st->codec->rc_max_rate || ts_st->id==VIDEO_ID)
> -            codec_rate= st->codec->rc_max_rate;
> -        else
> -            codec_rate= st->codec->bit_rate;
> -        bitrate += codec_rate;
> +        bitrate += st->codec->bit_rate;

Why aren't you using rc_max_rate ?

>      }
>  
> -    if(s->mux_rate){
> -        ts->mux_rate= (s->mux_rate + (8 * 50) - 1) / (8 * 50);
> -    } else {
> -        bitrate += bitrate*5/100;
> -        bitrate = bitrate * 25 / (8 *  DEFAULT_PES_PAYLOAD_SIZE) +  /* PES header size */
> -                   bitrate * 4 / (8 * TS_PACKET_SIZE) +             /* TS  header size */
> -                   500 * 12 +                                       /* SDT size */
> -                   100 * 16;                                        /* PAT size */
> -        ts->mux_rate = (bitrate + (8 * 50) - 1) / (8 * 50);
> -    }
> -    ts->last_pcr = 0;
> +    //bitrate += bitrate*5/100;
> +    bitrate += bitrate * 25 / (8 *  DEFAULT_PES_PAYLOAD_SIZE) +  /* PES header size */
> +               bitrate * 4 / (8 * TS_PACKET_SIZE) +             /* TS  header size */
> +               500 * 12 +                                       /* SDT size */
> +               100 * 16;                                        /* PAT size */
> +    ts->mux_rate = bitrate;
> +    ts->last_pcr = 10000;  /* add a preload value */

You are ignoring user supplied mux_rate here.

>      service->pcr_packet_freq = (ts->mux_rate * PCR_RETRANS_TIME) /
>          (TS_PACKET_SIZE * 8 * 1000);
> @@ -536,23 +527,23 @@ static void mpegts_write_pes(AVFormatCon
>      int val, is_start, len, header_len, write_pcr;
>      int afc_len, stuffing_len;
>      int64_t pcr = -1; /* avoid warning */

Here pcr is int64.

> [...]
>              }
>          }
> -

Cosmetic

> [...]
>  
> -    if (pad_packet_bytes > 0)
> -        put_padding_packet(ctx,&ctx->pb, pad_packet_bytes);
> +    //if (pad_packet_bytes > 0)
> +     //   put_padding_packet(ctx,&ctx->pb, pad_packet_bytes);

I expect padding to work in final revision.

>      for(i=0;i<zero_trail_bytes;i++)
>          put_byte(&ctx->pb, 0x00);
> @@ -744,10 +736,10 @@ static int output_packet(AVFormatContext
>      int es_size, trailer_size;
>      int result;
>      int best_i= -1;
> -    int64_t pcr= s->last_pcr;
> +    int pcr = s->last_pcr;

Here pcr is int ?

> [...]

Please do incremental commits with explicit log messages, so we can keep
track of your work and understand the reasons.

[...]

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312



More information about the FFmpeg-soc mailing list