Mercurial > libavformat.hg
comparison riff.c @ 3908:1d3d17de20ba libavformat
Bump Major version, this commit is almost just renaming bits_per_sample to
bits_per_coded_sample but that cannot be done seperately.
Patch by Luca Abeni
Also reset the minor version and fix the forgotton change to libfaad.
Note: The API/ABI should not be considered stable yet, there still may
be a change done here or there if some developer has some cleanup ideas and
patches!
author | michael |
---|---|
date | Mon, 08 Sep 2008 14:24:59 +0000 |
parents | b3a0c732d0d7 |
children | 2768ffe4332b |
comparison
equal
deleted
inserted
replaced
3907:7c71e9cabf0e | 3908:1d3d17de20ba |
---|---|
249 bps = 4; | 249 bps = 4; |
250 } else { | 250 } else { |
251 if (!(bps = av_get_bits_per_sample(enc->codec_id))) | 251 if (!(bps = av_get_bits_per_sample(enc->codec_id))) |
252 bps = 16; // default to 16 | 252 bps = 16; // default to 16 |
253 } | 253 } |
254 if(bps != enc->bits_per_sample && enc->bits_per_sample){ | 254 if(bps != enc->bits_per_coded_sample && enc->bits_per_coded_sample){ |
255 av_log(enc, AV_LOG_WARNING, "requested bits_per_sample (%d) and actually stored (%d) differ\n", enc->bits_per_sample, bps); | 255 av_log(enc, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) and actually stored (%d) differ\n", enc->bits_per_coded_sample, bps); |
256 } | 256 } |
257 | 257 |
258 if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_AC3) { | 258 if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_AC3) { |
259 blkalign = enc->frame_size; //this is wrong, but it seems many demuxers do not work if this is set correctly | 259 blkalign = enc->frame_size; //this is wrong, but it seems many demuxers do not work if this is set correctly |
260 //blkalign = 144 * enc->bit_rate/enc->sample_rate; | 260 //blkalign = 144 * enc->bit_rate/enc->sample_rate; |
325 put_le32(pb, 40 + enc->extradata_size); /* size */ | 325 put_le32(pb, 40 + enc->extradata_size); /* size */ |
326 put_le32(pb, enc->width); | 326 put_le32(pb, enc->width); |
327 put_le32(pb, enc->height); | 327 put_le32(pb, enc->height); |
328 put_le16(pb, 1); /* planes */ | 328 put_le16(pb, 1); /* planes */ |
329 | 329 |
330 put_le16(pb, enc->bits_per_sample ? enc->bits_per_sample : 24); /* depth */ | 330 put_le16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */ |
331 /* compression type */ | 331 /* compression type */ |
332 put_le32(pb, enc->codec_tag); | 332 put_le32(pb, enc->codec_tag); |
333 put_le32(pb, enc->width * enc->height * 3); | 333 put_le32(pb, enc->width * enc->height * 3); |
334 put_le32(pb, 0); | 334 put_le32(pb, 0); |
335 put_le32(pb, 0); | 335 put_le32(pb, 0); |
361 codec->channels = get_le16(pb); | 361 codec->channels = get_le16(pb); |
362 codec->sample_rate = get_le32(pb); | 362 codec->sample_rate = get_le32(pb); |
363 codec->bit_rate = get_le32(pb) * 8; | 363 codec->bit_rate = get_le32(pb) * 8; |
364 codec->block_align = get_le16(pb); | 364 codec->block_align = get_le16(pb); |
365 if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */ | 365 if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */ |
366 codec->bits_per_sample = 8; | 366 codec->bits_per_coded_sample = 8; |
367 }else | 367 }else |
368 codec->bits_per_sample = get_le16(pb); | 368 codec->bits_per_coded_sample = get_le16(pb); |
369 if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */ | 369 if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */ |
370 int cbSize = get_le16(pb); /* cbSize */ | 370 int cbSize = get_le16(pb); /* cbSize */ |
371 size -= 18; | 371 size -= 18; |
372 cbSize = FFMIN(size, cbSize); | 372 cbSize = FFMIN(size, cbSize); |
373 if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */ | 373 if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */ |
374 codec->bits_per_sample = get_le16(pb); | 374 codec->bits_per_coded_sample = get_le16(pb); |
375 get_le32(pb); /* dwChannelMask */ | 375 get_le32(pb); /* dwChannelMask */ |
376 id = get_le32(pb); /* 4 first bytes of GUID */ | 376 id = get_le32(pb); /* 4 first bytes of GUID */ |
377 url_fskip(pb, 12); /* skip end of GUID */ | 377 url_fskip(pb, 12); /* skip end of GUID */ |
378 cbSize -= 22; | 378 cbSize -= 22; |
379 size -= 22; | 379 size -= 22; |
387 | 387 |
388 /* It is possible for the chunk to contain garbage at the end */ | 388 /* It is possible for the chunk to contain garbage at the end */ |
389 if (size > 0) | 389 if (size > 0) |
390 url_fskip(pb, size); | 390 url_fskip(pb, size); |
391 } | 391 } |
392 codec->codec_id = wav_codec_get_id(id, codec->bits_per_sample); | 392 codec->codec_id = wav_codec_get_id(id, codec->bits_per_coded_sample); |
393 } | 393 } |
394 | 394 |
395 | 395 |
396 int wav_codec_get_id(unsigned int tag, int bps) | 396 int wav_codec_get_id(unsigned int tag, int bps) |
397 { | 397 { |