diff options
author | wm4 <wm4@nowhere> | 2015-11-08 17:22:56 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-11-08 17:22:56 +0100 |
commit | d91434756b1bd16d788d93e6b888c2d1a54f1968 (patch) | |
tree | a1960427fac54e8ecbf2f2309dafdefb2d663aaa /audio/decode/ad_spdif.c | |
parent | 03013e0fd73cde9b0dc7f2d65387491000ee894b (diff) | |
download | mpv-d91434756b1bd16d788d93e6b888c2d1a54f1968.tar.bz2 mpv-d91434756b1bd16d788d93e6b888c2d1a54f1968.tar.xz |
audio: move PTS setting out of the decoder
Instead of requiring the decoder to set the PTS directly on the
dec_audio context (including handling absence of PTS etc.), transfer the
packet PTS to the decoded audio frame. Marginally simpler, and gives
more control to the generic code.
Diffstat (limited to 'audio/decode/ad_spdif.c')
-rw-r--r-- | audio/decode/ad_spdif.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c index 88f3f2ba2b..5e9dcf1c4f 100644 --- a/audio/decode/ad_spdif.c +++ b/audio/decode/ad_spdif.c @@ -253,13 +253,11 @@ static int decode_packet(struct dec_audio *da, struct mp_audio **out) if (!mpkt) return AD_EOF; + double pts = mpkt->pts; + AVPacket pkt; mp_set_av_packet(&pkt, mpkt, NULL); pkt.pts = pkt.dts = 0; - if (mpkt->pts != MP_NOPTS_VALUE) { - da->pts = mpkt->pts; - da->pts_offset = 0; - } if (!spdif_ctx->lavf_ctx) { if (init_filter(da, &pkt) < 0) return AD_ERR; @@ -276,6 +274,7 @@ static int decode_packet(struct dec_audio *da, struct mp_audio **out) return AD_ERR; memcpy((*out)->planes[0], spdif_ctx->out_buffer, spdif_ctx->out_buffer_len); + (*out)->pts = pts; return 0; } |