Merge commit '9257692ac15eff7b07540c1f61cebde0d8823fbd'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 18 Nov 2014 01:38:38 +0000 (02:38 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 18 Nov 2014 01:46:07 +0000 (02:46 +0100)
* commit '9257692ac15eff7b07540c1f61cebde0d8823fbd':
  lavf: Only initialize s->offset once when using avoid_negative_ts make_zero

Conflicts:
libavformat/mux.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/mux.c
libavformat/options.c
tests/ref/lavf/ismv

@@@ -539,37 -321,21 +539,37 @@@ static int compute_pkt_fields2(AVFormat
   * Those additional safety checks should be dropped once the correct checks
   * are set in the callers.
   */
 -
  static int write_packet(AVFormatContext *s, AVPacket *pkt)
  {
 -    int ret;
 +    int ret, did_split;
 +
 +    if (s->output_ts_offset) {
 +        AVStream *st = s->streams[pkt->stream_index];
 +        int64_t offset = av_rescale_q(s->output_ts_offset, AV_TIME_BASE_Q, st->time_base);
 +
 +        if (pkt->dts != AV_NOPTS_VALUE)
 +            pkt->dts += offset;
 +        if (pkt->pts != AV_NOPTS_VALUE)
 +            pkt->pts += offset;
 +    }
 +
      if (s->avoid_negative_ts > 0) {
 -        AVRational time_base = s->streams[pkt->stream_index]->time_base;
 -        int64_t offset = 0;
 +        AVStream *st = s->streams[pkt->stream_index];
 +        int64_t offset = st->mux_ts_offset;
  
-         if (!s->offset && pkt->dts != AV_NOPTS_VALUE &&
+         if (s->offset == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE &&
              (pkt->dts < 0 || s->avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO)) {
              s->offset = -pkt->dts;
 -            s->offset_timebase = time_base;
 +            s->offset_timebase = st->time_base;
 +        }
 +
-         if (s->offset && !offset) {
++        if (s->offset != AV_NOPTS_VALUE && !offset) {
 +            offset = st->mux_ts_offset =
 +                av_rescale_q_rnd(s->offset,
 +                                 s->offset_timebase,
 +                                 st->time_base,
 +                                 AV_ROUND_UP);
          }
 -        if (s->offset != AV_NOPTS_VALUE)
 -            offset = av_rescale_q(s->offset, s->offset_timebase, time_base);
  
          if (pkt->dts != AV_NOPTS_VALUE)
              pkt->dts += offset;
Simple merge
index ab2975f,0000000..f29b5ff
mode 100644,000000..100644
--- /dev/null
@@@ -1,9 -1,0 +1,9 @@@
- b1106bfcdbd1bb12be9161320351dd00 *./tests/data/lavf/lavf.ismv
++a9ccbb4cd1436d222ef4425567b4e03d *./tests/data/lavf/lavf.ismv
 +312542 ./tests/data/lavf/lavf.ismv
- ./tests/data/lavf/lavf.ismv CRC=0xb7d29d29
- c8bea6c84b6274f14042381045b0f532 *./tests/data/lavf/lavf.ismv
++./tests/data/lavf/lavf.ismv CRC=0x9d9a638a
++440d85f9fd5b9f63c2676638782b5c15 *./tests/data/lavf/lavf.ismv
 +321448 ./tests/data/lavf/lavf.ismv
- ./tests/data/lavf/lavf.ismv CRC=0x33834815
- b1106bfcdbd1bb12be9161320351dd00 *./tests/data/lavf/lavf.ismv
++./tests/data/lavf/lavf.ismv CRC=0xe8130120
++a9ccbb4cd1436d222ef4425567b4e03d *./tests/data/lavf/lavf.ismv
 +312542 ./tests/data/lavf/lavf.ismv
- ./tests/data/lavf/lavf.ismv CRC=0xb7d29d29
++./tests/data/lavf/lavf.ismv CRC=0x9d9a638a