mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
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>
This commit is contained in:
commit
074bae745d
@ -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);
|
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
|
* Allocate extradata with additional FF_INPUT_BUFFER_PADDING_SIZE at end
|
||||||
|
@ -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_PREVIEW 0x0004
|
||||||
#define MOV_TKHD_FLAG_IN_POSTER 0x0008
|
#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);
|
int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom);
|
||||||
enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
|
enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
|
||||||
|
|
||||||
|
@ -2387,8 +2387,10 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
|
|
||||||
// done for ai5q, ai52, ai55, ai1q, ai12 and ai15.
|
// done for ai5q, ai52, ai55, ai1q, ai12 and ai15.
|
||||||
if (!st->codec->extradata_size && st->codec->codec_id == AV_CODEC_ID_H264 &&
|
if (!st->codec->extradata_size && st->codec->codec_id == AV_CODEC_ID_H264 &&
|
||||||
st->codec->codec_tag != MKTAG('a', 'v', 'c', '1')) {
|
TAG_IS_AVCI(st->codec->codec_tag)) {
|
||||||
ff_generate_avci_extradata(st);
|
ret = ff_generate_avci_extradata(st);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (st->codec->codec_id) {
|
switch (st->codec->codec_id) {
|
||||||
|
@ -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, ".");
|
||||||
}
|
}
|
||||||
av_log(mxf->fc, AV_LOG_VERBOSE, "\n");
|
av_log(mxf->fc, AV_LOG_VERBOSE, "\n");
|
||||||
|
|
||||||
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
|
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||||
source_track->intra_only = mxf_is_intra_only(descriptor);
|
source_track->intra_only = mxf_is_intra_only(descriptor);
|
||||||
container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, essence_container_ul);
|
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)) {
|
if (!ff_alloc_extradata(st->codec, descriptor->extradata_size)) {
|
||||||
memcpy(st->codec->extradata, descriptor->extradata, descriptor->extradata_size);
|
memcpy(st->codec->extradata, descriptor->extradata, descriptor->extradata_size);
|
||||||
}
|
}
|
||||||
} else if(st->codec->codec_id == AV_CODEC_ID_H264) {
|
} else if (st->codec->codec_id == AV_CODEC_ID_H264) {
|
||||||
ff_generate_avci_extradata(st);
|
ret = ff_generate_avci_extradata(st);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
if (st->codec->codec_type != AVMEDIA_TYPE_DATA && (*essence_container_ul)[15] > 0x01) {
|
if (st->codec->codec_type != AVMEDIA_TYPE_DATA && (*essence_container_ul)[15] > 0x01) {
|
||||||
/* TODO: decode timestamps */
|
/* TODO: decode timestamps */
|
||||||
|
@ -4171,7 +4171,7 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st,
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_generate_avci_extradata(AVStream *st)
|
int ff_generate_avci_extradata(AVStream *st)
|
||||||
{
|
{
|
||||||
static const uint8_t avci100_1080p_extradata[] = {
|
static const uint8_t avci100_1080p_extradata[] = {
|
||||||
// SPS
|
// SPS
|
||||||
@ -4238,8 +4238,10 @@ void ff_generate_avci_extradata(AVStream *st)
|
|||||||
0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
|
0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
|
||||||
0x11
|
0x11
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t *data = NULL;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
const uint8_t *data = 0;
|
|
||||||
if (st->codec->width == 1920) {
|
if (st->codec->width == 1920) {
|
||||||
if (st->codec->field_order == AV_FIELD_PROGRESSIVE) {
|
if (st->codec->field_order == AV_FIELD_PROGRESSIVE) {
|
||||||
data = avci100_1080p_extradata;
|
data = avci100_1080p_extradata;
|
||||||
@ -4255,10 +4257,14 @@ void ff_generate_avci_extradata(AVStream *st)
|
|||||||
data = avci100_720p_extradata;
|
data = avci100_720p_extradata;
|
||||||
size = sizeof(avci100_720p_extradata);
|
size = sizeof(avci100_720p_extradata);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!size)
|
if (!size)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
av_freep(&st->codec->extradata);
|
av_freep(&st->codec->extradata);
|
||||||
if (ff_alloc_extradata(st->codec, size))
|
if (ff_alloc_extradata(st->codec, size))
|
||||||
return;
|
return AVERROR(ENOMEM);
|
||||||
memcpy(st->codec->extradata, data, size);
|
memcpy(st->codec->extradata, data, size);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user