vdpau: add display property to GstVdpDecoder

This commit is contained in:
Carl-Anton Ingmarsson 2010-06-27 09:55:22 +02:00
parent ec815085bf
commit d930556a47
4 changed files with 63 additions and 94 deletions

View file

@ -25,18 +25,12 @@
G_BEGIN_DECLS
#define GST_TYPE_BASE_VIDEO_DECODER \
(gst_base_video_decoder_get_type())
#define GST_BASE_VIDEO_DECODER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoder))
#define GST_BASE_VIDEO_DECODER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoderClass))
#define GST_BASE_VIDEO_DECODER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_VIDEO_DECODER,GstBaseVideoDecoderClass))
#define GST_IS_BASE_VIDEO_DECODER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_VIDEO_DECODER))
#define GST_IS_BASE_VIDEO_DECODER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_VIDEO_DECODER))
#define GST_TYPE_BASE_VIDEO_DECODER (gst_base_video_decoder_get_type())
#define GST_BASE_VIDEO_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_BASE_VIDEO_DECODER, GstBaseVideoDecoder))
#define GST_BASE_VIDEO_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_BASE_VIDEO_DECODER, GstBaseVideoDecoderClass))
#define GST_BASE_VIDEO_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_BASE_VIDEO_DECODER, GstBaseVideoDecoderClass))
#define GST_IS_BASE_VIDEO_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_BASE_VIDEO_DECODER))
#define GST_IS_BASE_VIDEO_DECODER_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_BASE_VIDEO_DECODER))
/**
* GST_BASE_VIDEO_DECODER_SINK_NAME:

View file

@ -36,6 +36,12 @@ GST_DEBUG_CATEGORY_STATIC (gst_vdp_decoder_debug);
GST_BOILERPLATE_FULL (GstVdpDecoder, gst_vdp_decoder, GstBaseVideoDecoder,
GST_TYPE_BASE_VIDEO_DECODER, DEBUG_INIT);
enum
{
PROP_0,
PROP_DISPLAY
};
static GstFlowReturn
gst_vdp_decoder_shape_output (GstBaseVideoDecoder * base_video_decoder,
GstBuffer * buf)
@ -98,6 +104,42 @@ gst_vdp_decoder_get_device (GstVdpDecoder * vdp_decoder, GstVdpDevice ** device,
return gst_vdp_video_src_pad_get_device (vdp_pad, device, error);
}
static void
gst_vdp_decoder_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstVdpDecoder *vdp_decoder = GST_VDP_DECODER (object);
switch (prop_id) {
case PROP_DISPLAY:
g_object_get_property
(G_OBJECT (GST_BASE_VIDEO_DECODER_SRC_PAD (vdp_decoder)), "display",
value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_vdp_decoder_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstVdpDecoder *vdp_decoder = GST_VDP_DECODER (object);
switch (prop_id) {
case PROP_DISPLAY:
g_object_set_property
(G_OBJECT (GST_BASE_VIDEO_DECODER_SRC_PAD (vdp_decoder)), "display",
value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_vdp_decoder_base_init (gpointer g_class)
{
@ -121,9 +163,19 @@ gst_vdp_decoder_init (GstVdpDecoder * decoder, GstVdpDecoderClass * klass)
static void
gst_vdp_decoder_class_init (GstVdpDecoderClass * klass)
{
GstBaseVideoDecoderClass *base_video_decoder_class =
GST_BASE_VIDEO_DECODER_CLASS (klass);
GObjectClass *object_class;
GstBaseVideoDecoderClass *base_video_decoder_class;
object_class = G_OBJECT_CLASS (klass);
base_video_decoder_class = GST_BASE_VIDEO_DECODER_CLASS (klass);
object_class->get_property = gst_vdp_decoder_get_property;
object_class->set_property = gst_vdp_decoder_set_property;
base_video_decoder_class->create_srcpad = gst_vdp_decoder_create_srcpad;
base_video_decoder_class->shape_output = gst_vdp_decoder_shape_output;
g_object_class_install_property (object_class,
PROP_DISPLAY, g_param_spec_string ("display", "Display", "X Display name",
NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}

View file

@ -892,20 +892,12 @@ gst_vdp_h264_dec_init (GstVdpH264Dec * h264_dec, GstVdpH264DecClass * klass)
{
}
static void
gst_vdp_h264_dec_finalize (GObject * object)
{
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_vdp_h264_dec_class_init (GstVdpH264DecClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstBaseVideoDecoderClass *base_video_decoder_class =
GST_BASE_VIDEO_DECODER_CLASS (klass);
GstBaseVideoDecoderClass *base_video_decoder_class;
gobject_class->finalize = gst_vdp_h264_dec_finalize;
base_video_decoder_class = GST_BASE_VIDEO_DECODER_CLASS (klass);
base_video_decoder_class->start = gst_vdp_h264_dec_start;
base_video_decoder_class->stop = gst_vdp_h264_dec_stop;

View file

@ -47,19 +47,6 @@
GST_DEBUG_CATEGORY_STATIC (gst_vdp_mpeg_dec_debug);
#define GST_CAT_DEFAULT gst_vdp_mpeg_dec_debug
/* Filter signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
PROP_0,
PROP_DISPLAY
};
/* the capabilities of the inputs and outputs.
*
* describe the real formats here.
@ -701,50 +688,6 @@ gst_vdp_mpeg_dec_stop (GstBaseVideoDecoder * base_video_decoder)
return TRUE;
}
/* GObject vmethod implementations */
static void
gst_vdp_mpeg_dec_finalize (GObject * object)
{
}
static void
gst_vdp_mpeg_dec_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstVdpMpegDec *mpeg_dec = (GstVdpMpegDec *) object;
switch (prop_id) {
case PROP_DISPLAY:
g_object_get_property
(G_OBJECT (GST_BASE_VIDEO_DECODER_SRC_PAD (mpeg_dec)), "display",
value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_vdp_mpeg_dec_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstVdpMpegDec *mpeg_dec = (GstVdpMpegDec *) object;
switch (prop_id) {
case PROP_DISPLAY:
g_object_set_property
(G_OBJECT (GST_BASE_VIDEO_DECODER_SRC_PAD (mpeg_dec)), "display",
value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_vdp_mpeg_dec_base_init (gpointer gclass)
{
@ -764,17 +707,9 @@ gst_vdp_mpeg_dec_base_init (gpointer gclass)
static void
gst_vdp_mpeg_dec_class_init (GstVdpMpegDecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstBaseVideoDecoderClass *base_video_decoder_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
base_video_decoder_class = (GstBaseVideoDecoderClass *) klass;
gobject_class->get_property = gst_vdp_mpeg_dec_get_property;
gobject_class->set_property = gst_vdp_mpeg_dec_set_property;
gobject_class->finalize = gst_vdp_mpeg_dec_finalize;
base_video_decoder_class = GST_BASE_VIDEO_DECODER_CLASS (klass);
base_video_decoder_class->start = gst_vdp_mpeg_dec_start;
base_video_decoder_class->stop = gst_vdp_mpeg_dec_stop;
@ -787,10 +722,6 @@ gst_vdp_mpeg_dec_class_init (GstVdpMpegDecClass * klass)
base_video_decoder_class->handle_frame = gst_vdp_mpeg_dec_handle_frame;
base_video_decoder_class->create_frame = gst_vdp_mpeg_dec_create_frame;
g_object_class_install_property (gobject_class,
PROP_DISPLAY, g_param_spec_string ("display", "Display", "X Display name",
NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}
static void