return 0;
}
- static int mxf_set_audio_pts(MXFContext *mxf, AVCodecContext *codec, AVPacket *pkt)
+ static int mxf_set_audio_pts(MXFContext *mxf, AVCodecContext *codec,
+ AVPacket *pkt)
{
MXFTrack *track = mxf->fc->streams[pkt->stream_index]->priv_data;
+ int64_t bits_per_sample = av_get_bits_per_sample(codec->codec_id);
+
pkt->pts = track->sample_count;
- if (codec->channels <= 0 || codec->channels * bits_per_sample < 8)
- return AVERROR_INVALIDDATA;
-
- track->sample_count += pkt->size / (codec->channels * bits_per_sample / 8);
+
- || av_get_bits_per_sample(codec->codec_id) <= 0
- || codec->channels * (int64_t)av_get_bits_per_sample(codec->codec_id) < 8)
+ if ( codec->channels <= 0
- track->sample_count += pkt->size / (codec->channels * (int64_t)av_get_bits_per_sample(codec->codec_id) / 8);
++ || bits_per_sample <= 0
++ || codec->channels * (int64_t)bits_per_sample < 8)
+ return AVERROR(EINVAL);
++ track->sample_count += pkt->size / (codec->channels * (int64_t)bits_per_sample / 8);
return 0;
}
pkt->pos = klv.offset;
codec = s->streams[index]->codec;
+
if (codec->codec_type == AVMEDIA_TYPE_VIDEO && next_ofs >= 0) {
- /* mxf->current_edit_unit good - see if we have an index table to derive timestamps from */
+ /* mxf->current_edit_unit good - see if we have an
+ * index table to derive timestamps from */
MXFIndexTable *t = &mxf->index_tables[0];
- if (mxf->nb_index_tables >= 1 &&
- mxf->current_edit_unit < t->nb_ptses) {
+ if (mxf->nb_index_tables >= 1 && mxf->current_edit_unit < t->nb_ptses) {
pkt->dts = mxf->current_edit_unit + t->first_dts;
pkt->pts = t->ptses[mxf->current_edit_unit];
} else if (track->intra_only) {