Commit bb5657fa authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '6072184e'

* commit '6072184e':
  asfenc: use codec descriptors instead of AVCodecs to write codec info

Conflicts:
	tests/ref/lavf/asf
	tests/ref/seek/lavf-asf
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 00c3ff26 6072184e
...@@ -566,14 +566,11 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, ...@@ -566,14 +566,11 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
ff_put_guid(pb, &ff_asf_codec_comment1_header); ff_put_guid(pb, &ff_asf_codec_comment1_header);
avio_wl32(pb, s->nb_streams); avio_wl32(pb, s->nb_streams);
for (n = 0; n < s->nb_streams; n++) { for (n = 0; n < s->nb_streams; n++) {
AVCodec *p; const AVCodecDescriptor *codec_desc;
const char *desc; const char *desc;
int len;
uint8_t *buf;
AVIOContext *dyn_buf;
enc = s->streams[n]->codec; enc = s->streams[n]->codec;
p = avcodec_find_encoder(enc->codec_id); codec_desc = avcodec_descriptor_get(enc->codec_id);
if (enc->codec_type == AVMEDIA_TYPE_AUDIO) if (enc->codec_type == AVMEDIA_TYPE_AUDIO)
avio_wl16(pb, 2); avio_wl16(pb, 2);
...@@ -585,17 +582,24 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, ...@@ -585,17 +582,24 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
if (enc->codec_id == AV_CODEC_ID_WMAV2) if (enc->codec_id == AV_CODEC_ID_WMAV2)
desc = "Windows Media Audio V8"; desc = "Windows Media Audio V8";
else else
desc = p ? p->name : enc->codec_name; desc = codec_desc ? codec_desc->name : NULL;
if (avio_open_dyn_buf(&dyn_buf) < 0) if (desc) {
return AVERROR(ENOMEM); AVIOContext *dyn_buf;
uint8_t *buf;
int len;
avio_put_str16le(dyn_buf, desc); if (avio_open_dyn_buf(&dyn_buf) < 0)
len = avio_close_dyn_buf(dyn_buf, &buf); return AVERROR(ENOMEM);
avio_wl16(pb, len / 2); // "number of characters" = length in bytes / 2
avio_write(pb, buf, len); avio_put_str16le(dyn_buf, desc);
av_freep(&buf); 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 */ avio_wl16(pb, 0); /* no parameters */
......
6bc7dc5698c3607fad8937d14560e50c *./tests/data/lavf/lavf.asf 1a8716a0358b8123c02557dfdf6c259b *./tests/data/lavf/lavf.asf
333581 ./tests/data/lavf/lavf.asf 333585 ./tests/data/lavf/lavf.asf
./tests/data/lavf/lavf.asf CRC=0xf6340a10 ./tests/data/lavf/lavf.asf CRC=0xf6340a10
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
ret: 0 st:-1 flags:1 ts: 1.894167 ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147893 size: 209
ret: 0 st: 0 flags:0 ts: 0.788000 ret: 0 st: 0 flags:0 ts: 0.788000
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147893 size: 209
ret: 0 st: 0 flags:1 ts:-0.317000 ret: 0 st: 0 flags:1 ts:-0.317000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
ret: 0 st: 1 flags:0 ts: 2.577000 ret: 0 st: 1 flags:0 ts: 2.577000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size: 209
ret: 0 st: 1 flags:1 ts: 1.471000 ret: 0 st: 1 flags:1 ts: 1.471000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size: 209
ret: 0 st:-1 flags:0 ts: 0.365002 ret: 0 st:-1 flags:0 ts: 0.365002
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147893 size: 209
ret: 0 st:-1 flags:1 ts:-0.740831 ret: 0 st:-1 flags:1 ts:-0.740831
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
ret: 0 st: 0 flags:0 ts: 2.153000 ret: 0 st: 0 flags:0 ts: 2.153000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301493 size: 209
ret: 0 st: 0 flags:1 ts: 1.048000 ret: 0 st: 0 flags:1 ts: 1.048000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301493 size: 209
ret: 0 st: 1 flags:0 ts:-0.058000 ret: 0 st: 1 flags:0 ts:-0.058000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
ret: 0 st: 1 flags:1 ts: 2.836000 ret: 0 st: 1 flags:1 ts: 2.836000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size: 209
ret: 0 st:-1 flags:0 ts: 1.730004 ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301493 size: 209
ret: 0 st:-1 flags:1 ts: 0.624171 ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
ret: 0 st: 0 flags:0 ts:-0.482000 ret: 0 st: 0 flags:0 ts:-0.482000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
ret: 0 st: 0 flags:1 ts: 2.413000 ret: 0 st: 0 flags:1 ts: 2.413000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301493 size: 209
ret: 0 st: 1 flags:0 ts: 1.307000 ret: 0 st: 1 flags:0 ts: 1.307000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size: 209
ret: 0 st: 1 flags:1 ts: 0.201000 ret: 0 st: 1 flags:1 ts: 0.201000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
ret: 0 st:-1 flags:0 ts:-0.904994 ret: 0 st:-1 flags:0 ts:-0.904994
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
ret: 0 st:-1 flags:1 ts: 1.989173 ret: 0 st:-1 flags:1 ts: 1.989173
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301493 size: 209
ret: 0 st: 0 flags:0 ts: 0.883000 ret: 0 st: 0 flags:0 ts: 0.883000
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147893 size: 209
ret: 0 st: 0 flags:1 ts:-0.222000 ret: 0 st: 0 flags:1 ts:-0.222000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
ret: 0 st: 1 flags:0 ts: 2.672000 ret: 0 st: 1 flags:0 ts: 2.672000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size: 209
ret: 0 st: 1 flags:1 ts: 1.566000 ret: 0 st: 1 flags:1 ts: 1.566000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330293 size: 209
ret: 0 st:-1 flags:0 ts: 0.460008 ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147893 size: 209
ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 693 size: 208
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment