summaryrefslogtreecommitdiffstats
path: root/video/filter/vf_lavfi.c
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2014-04-13 07:04:23 -0700
committerwm4 <wm4@nowhere>2014-04-13 18:03:01 +0200
commitf09134b76d9dfda8001de82fa33bc1aab967cae7 (patch)
treed406bd139a84882bac2c4d09795b001dbc25a533 /video/filter/vf_lavfi.c
parent0a278f92e69963f64723ae70e24af040e6c04958 (diff)
downloadmpv-f09134b76d9dfda8001de82fa33bc1aab967cae7.tar.bz2
mpv-f09134b76d9dfda8001de82fa33bc1aab967cae7.tar.xz
vf_lavfi: copy AVFrame metadata into vf_lavfi priv
store it as mp_tas and add VFCTRL_GET_METADATA to access it from elsewhere Signed-off-by: wm4 <wm4@nowhere> old-configure test by wm4.
Diffstat (limited to 'video/filter/vf_lavfi.c')
-rw-r--r--video/filter/vf_lavfi.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c
index dde1547abf..abcaa79c2c 100644
--- a/video/filter/vf_lavfi.c
+++ b/video/filter/vf_lavfi.c
@@ -39,6 +39,7 @@
#include "common/msg.h"
#include "options/m_option.h"
#include "common/av_opts.h"
+#include "common/tags.h"
#include "video/img_format.h"
#include "video/mp_image.h"
@@ -66,6 +67,8 @@ struct vf_priv_s {
AVRational timebase_out;
AVRational par_in;
+ struct mp_tags* metadata;
+
// for the lw wrapper
void *old_priv;
void (*lw_recreate_cb)(struct vf_instance *vf);
@@ -266,6 +269,17 @@ static struct mp_image *av_to_mp(struct vf_instance *vf, AVFrame *av_frame)
return img;
}
+static void get_metadata_from_av_frame(struct vf_instance *vf, AVFrame *frame)
+{
+#if HAVE_AVFRAME_METADATA
+ struct vf_priv_s *p = vf->priv;
+ if (!p->metadata)
+ p->metadata = talloc_zero(p, struct mp_tags);
+
+ mp_tags_copy_from_av_dictionary(p->metadata, av_frame_get_metadata(frame));
+#endif
+}
+
static int filter_ext(struct vf_instance *vf, struct mp_image *mpi)
{
struct vf_priv_s *p = vf->priv;
@@ -287,6 +301,8 @@ static int filter_ext(struct vf_instance *vf, struct mp_image *mpi)
av_frame_free(&frame);
break;
}
+ get_metadata_from_av_frame(vf,frame);
+
vf_add_output_frame(vf, av_to_mp(vf, frame));
}
@@ -307,6 +323,10 @@ static int control(vf_instance_t *vf, int request, void *data)
case VFCTRL_SEEK_RESET:
reset(vf);
return CONTROL_OK;
+ case VFCTRL_GET_METADATA:{
+ *(struct mp_tags*) data = *vf->priv->metadata;
+ return CONTROL_OK;
+ }
}
return CONTROL_UNKNOWN;
}