mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-08 16:54:03 +02:00
avformat/mxfdec: do not use sound essence descriptor quantization bits for bits_per_coded_sample
It refers to the uncompressed quantization, therefore is not correct for AAC. Also change mxf_set_pts to work based on current edit unit if bits_per_coded_sample is not available. Fixes error messages in the sample of ticket #7366. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
776909e42e
commit
6aaf1b504c
@ -2390,7 +2390,6 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
|
|||||||
if (st->codecpar->codec_id == AV_CODEC_ID_NONE || (st->codecpar->codec_id == AV_CODEC_ID_PCM_ALAW && (enum AVCodecID)container_ul->id != AV_CODEC_ID_NONE))
|
if (st->codecpar->codec_id == AV_CODEC_ID_NONE || (st->codecpar->codec_id == AV_CODEC_ID_PCM_ALAW && (enum AVCodecID)container_ul->id != AV_CODEC_ID_NONE))
|
||||||
st->codecpar->codec_id = (enum AVCodecID)container_ul->id;
|
st->codecpar->codec_id = (enum AVCodecID)container_ul->id;
|
||||||
st->codecpar->channels = descriptor->channels;
|
st->codecpar->channels = descriptor->channels;
|
||||||
st->codecpar->bits_per_coded_sample = descriptor->bits_per_sample;
|
|
||||||
|
|
||||||
if (descriptor->sample_rate.den > 0) {
|
if (descriptor->sample_rate.den > 0) {
|
||||||
st->codecpar->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;
|
st->codecpar->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;
|
||||||
@ -2423,6 +2422,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
|
|||||||
} else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) {
|
} else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) {
|
||||||
st->need_parsing = AVSTREAM_PARSE_FULL;
|
st->need_parsing = AVSTREAM_PARSE_FULL;
|
||||||
}
|
}
|
||||||
|
st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id);
|
||||||
} else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
|
} else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
|
||||||
enum AVMediaType type;
|
enum AVMediaType type;
|
||||||
container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, essence_container_ul);
|
container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, essence_container_ul);
|
||||||
@ -3269,7 +3269,8 @@ static int64_t mxf_set_current_edit_unit(MXFContext *mxf, AVStream *st, int64_t
|
|||||||
static int mxf_set_audio_pts(MXFContext *mxf, AVCodecParameters *par,
|
static int mxf_set_audio_pts(MXFContext *mxf, AVCodecParameters *par,
|
||||||
AVPacket *pkt)
|
AVPacket *pkt)
|
||||||
{
|
{
|
||||||
MXFTrack *track = mxf->fc->streams[pkt->stream_index]->priv_data;
|
AVStream *st = mxf->fc->streams[pkt->stream_index];
|
||||||
|
MXFTrack *track = st->priv_data;
|
||||||
int64_t bits_per_sample = par->bits_per_coded_sample;
|
int64_t bits_per_sample = par->bits_per_coded_sample;
|
||||||
|
|
||||||
if (!bits_per_sample)
|
if (!bits_per_sample)
|
||||||
@ -3280,8 +3281,10 @@ static int mxf_set_audio_pts(MXFContext *mxf, AVCodecParameters *par,
|
|||||||
if ( par->channels <= 0
|
if ( par->channels <= 0
|
||||||
|| bits_per_sample <= 0
|
|| bits_per_sample <= 0
|
||||||
|| par->channels * (int64_t)bits_per_sample < 8)
|
|| par->channels * (int64_t)bits_per_sample < 8)
|
||||||
return AVERROR(EINVAL);
|
track->sample_count = mxf_compute_sample_count(mxf, st, av_rescale_q(track->sample_count, st->time_base, av_inv_q(track->edit_rate)) + 1);
|
||||||
track->sample_count += pkt->size / (par->channels * (int64_t)bits_per_sample / 8);
|
else
|
||||||
|
track->sample_count += pkt->size / (par->channels * (int64_t)bits_per_sample / 8);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user