[FFmpeg-soc] [FFmpeg-devel] [Patch]GSoC 2008 qualification task TS Muxer

Baptiste Coudurier baptiste.coudurier at smartjog.com
Fri Mar 28 13:05:33 CET 2008


Hi,

On Thu, Mar 27, 2008 at 10:52:09PM +0800, zhentan feng wrote:
> Index: mpegenc.c
> ===================================================================
> --- mpegenc.c	(revision 2048)
> +++ mpegenc.c	(working copy)
> @@ -266,11 +266,13 @@
>  static int mpeg_mux_init(AVFormatContext *ctx)
>  {
>      MpegMuxContext *s = ctx->priv_data;
> -    int bitrate, i, mpa_id, mpv_id, mps_id, ac3_id, dts_id, lpcm_id, j;
> +    int bitrate, i;
>      AVStream *st;
>      PESStream *stream;
>      int audio_bitrate;
>      int video_bitrate;
> +    int *ps_audio_bound = &(s->audio_bound);
> +    int *ps_video_bound = &(s->video_bound);
>
> [...]
>
> +    if(ff_pes_muxer_init(ctx,ps_audio_bound,ps_video_bound) != 0)
>

Code seems to only count audio and video streams, I don't think
ff_pes_muxer_init needs to be extented, only count them in
mpeg_mux_init (a small for loop should do the trick).

>
> [...]
>
>  /**
> + * Caculate the PES header to flush
> + * @param[in] ps_flag    the sign for PS, '1' is PS, '0' is TS
> + * @param[in] is_mpeg2 the pointer point to PS struct
> + * @param[in] is_dvd   the pointer point to PS struct
>
> [...]
>
> + */
> +void ff_pes_cal_header(int ps_flag,int *is_mpeg2,int *is_dvd,int id,PESStream *stream,
> +          int *packet_size,int *header_len,int64_t *pts,int64_t *dts,
> +          int *payload_size,int *startcode,int *stuffing_size,
> +          int *trailer_size,int *pad_packet_bytes);
> +
> +/**
>

I think some flags should be used for different variants:

#define FMT_MPEG2 0x01
#define FMT_VCD   0x02 | FMT_MPEG2
#define FMT_SVCD  0x04 | FMT_MPEG2
#define FMT_DVD   0x08 | FMT_MPEG2
#define FMT_TS    0x10 | FMT_MPEG2

then add a "format" field in PESStream.

You will be able to check with (s->format & FMT_MPEG2).

Beware of mpeg1system muxer though.

It should be simpler and cleaner, and will avoid passing 3 args.

This needs a separate patch.

[...]

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



More information about the FFmpeg-soc mailing list