| @@ -406,16 +406,11 @@ static int init_pts(AVFormatContext *s) · 405 unmodified lines |
| 406 | break; | 406 | break; |
| 407 | } | 407 | } |
| 408 | | 408 | |
| 409 | if (!sti->priv_pts) | | |
| 410 | sti->priv_pts = av_mallocz(sizeof(*sti->priv_pts)); | | |
| 411 | if (!sti->priv_pts) | | |
| 412 | return AVERROR(ENOMEM); | | |
| 413 | | | |
| 414 | if (den != AV_NOPTS_VALUE) { | 409 | if (den != AV_NOPTS_VALUE) { |
| 415 | if (den <= 0) | 410 | if (den <= 0) |
| 416 | return AVERROR_INVALIDDATA; | 411 | return AVERROR_INVALIDDATA; |
| 417 | | 412 | |
| 418 | frac_init(sti->priv_pts, 0, 0, den); | 413 | frac_init(&sti->priv_pts, 0, 0, den); |
| 419 | } | 414 | } |
| 420 | } | 415 | } |
| 421 | | 416 | |
| @@ -550,7 +545,7 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket * · 128 unmodified lines |
| 550 | } | 545 | } |
| 551 | pkt->dts = | 546 | pkt->dts = |
| 552 | // pkt->pts= st->cur_dts; | 547 | // pkt->pts= st->cur_dts; |
| 553 | pkt->pts = sti->priv_pts->val; | 548 | pkt->pts = sti->priv_pts.val; |
| 554 | } | 549 | } |
| 555 | | 550 | |
| 556 | //calculate dts from pts | 551 | //calculate dts from pts |
| @@ -587,7 +582,7 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket * · 30 unmodified lines |
| 587 | av_ts2str(pkt->pts), av_ts2str(pkt->dts)); | 582 | av_ts2str(pkt->pts), av_ts2str(pkt->dts)); |
| 588 | | 583 | |
| 589 | sti->cur_dts = pkt->dts; | 584 | sti->cur_dts = pkt->dts; |
| 590 | sti->priv_pts->val = pkt->dts; | 585 | sti->priv_pts.val = pkt->dts; |
| 591 | | 586 | |
| 592 | /* update pts */ | 587 | /* update pts */ |
| 593 | switch (st->codecpar->codec_type) { | 588 | switch (st->codecpar->codec_type) { |
| @@ -599,12 +594,12 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket * · 5 unmodified lines |
| 599 | /* HACK/FIXME, we skip the initial 0 size packets as they are most | 594 | /* HACK/FIXME, we skip the initial 0 size packets as they are most |
| 600 | * likely equal to the encoder delay, but it would be better if we | 595 | * likely equal to the encoder delay, but it would be better if we |
| 601 | * had the real timestamps from the encoder */ | 596 | * had the real timestamps from the encoder */ |
| 602 | if (frame_size >= 0 && (pkt->size || sti->priv_pts->num != sti->priv_pts->den >> 1 || sti->priv_pts->val)) { | 597 | if (frame_size >= 0 && (pkt->size || sti->priv_pts.num != sti->priv_pts.den >> 1 || sti->priv_pts.val)) { |
| 603 | frac_add(sti->priv_pts, (int64_t)st->time_base.den * frame_size); | 598 | frac_add(&sti->priv_pts, (int64_t)st->time_base.den * frame_size); |
| 604 | } | 599 | } |
| 605 | break; | 600 | break; |
| 606 | case AVMEDIA_TYPE_VIDEO: | 601 | case AVMEDIA_TYPE_VIDEO: |
| 607 | frac_add(sti->priv_pts, (int64_t)st->time_base.den * st->time_base.num); | 602 | frac_add(&sti->priv_pts, (int64_t)st->time_base.den * st->time_base.num); |
| 608 | break; | 603 | break; |
| 609 | } | 604 | } |
| 610 | return 0; | 605 | return 0; |