On 12/13/2011 12:50 PM, Alex Converse wrote: > On Tue, Dec 13, 2011 at 3:12 AM, Luca Barbato <[email protected]> wrote: >> On 13/12/11 08:11, Alex Converse wrote: >>> >>> The 'fiel' atoms can be found in H.264 tracks clobbering the extradata. >>> MJPEG supports non field based extradata, and this data should be >>> preserved when copying. >>> --- >>> avconv.c | 1 + >>> libavcodec/avcodec.h | 10 ++++++++++ >>> libavcodec/mjpegdec.c | 10 ++++++---- >>> libavformat/mov.c | 24 +++++++++++++++++++++++- >>> libavformat/movenc.c | 12 +++++++++++- >>> 5 files changed, 51 insertions(+), 6 deletions(-) >>> >>> diff --git a/avconv.c b/avconv.c >>> index 90ed00d..3870451 100644 >>> --- a/avconv.c >>> +++ b/avconv.c >>> @@ -2068,6 +2068,7 @@ static int transcode_init(OutputFile *output_files, >>> codec->bit_rate = icodec->bit_rate; >>> codec->rc_max_rate = icodec->rc_max_rate; >>> codec->rc_buffer_size = icodec->rc_buffer_size; >>> + codec->field_order = icodec->field_order; >>> codec->extradata = av_mallocz(extra_size); >>> if (!codec->extradata) { >>> return AVERROR(ENOMEM); >>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h >>> index fe65a6e..23531e1 100644 >>> --- a/libavcodec/avcodec.h >>> +++ b/libavcodec/avcodec.h >>> @@ -3081,6 +3081,16 @@ typedef struct AVCodecContext { >>> * libavcodec functions. >>> */ >>> struct AVCodecInternal *internal; >>> + >>> + /** Field order >>> + * 0x0000 - unset >>> + * 0x0100 - progressive scan >>> + * 0x0201 - top displayed first, top coded first >>> + * 0x0206 - bottom displayed first, bottom coded first >>> + * 0x0209 - top coded first, bottom displayed first >>> + * 0x020E - bottom coded first, top displayed first >>> + */ >>> + unsigned field_order; >> >> >> Could be made an enum? >> > > It could but that would mean behavioral changes in the MJPEG decoder > who only looks at the second byte. Flags are possible but then we lose > unknown values.
It might be useful for future reference to include that this field is derived from the 'fiel' atom as documented in the QuickTime File Format Specification. Needs some usage information, like: decoding: set by user encoding: set by libavcodec? unused? Also, I would slightly prefer using "unsigned int" over "unsigned" but I won't object either way. -Justin _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
