OSDN Git Service

Merge commit '5b930092c3afd2ae01f1c8aa7fb405911d6ad416'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 6 Mar 2014 21:39:18 +0000 (22:39 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 6 Mar 2014 21:50:06 +0000 (22:50 +0100)
* commit '5b930092c3afd2ae01f1c8aa7fb405911d6ad416':
  mxf: Set audio packets pts

Conflicts:
libavformat/mxfdec.c

See: 83cab07a4c7f8ee1521c49e387b7d86de78d1955
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/mxfdec.c

@@@ -2267,15 -2091,18 +2274,19 @@@ static int mxf_compute_sample_count(MXF
      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;
  }
  
@@@ -2344,11 -2173,14 +2355,13 @@@ static int mxf_read_packet_old(AVFormat
              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) {