From 30031edce3bb79051a125183c8dc152ba4e78e66 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 19 Jan 2016 22:24:26 +0100 Subject: audio: move direct packet reading from decoders to common code Another bit of preparation. --- audio/decode/ad_spdif.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'audio/decode/ad_spdif.c') 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; -- cgit v1.2.3