[FFmpeg-soc] [soc]: r2827 - mxf/mxfenc.c

Baptiste Coudurier baptiste.coudurier at smartjog.com
Mon Jul 21 20:39:18 CEST 2008


Hi,

spyfeng wrote:
> Author: spyfeng
> Date: Sun Jul 20 06:59:53 2008
> New Revision: 2827
> 
> Log:
> caculate the number of essence container type when writing header partition,
> and store the values in MXFContext.
> so we can use the values freely when writing preface set and footer partition.
> 
> [...]
>
> +static void mxf_set_essence_number(AVFormatContext *s)
> +{
> +    MXFContext *mxf = s->priv_data;
> +    AVStream *st;
> +    int i, video_type = 0, audio_type = 0;
> +
> +    for (i = 0; i < s->nb_streams; i++) {
> +        st = s->streams[i];
> +        if (!video_type && st->codec->codec_type == CODEC_TYPE_VIDEO) {
> +            mxf->video_container_ul = mxf_get_essence_container_ul(mxf_picture_essence_container_uls, st->codec->codec_id);
> +            video_type++;
> +        }
> +        if (!audio_type && st->codec->codec_type == CODEC_TYPE_AUDIO) {
> +            mxf->audio_container_ul = mxf_get_essence_container_ul(mxf_sound_essence_container_uls, st->codec->codec_id);
> +            audio_type++;
> +        }
> +        if (video_type && audio_type)
> +            break;
> +    }
> +    mxf->type_num = video_type + audio_type;

If we have more than one audio track and more than one video track, it
is possible for each track to have different essence containers, and it
is not specific to codec type I think.

So you must store them in a list, and check against codec_id only if
possible.

> +
>  static int mxf_write_header_partition(AVFormatContext *s)
>  {
>      MXFContext *mxf = s->priv_data;
>      ByteIOContext *pb = s->pb;
>      int64_t header_metadata_start;
> -    // for op1a, only 1 essence container
> -    uint64_t partitionLen = 88 + 16;
> +
> +    // calculate the numner of essence container type
> +    mxf_set_essence_number(s);

I think the name is not right. I think mxf_get_essence_containers is a
better name.

[...]

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc.                                http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA



More information about the FFmpeg-soc mailing list