[FFmpeg-devel] [PATCH 7/10] GXF Encoder Fixes and HD support (patch broken up)

Baptiste Coudurier baptiste.coudurier
Fri Oct 15 04:02:24 CEST 2010


Hi,

On 10/13/2010 10:09 PM, Reuben Martin wrote:
> Yo, back on Thursday, October 07, 2010 Reuben Martin was all like:
>
 > [...]
>
> Here's the patch split out into two parts:
>
> 07.1 refactors the code that writes the aux info and adds the DVCAM tag if yuv420p format is used.
>
> 07.2 adds support for setting 16:9 aspect ratio flags.
>
>
> 07.1 is rather small and trivial, so I assume it won't be much trouble to apply. For that reason I made 07.2 to apply after applying 07.1. I can re-send 07.2 as an independant patch if that is a problem.
>
> Will change some stuff on the HD patch after these are applied.
>
> -Reuben
>
> 07.1-gxf__dvcam_aux.patch
>
>
> diff -U 3 -H -d -r -N -- ffmpeg-old/libavformat/gxfenc.c ffmpeg-dvcam/libavformat/gxfenc.c
> --- ffmpeg-old/libavformat/gxfenc.c	2010-10-07 17:28:19.000000000 -0500
> +++ ffmpeg-dvcam/libavformat/gxfenc.c	2010-10-13 23:41:52.077000076 -0500
> @@ -212,7 +212,7 @@
>   {
>       ByteIOContext *pb = s->pb;
>       int64_t pos;
> -    int mpeg = sc->track_type == 4 || sc->track_type == 9;
> +    int64_t track_aux_data = 0;
>
>       /* track description section */
>       put_byte(pb, sc->media_type + 0x80);
> @@ -228,24 +228,40 @@
>       put_be16(pb, sc->media_info);
>       put_byte(pb, 0);
>
> -    if (!mpeg) {
> -        /* auxiliary information */
> -        put_byte(pb, TRACK_AUX);
> -        put_byte(pb, 8);
> -        if (sc->track_type == 3)
> +    switch (sc->track_type) {
> +        case 3:     /* timecode */
> +            put_byte(pb, TRACK_AUX);
> +            put_byte(pb, 8);
>               gxf_write_timecode_auxiliary(pb, sc);
> -        else
> +            break;
> +        case 4:     /* MPEG2 */
> +        case 9:     /* MPEG1 */
> +            gxf_write_mpeg_auxiliary(pb, s->streams[index]);
> +            break;
> +        case 5:     /* DV25 */
> +            put_byte(pb, TRACK_AUX);
> +            put_byte(pb, 8);
> +            if (s->streams[index]->codec->pix_fmt == PIX_FMT_YUV420P)
> +                track_aux_data |= 0x01; /* DVCAM */
> +            put_le64(pb, track_aux_data);
> +            break;
> +        case 6:     /* DV50 */
> +            put_byte(pb, TRACK_AUX);
> +            put_byte(pb, 8);
> +            put_le64(pb, 0);        /* 4:3 */

You can merge both DV cases DV50 cannot be 420 anyway.

 > [...]
 >
>           case 5:     /* DV25 */
>               put_byte(pb, TRACK_AUX);
>               put_byte(pb, 8);
> +            if (sc->aspect_ratio)
> +                track_aux_data |= 0x10; /* 16:9 */
>               if (s->streams[index]->codec->pix_fmt == PIX_FMT_YUV420P)
>                   track_aux_data |= 0x01; /* DVCAM */
>               put_le64(pb, track_aux_data);

You must mark the flag that specify that aux contains valid information.

> [...]
>
> @@ -509,11 +521,17 @@
>
>   static int gxf_write_umf_media_dv(ByteIOContext *pb, GXFStreamContext *sc)
>   {
> -    int i;
> -
> -    for (i = 0; i<  8; i++) {
> -        put_be32(pb, 0);
> -    }
> +    if (sc->aspect_ratio)
> +        put_le32(pb, 0x0080); /* 16:9 */
> +    else
> +        put_le32(pb, 0x0040); /* 4:3 */
> +    put_le32(pb, 0);
> +    put_le32(pb, 0);
> +    put_le32(pb, 0);
> +    put_le32(pb, 0);
> +    put_le32(pb, 0);
> +    put_le32(pb, 0);
> +    put_le32(pb, 0);

Can you please add the 420 case in UMF as well ?

Thanks for the patches.

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list