mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-24 08:12:44 +00:00
avformat/argo_asf: fix handling of v1.1 files
Version 1.1 (FX Fighter) files all have a sample rate of 44100 in the header, but only play back correctly at 22050. Force the sample rate to 22050 when reading, and restrict it when muxing.
This commit is contained in:
parent
5c2c35da12
commit
d2f7b39914
@ -187,6 +187,10 @@ static int argo_asf_read_header(AVFormatContext *s)
|
|||||||
st->codecpar->channels = 1;
|
st->codecpar->channels = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* v1.1 files (FX Fighter) are all marked as 44100, but are actually 22050. */
|
||||||
|
if (asf->fhdr.version_major == 1 && asf->fhdr.version_minor == 1)
|
||||||
|
st->codecpar->sample_rate = 22050;
|
||||||
|
else
|
||||||
st->codecpar->sample_rate = asf->ckhdr.sample_rate;
|
st->codecpar->sample_rate = asf->ckhdr.sample_rate;
|
||||||
|
|
||||||
st->codecpar->bits_per_coded_sample = 4;
|
st->codecpar->bits_per_coded_sample = 4;
|
||||||
@ -264,6 +268,7 @@ AVInputFormat ff_argo_asf_demuxer = {
|
|||||||
#if CONFIG_ARGO_ASF_MUXER
|
#if CONFIG_ARGO_ASF_MUXER
|
||||||
static int argo_asf_write_init(AVFormatContext *s)
|
static int argo_asf_write_init(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
|
ArgoASFMuxContext *ctx = s->priv_data;
|
||||||
const AVCodecParameters *par;
|
const AVCodecParameters *par;
|
||||||
|
|
||||||
if (s->nb_streams != 1) {
|
if (s->nb_streams != 1) {
|
||||||
@ -279,6 +284,11 @@ static int argo_asf_write_init(AVFormatContext *s)
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx->version_major == 1 && ctx->version_minor == 1 && par->sample_rate != 22050) {
|
||||||
|
av_log(s, AV_LOG_ERROR, "ASF v1.1 files only support a sample rate of 22050\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
if (par->channels > 2) {
|
if (par->channels > 2) {
|
||||||
av_log(s, AV_LOG_ERROR, "ASF files only support up to 2 channels\n");
|
av_log(s, AV_LOG_ERROR, "ASF files only support up to 2 channels\n");
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
@ -351,7 +361,12 @@ static int argo_asf_write_header(AVFormatContext *s)
|
|||||||
chdr.num_blocks = 0;
|
chdr.num_blocks = 0;
|
||||||
chdr.num_samples = ASF_SAMPLE_COUNT;
|
chdr.num_samples = ASF_SAMPLE_COUNT;
|
||||||
chdr.unk1 = 0;
|
chdr.unk1 = 0;
|
||||||
|
|
||||||
|
if (ctx->version_major == 1 && ctx->version_minor == 1)
|
||||||
|
chdr.sample_rate = 44100;
|
||||||
|
else
|
||||||
chdr.sample_rate = par->sample_rate;
|
chdr.sample_rate = par->sample_rate;
|
||||||
|
|
||||||
chdr.unk2 = ~0;
|
chdr.unk2 = ~0;
|
||||||
chdr.flags = ASF_CF_BITS_PER_SAMPLE | ASF_CF_ALWAYS1;
|
chdr.flags = ASF_CF_BITS_PER_SAMPLE | ASF_CF_ALWAYS1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user