mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
video: Rename gst_video_codec_frame_set_hook() to gst_video_codec_frame_set_user_data()
And also add a getter and allow to set NULL user_data but still call the passed destroy notify.
This commit is contained in:
parent
c1bc70300d
commit
ed6d46e156
4 changed files with 42 additions and 24 deletions
|
@ -2240,7 +2240,8 @@ GST_VIDEO_CODEC_FRAME_UNSET_FORCE_KEYFRAME_HEADERS
|
|||
GST_VIDEO_CODEC_FRAME_UNSET_SYNC_POINT
|
||||
gst_video_codec_frame_ref
|
||||
gst_video_codec_frame_unref
|
||||
gst_video_codec_frame_set_hook
|
||||
gst_video_codec_frame_set_user_data
|
||||
gst_video_codec_frame_get_user_data
|
||||
GstVideoCodecState
|
||||
gst_video_codec_state_ref
|
||||
gst_video_codec_state_unref
|
||||
|
|
|
@ -49,33 +49,48 @@ _gst_video_codec_frame_free (GstVideoCodecFrame * frame)
|
|||
g_list_foreach (frame->events, (GFunc) gst_event_unref, NULL);
|
||||
g_list_free (frame->events);
|
||||
|
||||
if (frame->coder_hook_destroy_notify && frame->coder_hook)
|
||||
frame->coder_hook_destroy_notify (frame->coder_hook);
|
||||
if (frame->user_data_destroy_notify)
|
||||
frame->user_data_destroy_notify (frame->user_data);
|
||||
|
||||
g_slice_free (GstVideoCodecFrame, frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_video_codec_frame_set_hook:
|
||||
* gst_video_codec_frame_set_user_data:
|
||||
* @frame: a #GstVideoCodecFrame
|
||||
* @hook: private data
|
||||
* @notify: (closure hook): a #GDestroyNotify
|
||||
* @user_data: private data
|
||||
* @notify: (closure user_data): a #GDestroyNotify
|
||||
*
|
||||
* Sets the #GDestroyNotify that will be called (along with the @hook) when
|
||||
* the frame is freed.
|
||||
* Sets @user_data on the frame and the #GDestroyNotify that will be called when
|
||||
* the frame is freed. Allows to attach private data by the subclass to frames.
|
||||
*
|
||||
* If a @hook was previously set, then the previous set @notify will be called
|
||||
* before the @hook is replaced.
|
||||
* If a @user_data was previously set, then the previous set @notify will be called
|
||||
* before the @user_data is replaced.
|
||||
*/
|
||||
void
|
||||
gst_video_codec_frame_set_hook (GstVideoCodecFrame * frame, void *hook,
|
||||
GDestroyNotify notify)
|
||||
gst_video_codec_frame_set_user_data (GstVideoCodecFrame * frame,
|
||||
gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
if (frame->coder_hook_destroy_notify && frame->coder_hook)
|
||||
frame->coder_hook_destroy_notify (frame->coder_hook);
|
||||
if (frame->user_data_destroy_notify)
|
||||
frame->user_data_destroy_notify (frame->user_data);
|
||||
|
||||
frame->coder_hook = hook;
|
||||
frame->coder_hook_destroy_notify = notify;
|
||||
frame->user_data = user_data;
|
||||
frame->user_data_destroy_notify = notify;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_video_codec_frame_get_user_data:
|
||||
* @frame: a #GstVideoCodecFrame
|
||||
*
|
||||
* Gets private data set on the frame by the subclass via
|
||||
* gst_video_codec_frame_set_user_data() previously.
|
||||
*
|
||||
* Returns: (transfer none): The previously set user_data
|
||||
*/
|
||||
gpointer
|
||||
gst_video_codec_frame_get_user_data (GstVideoCodecFrame * frame)
|
||||
{
|
||||
return frame->user_data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -236,14 +236,14 @@ struct _GstVideoCodecFrame
|
|||
|
||||
GstClockTime deadline; /* D */
|
||||
|
||||
/*< private >*/
|
||||
|
||||
/* Events that should be pushed downstream *before*
|
||||
* the next output_buffer */
|
||||
GList *events; /* ED */
|
||||
|
||||
/*< private >*/
|
||||
|
||||
void *coder_hook;
|
||||
GDestroyNotify coder_hook_destroy_notify;
|
||||
gpointer user_data;
|
||||
GDestroyNotify user_data_destroy_notify;
|
||||
|
||||
void *padding[GST_PADDING_LARGE];
|
||||
};
|
||||
|
@ -261,9 +261,10 @@ GType gst_video_codec_frame_get_type (void);
|
|||
|
||||
GstVideoCodecFrame *gst_video_codec_frame_ref (GstVideoCodecFrame * frame);
|
||||
void gst_video_codec_frame_unref (GstVideoCodecFrame * frame);
|
||||
void gst_video_codec_frame_set_hook (GstVideoCodecFrame *frame,
|
||||
void *hook,
|
||||
GDestroyNotify notify);
|
||||
void gst_video_codec_frame_set_user_data (GstVideoCodecFrame *frame,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
gpointer gst_video_codec_frame_get_user_data (GstVideoCodecFrame *frame);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -50,8 +50,9 @@ EXPORTS
|
|||
gst_video_calculate_display_ratio
|
||||
gst_video_chroma_site_get_type
|
||||
gst_video_codec_frame_get_type
|
||||
gst_video_codec_frame_get_user_data
|
||||
gst_video_codec_frame_ref
|
||||
gst_video_codec_frame_set_hook
|
||||
gst_video_codec_frame_set_user_data
|
||||
gst_video_codec_frame_unref
|
||||
gst_video_codec_state_get_type
|
||||
gst_video_codec_state_ref
|
||||
|
|
Loading…
Reference in a new issue