diff options
author | wm4 <wm4@nowhere> | 2016-01-19 22:24:26 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-01-19 22:24:38 +0100 |
commit | 30031edce3bb79051a125183c8dc152ba4e78e66 (patch) | |
tree | b041672d79d6e93423a65e33260ba13eca23695d /audio/decode/ad_spdif.c | |
parent | c365b44e19e1ab1cdb0d2aaca5360108d6da862a (diff) | |
download | mpv-30031edce3bb79051a125183c8dc152ba4e78e66.tar.bz2 mpv-30031edce3bb79051a125183c8dc152ba4e78e66.tar.xz |
audio: move direct packet reading from decoders to common code
Another bit of preparation.
Diffstat (limited to 'audio/decode/ad_spdif.c')
-rw-r--r-- | audio/decode/ad_spdif.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c index dd0ef181af..8f762545f3 100644 --- a/audio/decode/ad_spdif.c +++ b/audio/decode/ad_spdif.c @@ -242,16 +242,13 @@ fail: return -1; } -static int decode_packet(struct dec_audio *da, struct mp_audio **out) +static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt, + struct mp_audio **out) { struct spdifContext *spdif_ctx = da->priv; spdif_ctx->out_buffer_len = 0; - struct demux_packet *mpkt; - if (demux_read_packet_async(da->header, &mpkt) == 0) - return AD_WAIT; - if (!mpkt) return AD_EOF; @@ -259,13 +256,13 @@ static int decode_packet(struct dec_audio *da, struct mp_audio **out) AVPacket pkt; mp_set_av_packet(&pkt, mpkt, NULL); + mpkt->len = 0; // will be fully consumed pkt.pts = pkt.dts = 0; if (!spdif_ctx->lavf_ctx) { if (init_filter(da, &pkt) < 0) return AD_ERR; } int ret = av_write_frame(spdif_ctx->lavf_ctx, &pkt); - talloc_free(mpkt); avio_flush(spdif_ctx->lavf_ctx->pb); if (ret < 0) return AD_ERR; |