video/audio meta: transform_func: return FALSE if not supported or failed

https://bugzilla.gnome.org/show_bug.cgi?id=751778
This commit is contained in:
Hyunjun Ko 2015-07-07 22:23:57 +09:00 committed by Sebastian Dröge
parent efdb0fc281
commit 9dc463346e
3 changed files with 40 additions and 4 deletions

View file

@ -59,12 +59,20 @@ static gboolean
gst_audio_downmix_meta_transform (GstBuffer * dest, GstMeta * meta,
GstBuffer * buffer, GQuark type, gpointer data)
{
GstAudioDownmixMeta *smeta;
GstAudioDownmixMeta *smeta, *dmeta;
smeta = (GstAudioDownmixMeta *) meta;
gst_buffer_add_audio_downmix_meta (dest, smeta->from_position,
if (GST_META_TRANSFORM_IS_COPY (type)) {
dmeta = gst_buffer_add_audio_downmix_meta (dest, smeta->from_position,
smeta->from_channels, smeta->to_position, smeta->to_channels,
(const gfloat **) smeta->matrix);
if (!dmeta)
return FALSE;
} else {
/* return FALSE, if transform type is not supported */
return FALSE;
}
return TRUE;
}

View file

@ -59,6 +59,9 @@ gst_video_meta_transform (GstBuffer * dest, GstMeta * meta,
dmeta->map = smeta->map;
dmeta->unmap = smeta->unmap;
}
} else {
/* return FALSE, if transform type is not supported */
return FALSE;
}
return TRUE;
}
@ -347,6 +350,8 @@ gst_video_crop_meta_transform (GstBuffer * dest, GstMeta * meta,
if (GST_META_TRANSFORM_IS_COPY (type)) {
smeta = (GstVideoCropMeta *) meta;
dmeta = gst_buffer_add_video_crop_meta (dest);
if (!dmeta)
return FALSE;
GST_DEBUG ("copy crop metadata");
dmeta->x = smeta->x;
@ -359,6 +364,8 @@ gst_video_crop_meta_transform (GstBuffer * dest, GstMeta * meta,
smeta = (GstVideoCropMeta *) meta;
dmeta = gst_buffer_add_video_crop_meta (dest);
if (!dmeta)
return FALSE;
ow = GST_VIDEO_INFO_WIDTH (trans->in_info);
nw = GST_VIDEO_INFO_WIDTH (trans->out_info);
@ -374,6 +381,9 @@ gst_video_crop_meta_transform (GstBuffer * dest, GstMeta * meta,
dmeta->y);
GST_DEBUG ("crop size %dx%d -> %dx%d", smeta->width, smeta->height,
dmeta->width, dmeta->height);
} else {
/* return FALSE, if transform type is not supported */
return FALSE;
}
return TRUE;
}
@ -484,6 +494,9 @@ gst_video_gl_texture_upload_meta_transform (GstBuffer * dest, GstMeta * meta,
if (dmeta->user_data_copy)
dmeta->user_data = dmeta->user_data_copy (dmeta->user_data);
}
} else {
/* return FALSE, if transform type is not supported */
return FALSE;
}
return TRUE;
}
@ -606,6 +619,9 @@ gst_video_region_of_interest_meta_transform (GstBuffer * dest, GstMeta * meta,
dmeta =
gst_buffer_add_video_region_of_interest_meta_id (dest,
smeta->roi_type, smeta->x, smeta->y, smeta->w, smeta->h);
if (!dmeta)
return FALSE;
dmeta->id = smeta->id;
dmeta->parent_id = smeta->parent_id;
} else if (GST_VIDEO_META_TRANSFORM_IS_SCALE (type)) {
@ -623,6 +639,9 @@ gst_video_region_of_interest_meta_transform (GstBuffer * dest, GstMeta * meta,
gst_buffer_add_video_region_of_interest_meta_id (dest,
smeta->roi_type, (smeta->x * nw) / ow, (smeta->y * nh) / oh,
(smeta->w * nw) / ow, (smeta->h * nh) / oh);
if (!dmeta)
return FALSE;
dmeta->id = smeta->id;
dmeta->parent_id = smeta->parent_id;
@ -630,6 +649,9 @@ gst_video_region_of_interest_meta_transform (GstBuffer * dest, GstMeta * meta,
smeta->id, smeta->parent_id, smeta->x, smeta->y, dmeta->x, dmeta->y);
GST_DEBUG ("region of interest size %dx%d -> %dx%d", smeta->w, smeta->h,
dmeta->w, dmeta->h);
} else {
/* return FALSE, if transform type is not supported */
return FALSE;
}
return TRUE;
}

View file

@ -215,8 +215,14 @@ gst_video_overlay_composition_meta_transform (GstBuffer * dest, GstMeta * meta,
dmeta =
(GstVideoOverlayCompositionMeta *) gst_buffer_add_meta (dest,
GST_VIDEO_OVERLAY_COMPOSITION_META_INFO, NULL);
if (!dmeta)
return FALSE;
dmeta->overlay = gst_video_overlay_composition_ref (smeta->overlay);
}
} else {
/* return FALSE, if transform type is not supported */
return FALSE;
}
return TRUE;
}