aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/asfenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-01 17:40:14 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-01 17:40:14 +0200
commitbb5657fabfecd4007816d7310a410f628aa5bf91 (patch)
tree31ac5e11e0f9f9bc8601c21ff24d0b354111df15 /libavformat/asfenc.c
parent00c3ff26f230048e844130fcae0ab29ee20991c9 (diff)
parent6072184e702b4b631ac72f1b66b75e5f21e0ce2d (diff)
downloadffmpeg-bb5657fabfecd4007816d7310a410f628aa5bf91.tar.gz
Merge commit '6072184e702b4b631ac72f1b66b75e5f21e0ce2d'
* commit '6072184e702b4b631ac72f1b66b75e5f21e0ce2d': asfenc: use codec descriptors instead of AVCodecs to write codec info Conflicts: tests/ref/lavf/asf tests/ref/seek/lavf-asf Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/asfenc.c')
-rw-r--r--libavformat/asfenc.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 23d83b712d..02f2a299c9 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -566,14 +566,11 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
ff_put_guid(pb, &ff_asf_codec_comment1_header);
avio_wl32(pb, s->nb_streams);
for (n = 0; n < s->nb_streams; n++) {
- AVCodec *p;
+ const AVCodecDescriptor *codec_desc;
const char *desc;
- int len;
- uint8_t *buf;
- AVIOContext *dyn_buf;
- enc = s->streams[n]->codec;
- p = avcodec_find_encoder(enc->codec_id);
+ enc = s->streams[n]->codec;
+ codec_desc = avcodec_descriptor_get(enc->codec_id);
if (enc->codec_type == AVMEDIA_TYPE_AUDIO)
avio_wl16(pb, 2);
@@ -585,17 +582,24 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
if (enc->codec_id == AV_CODEC_ID_WMAV2)
desc = "Windows Media Audio V8";
else
- desc = p ? p->name : enc->codec_name;
+ desc = codec_desc ? codec_desc->name : NULL;
- if (avio_open_dyn_buf(&dyn_buf) < 0)
- return AVERROR(ENOMEM);
+ if (desc) {
+ AVIOContext *dyn_buf;
+ uint8_t *buf;
+ int len;
- avio_put_str16le(dyn_buf, desc);
- len = avio_close_dyn_buf(dyn_buf, &buf);
- avio_wl16(pb, len / 2); // "number of characters" = length in bytes / 2
+ if (avio_open_dyn_buf(&dyn_buf) < 0)
+ return AVERROR(ENOMEM);
- avio_write(pb, buf, len);
- av_freep(&buf);
+ avio_put_str16le(dyn_buf, desc);
+ len = avio_close_dyn_buf(dyn_buf, &buf);
+ avio_wl16(pb, len / 2); // "number of characters" = length in bytes / 2
+
+ avio_write(pb, buf, len);
+ av_freep(&buf);
+ } else
+ avio_wl16(pb, 0);
avio_wl16(pb, 0); /* no parameters */