mirror of
https://github.com/mpv-player/mpv
synced 2025-04-11 04:01:31 +00:00
parent
cf01646c39
commit
a9c0ad149f
@ -153,8 +153,7 @@ static int init_filter(struct mp_filter *da)
|
|||||||
{
|
{
|
||||||
struct spdifContext *spdif_ctx = da->priv;
|
struct spdifContext *spdif_ctx = da->priv;
|
||||||
|
|
||||||
AVPacket *pkt = spdif_ctx->avpkt = av_packet_alloc();
|
AVPacket *pkt = spdif_ctx->avpkt;
|
||||||
MP_HANDLE_OOM(spdif_ctx->avpkt);
|
|
||||||
|
|
||||||
int profile = FF_PROFILE_UNKNOWN;
|
int profile = FF_PROFILE_UNKNOWN;
|
||||||
int c_rate = 0;
|
int c_rate = 0;
|
||||||
@ -299,14 +298,18 @@ static void process(struct mp_filter *da)
|
|||||||
struct mp_aframe *out = NULL;
|
struct mp_aframe *out = NULL;
|
||||||
double pts = mpkt->pts;
|
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 (!spdif_ctx->lavf_ctx) {
|
||||||
if (init_filter(da) < 0)
|
if (init_filter(da) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
assert(spdif_ctx->avpkt);
|
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;
|
spdif_ctx->out_buffer_len = 0;
|
||||||
int ret = av_write_frame(spdif_ctx->lavf_ctx, spdif_ctx->avpkt);
|
int ret = av_write_frame(spdif_ctx->lavf_ctx, spdif_ctx->avpkt);
|
||||||
avio_flush(spdif_ctx->lavf_ctx->pb);
|
avio_flush(spdif_ctx->lavf_ctx->pb);
|
||||||
|
Loading…
Reference in New Issue
Block a user