diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-14 20:56:44 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-14 21:04:44 +0100 |
commit | 074bae745d9d99d94ef99f870d0a6bb50d1e7a0b (patch) | |
tree | e340d9c145fd783a87b7574ebd6211c13a832d19 /libavformat | |
parent | 0f969c00c6a32ea66da00e3b3f70fc62933968d1 (diff) | |
parent | ecf442a58b09bdb1dc1d2c3904b82ac5f79b2878 (diff) | |
download | ffmpeg-074bae745d9d99d94ef99f870d0a6bb50d1e7a0b.tar.gz |
Merge commit 'ecf442a58b09bdb1dc1d2c3904b82ac5f79b2878'
* commit 'ecf442a58b09bdb1dc1d2c3904b82ac5f79b2878':
lavf: improve support for AVC-Intra files.
Conflicts:
libavformat/internal.h
libavformat/isom.c
libavformat/mxfdec.c
libavformat/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/internal.h | 5 | ||||
-rw-r--r-- | libavformat/isom.h | 16 | ||||
-rw-r--r-- | libavformat/mov.c | 6 | ||||
-rw-r--r-- | libavformat/mxfdec.c | 7 | ||||
-rw-r--r-- | libavformat/utils.c | 14 |
5 files changed, 38 insertions, 10 deletions
diff --git a/libavformat/internal.h b/libavformat/internal.h index 36ee4c0be9..8e53cc54a1 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -357,9 +357,10 @@ enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags); AVRational ff_choose_timebase(AVFormatContext *s, AVStream *st, int min_precission); /** - * Generate standard extradata for AVC-Intra based on width/height and field order. + * Generate standard extradata for AVC-Intra based on width/height and field + * order. */ -void ff_generate_avci_extradata(AVStream *st); +int ff_generate_avci_extradata(AVStream *st); /** * Allocate extradata with additional FF_INPUT_BUFFER_PADDING_SIZE at end diff --git a/libavformat/isom.h b/libavformat/isom.h index 828e5005ad..2834b11b3e 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -207,6 +207,22 @@ void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id); #define MOV_TKHD_FLAG_IN_PREVIEW 0x0004 #define MOV_TKHD_FLAG_IN_POSTER 0x0008 +#define TAG_IS_AVCI(tag) \ + ((tag) == MKTAG('a', 'i', '5', 'p') || \ + (tag) == MKTAG('a', 'i', '5', 'q') || \ + (tag) == MKTAG('a', 'i', '5', '2') || \ + (tag) == MKTAG('a', 'i', '5', '3') || \ + (tag) == MKTAG('a', 'i', '5', '5') || \ + (tag) == MKTAG('a', 'i', '5', '6') || \ + (tag) == MKTAG('a', 'i', '1', 'p') || \ + (tag) == MKTAG('a', 'i', '1', 'q') || \ + (tag) == MKTAG('a', 'i', '1', '2') || \ + (tag) == MKTAG('a', 'i', '1', '3') || \ + (tag) == MKTAG('a', 'i', '1', '5') || \ + (tag) == MKTAG('a', 'i', '1', '6') || \ + (tag) == MKTAG('A', 'V', 'i', 'n')) + + int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom); enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags); diff --git a/libavformat/mov.c b/libavformat/mov.c index bcdda68bc8..3da31ac629 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2387,8 +2387,10 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) // done for ai5q, ai52, ai55, ai1q, ai12 and ai15. if (!st->codec->extradata_size && st->codec->codec_id == AV_CODEC_ID_H264 && - st->codec->codec_tag != MKTAG('a', 'v', 'c', '1')) { - ff_generate_avci_extradata(st); + TAG_IS_AVCI(st->codec->codec_tag)) { + ret = ff_generate_avci_extradata(st); + if (ret < 0) + return ret; } switch (st->codec->codec_id) { diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 3ecde3dfa8..1787abce12 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1516,6 +1516,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) av_log(mxf->fc, AV_LOG_VERBOSE, "."); } av_log(mxf->fc, AV_LOG_VERBOSE, "\n"); + if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { source_track->intra_only = mxf_is_intra_only(descriptor); container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, essence_container_ul); @@ -1605,8 +1606,10 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) if (!ff_alloc_extradata(st->codec, descriptor->extradata_size)) { memcpy(st->codec->extradata, descriptor->extradata, descriptor->extradata_size); } - } else if(st->codec->codec_id == AV_CODEC_ID_H264) { - ff_generate_avci_extradata(st); + } else if (st->codec->codec_id == AV_CODEC_ID_H264) { + ret = ff_generate_avci_extradata(st); + if (ret < 0) + return ret; } if (st->codec->codec_type != AVMEDIA_TYPE_DATA && (*essence_container_ul)[15] > 0x01) { /* TODO: decode timestamps */ diff --git a/libavformat/utils.c b/libavformat/utils.c index f02312f372..4b5c014b9f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4171,7 +4171,7 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, return AVERROR(EINVAL); } -void ff_generate_avci_extradata(AVStream *st) +int ff_generate_avci_extradata(AVStream *st) { static const uint8_t avci100_1080p_extradata[] = { // SPS @@ -4238,8 +4238,10 @@ void ff_generate_avci_extradata(AVStream *st) 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12, 0x11 }; + + const uint8_t *data = NULL; int size = 0; - const uint8_t *data = 0; + if (st->codec->width == 1920) { if (st->codec->field_order == AV_FIELD_PROGRESSIVE) { data = avci100_1080p_extradata; @@ -4255,10 +4257,14 @@ void ff_generate_avci_extradata(AVStream *st) data = avci100_720p_extradata; size = sizeof(avci100_720p_extradata); } + if (!size) - return; + return 0; + av_freep(&st->codec->extradata); if (ff_alloc_extradata(st->codec, size)) - return; + return AVERROR(ENOMEM); memcpy(st->codec->extradata, data, size); + + return 0; } |