mpegvideometa: add meta transform function

https://bugzilla.gnome.org/show_bug.cgi?id=751778
This commit is contained in:
Hyunjun Ko 2015-07-07 10:56:47 +09:00 committed by Sebastian Dröge
parent ba18bc5398
commit aae9119d97

View file

@ -60,6 +60,38 @@ gst_mpeg_video_meta_free (GstMpegVideoMeta * mpeg_video_meta,
g_slice_free (GstMpegVideoQuantMatrixExt, mpeg_video_meta->quantext); g_slice_free (GstMpegVideoQuantMatrixExt, mpeg_video_meta->quantext);
} }
static gboolean
gst_mpeg_video_meta_transform (GstBuffer * dest, GstMeta * meta,
GstBuffer * buffer, GQuark type, gpointer data)
{
GstMpegVideoMeta *smeta, *dmeta;
smeta = (GstMpegVideoMeta *) meta;
if (GST_META_TRANSFORM_IS_COPY (type)) {
GstMetaTransformCopy *copy = data;
if (!copy->region) {
/* only copy if the complete data is copied as well */
dmeta =
gst_buffer_add_mpeg_video_meta (dest, smeta->sequencehdr,
smeta->sequenceext, smeta->sequencedispext, smeta->pichdr,
smeta->picext, smeta->quantext);
if (!dmeta)
return FALSE;
dmeta->num_slices = smeta->num_slices;
dmeta->slice_offset = smeta->slice_offset;
}
} else {
/* return FALSE, if transform type is not supported */
return FALSE;
}
return TRUE;
}
GType GType
gst_mpeg_video_meta_api_get_type (void) gst_mpeg_video_meta_api_get_type (void)
{ {
@ -86,7 +118,7 @@ gst_mpeg_video_meta_get_info (void)
"GstMpegVideoMeta", sizeof (GstMpegVideoMeta), "GstMpegVideoMeta", sizeof (GstMpegVideoMeta),
(GstMetaInitFunction) gst_mpeg_video_meta_init, (GstMetaInitFunction) gst_mpeg_video_meta_init,
(GstMetaFreeFunction) gst_mpeg_video_meta_free, (GstMetaFreeFunction) gst_mpeg_video_meta_free,
(GstMetaTransformFunction) NULL); (GstMetaTransformFunction) gst_mpeg_video_meta_transform);
g_once_init_leave (&mpeg_video_meta_info, meta); g_once_init_leave (&mpeg_video_meta_info, meta);
} }