summaryrefslogtreecommitdiffstats
path: root/audio/decode/ad_lavc.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/decode/ad_lavc.c')
-rw-r--r--audio/decode/ad_lavc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index 08b789a709..39cd74cd2a 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -17,7 +17,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <stdbool.h>
#include <assert.h>
@@ -44,6 +43,7 @@
#include "options/options.h"
struct priv {
+ struct mp_codec_params *codec;
AVCodecContext *avctx;
AVFrame *avframe;
AVPacket *avpkt;
@@ -156,7 +156,7 @@ static bool init(struct mp_filter *da, struct mp_codec_params *codec,
return true;
}
-static void destroy(struct mp_filter *da)
+static void ad_lavc_destroy(struct mp_filter *da)
{
struct priv *ctx = da->priv;
@@ -165,7 +165,7 @@ static void destroy(struct mp_filter *da)
mp_free_av_packet(&ctx->avpkt);
}
-static void reset(struct mp_filter *da)
+static void ad_lavc_reset(struct mp_filter *da)
{
struct priv *ctx = da->priv;
@@ -219,6 +219,8 @@ static int receive_frame(struct mp_filter *da, struct mp_frame *out)
if (!priv->avframe->buf[0])
return ret;
+ mp_codec_info_from_av(avctx, priv->codec);
+
double out_pts = mp_pts_from_av(priv->avframe->pts, &priv->codec_timebase);
struct mp_aframe *mpframe = mp_aframe_from_avframe(priv->avframe);
@@ -276,7 +278,7 @@ static int receive_frame(struct mp_filter *da, struct mp_frame *out)
return ret;
}
-static void process(struct mp_filter *ad)
+static void ad_lavc_process(struct mp_filter *ad)
{
struct priv *priv = ad->priv;
@@ -286,9 +288,9 @@ static void process(struct mp_filter *ad)
static const struct mp_filter_info ad_lavc_filter = {
.name = "ad_lavc",
.priv_size = sizeof(struct priv),
- .process = process,
- .reset = reset,
- .destroy = destroy,
+ .process = ad_lavc_process,
+ .reset = ad_lavc_reset,
+ .destroy = ad_lavc_destroy,
};
static struct mp_decoder *create(struct mp_filter *parent,
@@ -305,12 +307,16 @@ static struct mp_decoder *create(struct mp_filter *parent,
da->log = mp_log_new(da, parent->log, NULL);
struct priv *priv = da->priv;
+ priv->codec = codec;
priv->public.f = da;
if (!init(da, codec, decoder)) {
talloc_free(da);
return NULL;
}
+
+ codec->codec_desc = priv->avctx->codec_descriptor->long_name;
+
return &priv->public;
}