1
mirror of https://github.com/mpv-player/mpv synced 2024-11-14 22:48:35 +01:00

ad_spdif: fix this not working at all

fixes 4c3ed843dc
closes #12102
This commit is contained in:
sfan5 2023-08-07 23:08:32 +02:00
parent cf01646c39
commit a9c0ad149f

View File

@ -153,8 +153,7 @@ static int init_filter(struct mp_filter *da)
{
struct spdifContext *spdif_ctx = da->priv;
AVPacket *pkt = spdif_ctx->avpkt = av_packet_alloc();
MP_HANDLE_OOM(spdif_ctx->avpkt);
AVPacket *pkt = spdif_ctx->avpkt;
int profile = FF_PROFILE_UNKNOWN;
int c_rate = 0;
@ -299,14 +298,18 @@ static void process(struct mp_filter *da)
struct mp_aframe *out = NULL;
double pts = mpkt->pts;
if (!spdif_ctx->avpkt) {
spdif_ctx->avpkt = av_packet_alloc();
MP_HANDLE_OOM(spdif_ctx->avpkt);
}
mp_set_av_packet(spdif_ctx->avpkt, mpkt, NULL);
spdif_ctx->avpkt->pts = spdif_ctx->avpkt->dts = 0;
if (!spdif_ctx->lavf_ctx) {
if (init_filter(da) < 0)
goto done;
assert(spdif_ctx->avpkt);
}
mp_set_av_packet(spdif_ctx->avpkt, mpkt, NULL);
spdif_ctx->avpkt->pts = spdif_ctx->avpkt->dts = 0;
spdif_ctx->out_buffer_len = 0;
int ret = av_write_frame(spdif_ctx->lavf_ctx, spdif_ctx->avpkt);
avio_flush(spdif_ctx->lavf_ctx->pb);