GstVdpH264Frame *frame = frames[i];
reference_frames[i].surface =
- GST_VDP_VIDEO_BUFFER (GST_VIDEO_FRAME_CAST (frame)->src_buffer)->
- surface;
+ GST_VDP_VIDEO_BUFFER (GST_VIDEO_FRAME_CAST (frame)->
+ src_buffer)->surface;
reference_frames[i].is_long_term = frame->is_long_term;
reference_frames[i].top_is_reference = frame->is_reference;
GstVdpH264Frame *frame = dpb->frames[idx];
gst_video_frame_ref (GST_VIDEO_FRAME_CAST (frame));
- dpb->output (dpb, frame);
+ dpb->output (dpb, frame, dpb->user_data);
frame->output_needed = FALSE;
if (!frame->is_reference)
else {
while (gst_h264_dpb_bump (dpb, h264_frame->poc));
- dpb->output (dpb, h264_frame);
+ dpb->output (dpb, h264_frame, dpb->user_data);
}
return TRUE;
}
+void
+gst_h264_dpb_set_output_func (GstH264DPB * dpb, GstH264DPBOutputFunc func,
+ gpointer user_data)
+{
+ g_return_if_fail (GST_IS_H264_DPB (dpb));
+
+ dpb->output = func;
+ dpb->user_data = user_data;
+}
+
/* GObject vmethod implementations */
static void
gst_h264_dpb_get_property (GObject * object, guint property_id,
typedef struct _GstH264DPB GstH264DPB;
typedef struct _GstH264DPBClass GstH264DPBClass;
+typedef void (*GstH264DPBOutputFunc) (GstH264DPB *dpb, GstVdpH264Frame *h264_frame, gpointer user_data);
+
struct _GstH264DPB
{
GObject parent_instance;
+ /* private */
GstVdpH264Frame *frames[MAX_DPB_SIZE];
guint n_frames;
guint max_frames;
gint max_longterm_frame_idx;
- void (*output) (GstH264DPB *dpb, GstVdpH264Frame *h264_frame);
+ GstH264DPBOutputFunc output;
+ gpointer user_data;
};
struct _GstH264DPBClass
void gst_h264_dpb_mark_all_unused (GstH264DPB *dpb);
void gst_h264_dpb_mark_long_term (GstH264DPB *dpb, guint16 pic_num, guint16 long_term_frame_idx);
+void gst_h264_dpb_set_output_func (GstH264DPB *dpb, GstH264DPBOutputFunc func,
+ gpointer user_data);
+
GType gst_h264_dpb_get_type (void) G_GNUC_CONST;
G_END_DECLS
}
static void
-gst_vdp_h264_dec_output (GstH264DPB * dpb, GstVdpH264Frame * h264_frame)
+gst_vdp_h264_dec_output (GstH264DPB * dpb, GstVdpH264Frame * h264_frame,
+ gpointer user_data)
{
- GstBaseVideoDecoder *base_video_decoder;
+ GstBaseVideoDecoder *base_video_decoder = (GstBaseVideoDecoder *) user_data;
GST_DEBUG ("poc: %d", h264_frame->poc);
- base_video_decoder = g_object_get_data (G_OBJECT (dpb), "decoder");
gst_base_video_decoder_finish_frame (base_video_decoder,
GST_VIDEO_FRAME_CAST (h264_frame));
}
h264_dec->parser = g_object_new (GST_TYPE_H264_PARSER, NULL);
h264_dec->dpb = g_object_new (GST_TYPE_H264_DPB, NULL);
- g_object_set_data (G_OBJECT (h264_dec->dpb), "decoder", h264_dec);
- h264_dec->dpb->output = gst_vdp_h264_dec_output;
+ gst_h264_dpb_set_output_func (h264_dec->dpb, gst_vdp_h264_dec_output,
+ h264_dec);
return TRUE;
}