[FFmpeg-soc] [soc]: r261 - in dvbmuxer: pes.c pes.diff pes.h

Baptiste Coudurier baptiste.coudurier at smartjog.com
Sat Jun 23 15:39:39 CEST 2007


Hi

realsun wrote:
> Author: realsun
> Date: Sat Jun 23 12:10:23 2007
> New Revision: 261
> 
> Log:
> extract PES packetizer from mpeg PS muxer and this could be reused by TS muxer.
> 
> [...]
>
> +            } else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) {
> +                stream->id = lpcm_id++;
> +                for(j = 0; j < 4; j++) {
> +                    if (lpcm_freq_tab[j] == st->codec->sample_rate)
> +                        break;
> +                }
> +                if (j == 4)
> +                    return AVERROR(ENOMEM);
> +                if (st->codec->channels > 8)
> +                    return -1;
> +                stream->lpcm_header[0] = 0x0c;
> +                stream->lpcm_header[1] = (st->codec->channels - 1) | (j << 4);
> +                stream->lpcm_header[2] = 0x80;
> +                stream->lpcm_align = st->codec->channels * 2;

I don't think it is PES muxer job to format PES payload. PS/TS muxer
should feed PES muxer with formatted data.

Also I think startcode computation could be done by PS/TS muxer, and
given to the PES muxer. I feel that TS or PS could use pes startcodes
which are specific to themselves.

For example PCM_S16BE is used in DVD but not in TS, and TS might format
it differently.

> [...]
>
> +
> +    /* Both the MPEG-2 and the SVCD standards demand that the
> +       P-STD_buffer_size field be included in the first packet of
> +       every stream. (see SVCD standard p. 26 V.2.3.1 and V.2.3.2
> +       and MPEG-2 standard 2.7.7) */
> +    if (context->packet_number == 0)
> +        pes_flags |= 0x01;

That seems to be a requirement for Program Stream, but not TS (hence the
P-), overlying muxer might be specified during init.

> [...]
>
> +
> +    for (i=0;i<stuffing_size;i++)
> +        bytestream_put_byte(&q, 0xff);
> +
> +    if (startcode == PRIVATE_STREAM_1) {
> +        bytestream_put_byte(&q, id);
> +        if (id >= 0xa0) {
> +            /* LPCM (XXX: check nb_frames) */
> +            bytestream_put_byte(&q, 7);
> +            bytestream_put_be16(&q, 4); /* skip 3 header bytes */
> +            bytestream_put_byte(&q, stream->lpcm_header[0]);
> +            bytestream_put_byte(&q, stream->lpcm_header[1]);
> +            bytestream_put_byte(&q, stream->lpcm_header[2]);
> +        } else if (id >= 0x40) {
> +            /* AC3 */
> +            nb_frames= get_nb_frames(ctx, stream, data_size);
> +            bytestream_put_byte(&q, nb_frames);
> +            bytestream_put_be16(&q, trailer_size+1);
> +        }
> +    }

IMHO it is not PES muxer job to format payload.

> [...]
>
> ++OBJS-$(CONFIG_MPEG1SYSTEM_MUXER)         += mpegenc.o pes.o
> ++OBJS-$(CONFIG_MPEG1VCD_MUXER)            += mpegenc.o pes.o
> ++OBJS-$(CONFIG_MPEG2DVD_MUXER)            += mpegenc.o pes.o
> ++OBJS-$(CONFIG_MPEG2VOB_MUXER)            += mpegenc.o pes.o
> ++OBJS-$(CONFIG_MPEG2SVCD_MUXER)           += mpegenc.o pes.o

pesenc.c might be a more appropriate name.

[...]

-- 
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