mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
split mov_find_codec_tag in separate per format functions
Originally committed as revision 18362 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
f3370e14ea
commit
6b60028595
@ -580,10 +580,9 @@ static const AVCodecTag codec_ipod_tags[] = {
|
|||||||
{ CODEC_ID_NONE, 0 },
|
{ CODEC_ID_NONE, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
|
static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack *track)
|
||||||
{
|
{
|
||||||
int tag = track->enc->codec_tag;
|
int tag = track->enc->codec_tag;
|
||||||
if (track->mode == MODE_MP4 || track->mode == MODE_PSP) {
|
|
||||||
if (!codec_get_tag(ff_mp4_obj_type, track->enc->codec_id))
|
if (!codec_get_tag(ff_mp4_obj_type, track->enc->codec_id))
|
||||||
return 0;
|
return 0;
|
||||||
if (track->enc->codec_id == CODEC_ID_H264) tag = MKTAG('a','v','c','1');
|
if (track->enc->codec_id == CODEC_ID_H264) tag = MKTAG('a','v','c','1');
|
||||||
@ -592,7 +591,14 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
|
|||||||
else if (track->enc->codec_id == CODEC_ID_MOV_TEXT) tag = MKTAG('t','x','3','g');
|
else if (track->enc->codec_id == CODEC_ID_MOV_TEXT) tag = MKTAG('t','x','3','g');
|
||||||
else if (track->enc->codec_type == CODEC_TYPE_VIDEO) tag = MKTAG('m','p','4','v');
|
else if (track->enc->codec_type == CODEC_TYPE_VIDEO) tag = MKTAG('m','p','4','v');
|
||||||
else if (track->enc->codec_type == CODEC_TYPE_AUDIO) tag = MKTAG('m','p','4','a');
|
else if (track->enc->codec_type == CODEC_TYPE_AUDIO) tag = MKTAG('m','p','4','a');
|
||||||
} else if (track->mode == MODE_IPOD) {
|
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ipod_get_codec_tag(AVFormatContext *s, MOVTrack *track)
|
||||||
|
{
|
||||||
|
int tag = track->enc->codec_tag;
|
||||||
|
|
||||||
if (track->enc->codec_type == CODEC_TYPE_SUBTITLE &&
|
if (track->enc->codec_type == CODEC_TYPE_SUBTITLE &&
|
||||||
(tag == MKTAG('t','x','3','g') ||
|
(tag == MKTAG('t','x','3','g') ||
|
||||||
tag == MKTAG('t','e','x','t')))
|
tag == MKTAG('t','e','x','t')))
|
||||||
@ -602,20 +608,27 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
|
|||||||
if (!match_ext(s->filename, "m4a") && !match_ext(s->filename, "m4v"))
|
if (!match_ext(s->filename, "m4a") && !match_ext(s->filename, "m4v"))
|
||||||
av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v "
|
av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v "
|
||||||
"Quicktime/Ipod might not play the file\n");
|
"Quicktime/Ipod might not play the file\n");
|
||||||
} else if (track->mode & MODE_3GP) {
|
|
||||||
tag = codec_get_tag(codec_3gp_tags, track->enc->codec_id);
|
return tag;
|
||||||
} else if (!tag || (track->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL &&
|
}
|
||||||
(tag == MKTAG('d','v','c','p') ||
|
|
||||||
track->enc->codec_id == CODEC_ID_RAWVIDEO ||
|
static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track)
|
||||||
av_get_bits_per_sample(track->enc->codec_id)))) { // pcm audio
|
{
|
||||||
if (track->enc->codec_id == CODEC_ID_DVVIDEO) {
|
int tag;
|
||||||
|
|
||||||
if (track->enc->height == 480) /* NTSC */
|
if (track->enc->height == 480) /* NTSC */
|
||||||
if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n');
|
if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n');
|
||||||
else tag = MKTAG('d','v','c',' ');
|
else tag = MKTAG('d','v','c',' ');
|
||||||
else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p');
|
else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p');
|
||||||
else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p');
|
else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p');
|
||||||
else tag = MKTAG('d','v','p','p');
|
else tag = MKTAG('d','v','p','p');
|
||||||
} else if (track->enc->codec_id == CODEC_ID_RAWVIDEO) {
|
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
|
||||||
|
{
|
||||||
|
int tag = track->enc->codec_tag;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < FF_ARRAY_ELEMS(mov_pix_fmt_tags); i++) {
|
for (i = 0; i < FF_ARRAY_ELEMS(mov_pix_fmt_tags); i++) {
|
||||||
if (track->enc->pix_fmt == mov_pix_fmt_tags[i].pix_fmt) {
|
if (track->enc->pix_fmt == mov_pix_fmt_tags[i].pix_fmt) {
|
||||||
@ -626,6 +639,22 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
|
|||||||
}
|
}
|
||||||
if (!tag) // restore tag
|
if (!tag) // restore tag
|
||||||
tag = track->enc->codec_tag;
|
tag = track->enc->codec_tag;
|
||||||
|
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
|
||||||
|
{
|
||||||
|
int tag = track->enc->codec_tag;
|
||||||
|
|
||||||
|
if (!tag || (track->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL &&
|
||||||
|
(tag == MKTAG('d','v','c','p') ||
|
||||||
|
track->enc->codec_id == CODEC_ID_RAWVIDEO ||
|
||||||
|
av_get_bits_per_sample(track->enc->codec_id)))) { // pcm audio
|
||||||
|
if (track->enc->codec_id == CODEC_ID_DVVIDEO) {
|
||||||
|
tag = mov_get_dv_codec_tag(s, track);
|
||||||
|
} else if (track->enc->codec_id == CODEC_ID_RAWVIDEO) {
|
||||||
|
tag = mov_get_rawvideo_codec_tag(s, track);
|
||||||
} else {
|
} else {
|
||||||
if (track->enc->codec_type == CODEC_TYPE_VIDEO) {
|
if (track->enc->codec_type == CODEC_TYPE_VIDEO) {
|
||||||
tag = codec_get_tag(codec_movvideo_tags, track->enc->codec_id);
|
tag = codec_get_tag(codec_movvideo_tags, track->enc->codec_id);
|
||||||
@ -653,6 +682,22 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
|
|||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
|
||||||
|
{
|
||||||
|
int tag = track->enc->codec_tag;
|
||||||
|
|
||||||
|
if (track->mode == MODE_MP4 || track->mode == MODE_PSP)
|
||||||
|
tag = mp4_get_codec_tag(s, track);
|
||||||
|
else if (track->mode == MODE_IPOD)
|
||||||
|
tag = ipod_get_codec_tag(s, track);
|
||||||
|
else if (track->mode & MODE_3GP)
|
||||||
|
tag = codec_get_tag(codec_3gp_tags, track->enc->codec_id);
|
||||||
|
else
|
||||||
|
tag = mov_get_codec_tag(s, track);
|
||||||
|
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
/** Write uuid atom.
|
/** Write uuid atom.
|
||||||
* Needed to make file play in iPods running newest firmware
|
* Needed to make file play in iPods running newest firmware
|
||||||
* goes after avcC atom in moov.trak.mdia.minf.stbl.stsd.avc1
|
* goes after avcC atom in moov.trak.mdia.minf.stbl.stsd.avc1
|
||||||
|
Loading…
Reference in New Issue
Block a user