diff options
author | Peter Ross <pross@xvid.org> | 2013-12-23 13:39:31 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-23 22:51:17 +0400 |
commit | e4be07657049fe11994a2698ae41a2e750b5b7f8 (patch) | |
tree | 8e4a55e289bc33aa48eb37ce3d4689851a348864 /libavformat/wtvenc.c | |
parent | 686b6dc33a36ed19e6bcf07395b347d67290a4bc (diff) |
wtvenc: use codec tag + MEDIASUBTYPE_BASE_GUID, if there is no suitable guid
This permits H264, AAC, AAC-LATM muxing.
Fixes ticket #536.
Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/wtvenc.c')
-rw-r--r-- | libavformat/wtvenc.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c index ba0f178f98..c1066e1b3d 100644 --- a/libavformat/wtvenc.c +++ b/libavformat/wtvenc.c @@ -268,6 +268,7 @@ static void put_videoinfoheader2(AVIOContext *pb, AVStream *st) static int write_stream_codec_info(AVFormatContext *s, AVStream *st) { const ff_asf_guid *g, *media_type, *format_type; + const AVCodecTag *tags; AVIOContext *pb = s->pb; int64_t hdr_pos_start; int hdr_size = 0; @@ -275,21 +276,18 @@ static int write_stream_codec_info(AVFormatContext *s, AVStream *st) if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { g = get_codec_guid(st->codec->codec_id, ff_video_guids); media_type = &ff_mediatype_video; - format_type = &ff_format_mpeg2_video; + format_type = st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO ? &ff_format_mpeg2_video : &ff_format_videoinfo2; + tags = ff_codec_bmp_tags; } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { g = get_codec_guid(st->codec->codec_id, ff_codec_wav_guids); media_type = &ff_mediatype_audio; format_type = &ff_format_waveformatex; + tags = ff_codec_wav_tags; } else { av_log(s, AV_LOG_ERROR, "unknown codec_type (0x%x)\n", st->codec->codec_type); return -1; } - if (g == NULL) { - av_log(s, AV_LOG_ERROR, "can't get video codec_id (0x%x) guid.\n", st->codec->codec_id); - return -1; - } - ff_put_guid(pb, media_type); // mediatype ff_put_guid(pb, &ff_mediasubtype_cpfilters_processed); // subtype write_pad(pb, 12); @@ -308,7 +306,17 @@ static int write_stream_codec_info(AVFormatContext *s, AVStream *st) avio_seek(pb, -(hdr_size + 4), SEEK_CUR); avio_wl32(pb, hdr_size + 32); avio_seek(pb, hdr_size, SEEK_CUR); - ff_put_guid(pb, g); // actual_subtype + if (g) { + ff_put_guid(pb, g); // actual_subtype + } else { + int tag = ff_codec_get_tag(tags, st->codec->codec_id); + if (!tag) { + av_log(s, AV_LOG_ERROR, "unsupported codec_id (0x%x)\n", st->codec->codec_id); + return -1; + } + avio_wl32(pb, tag); + avio_write(pb, (const uint8_t[]){FF_MEDIASUBTYPE_BASE_GUID}, 12); + } ff_put_guid(pb, format_type); // actual_formattype return 0; |