1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

asfenc: use codec descriptors instead of AVCodecs to write codec info

Also, stop using AVCodecContext.codec_name as fallback, since it will be
deprecated.

Changes the result of the lavf-asf test (and its associated seektest),
since 'msmpeg4v3' gets written instead of just 'msmpeg4'.
This commit is contained in:
Anton Khirnov 2014-04-29 16:13:38 +02:00
parent 92e4b643df
commit 6072184e70
3 changed files with 47 additions and 43 deletions

View File

@ -532,14 +532,11 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
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);
@ -551,17 +548,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 */

View File

@ -1,3 +1,3 @@
327385dd5f418faa6237089a40159b78 *./tests/data/lavf/lavf.asf
333375 ./tests/data/lavf/lavf.asf
33e857a06b2b5dedce0bf76c9973944c *./tests/data/lavf/lavf.asf
333379 ./tests/data/lavf/lavf.asf
./tests/data/lavf/lavf.asf CRC=0xf6340a10

View File

@ -1,53 +1,53 @@
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 208
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147775 size: 209
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147779 size: 209
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301375 size: 209
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209
ret: 0 st: 0 flags:0 ts: 0.788000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301375 size: 209
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209
ret: 0 st: 0 flags:1 ts:-0.317000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 208
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208
ret: 0 st: 1 flags:0 ts: 2.577000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330175 size: 209
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209
ret: 0 st: 1 flags:1 ts: 1.471000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330175 size: 209
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209
ret: 0 st:-1 flags:0 ts: 0.365002
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147775 size: 209
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147779 size: 209
ret: 0 st:-1 flags:1 ts:-0.740831
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 208
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208
ret: 0 st: 0 flags:0 ts: 2.153000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301375 size: 209
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209
ret: 0 st: 0 flags:1 ts: 1.048000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301375 size: 209
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209
ret: 0 st: 1 flags:0 ts:-0.058000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 208
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208
ret: 0 st: 1 flags:1 ts: 2.836000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330175 size: 209
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209
ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301375 size: 209
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147775 size: 209
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147779 size: 209
ret: 0 st: 0 flags:0 ts:-0.482000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 208
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208
ret: 0 st: 0 flags:1 ts: 2.413000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301375 size: 209
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209
ret: 0 st: 1 flags:0 ts: 1.307000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330175 size: 209
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209
ret: 0 st: 1 flags:1 ts: 0.201000
ret: 0 st: 1 flags:1 dts: 0.183000 pts: 0.183000 pos: 70975 size: 209
ret: 0 st: 1 flags:1 dts: 0.183000 pts: 0.183000 pos: 70979 size: 209
ret: 0 st:-1 flags:0 ts:-0.904994
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 208
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208
ret: 0 st:-1 flags:1 ts: 1.989173
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301375 size: 209
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209
ret: 0 st: 0 flags:0 ts: 0.883000
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301375 size: 209
ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301379 size: 209
ret: 0 st: 0 flags:1 ts:-0.222000
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 208
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208
ret: 0 st: 1 flags:0 ts: 2.672000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330175 size: 209
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209
ret: 0 st: 1 flags:1 ts: 1.566000
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330175 size: 209
ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330179 size: 209
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147775 size: 209
ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147779 size: 209
ret: 0 st:-1 flags:1 ts:-0.645825
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 208
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 579 size: 208