summaryrefslogtreecommitdiffstats
path: root/sys/vdpau
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2009-03-26 21:04:48 +0100
committerJan Schmidt <thaytan@noraisin.net>2009-06-20 15:21:21 +0100
commit090638ccec59cebb11327d12ebcff78015716bed (patch)
tree03510134c1a46dfe34d165313a743884d9459502 /sys/vdpau
parent367708e2ae7435fab215fd93b31234e553220c77 (diff)
downloadgst-plugins-bad-090638ccec59cebb11327d12ebcff78015716bed.tar.gz
gst-plugins-bad-090638ccec59cebb11327d12ebcff78015716bed.tar.bz2
gst-plugins-bad-090638ccec59cebb11327d12ebcff78015716bed.zip
vdpau: extract mpeg version
Diffstat (limited to 'sys/vdpau')
-rw-r--r--sys/vdpau/gstvdpaudecoder.c5
-rw-r--r--sys/vdpau/gstvdpaudecoder.h18
-rw-r--r--sys/vdpau/gstvdpaumpegdecoder.c21
-rw-r--r--sys/vdpau/gstvdpaumpegdecoder.h19
4 files changed, 40 insertions, 23 deletions
diff --git a/sys/vdpau/gstvdpaudecoder.c b/sys/vdpau/gstvdpaudecoder.c
index 36d6eca0..36a566e0 100644
--- a/sys/vdpau/gstvdpaudecoder.c
+++ b/sys/vdpau/gstvdpaudecoder.c
@@ -286,6 +286,7 @@ static gboolean
gst_vdpaudecoder_sink_set_caps (GstPad * pad, GstCaps * caps)
{
GstVdpauDecoder *dec = GST_VDPAU_DECODER (GST_OBJECT_PARENT (pad));
+ GstVdpauDecoderClass *dec_class = GST_VDPAU_DECODER_GET_CLASS (dec);
GstCaps *src_caps, *new_caps;
GstStructure *structure;
@@ -324,6 +325,9 @@ gst_vdpaudecoder_sink_set_caps (GstPad * pad, GstCaps * caps)
dec->height = height;
dec->format = fourcc_format;
+ if (dec_class->set_caps && !dec_class->set_caps (dec, caps))
+ return FALSE;
+
return TRUE;
}
@@ -404,6 +408,7 @@ gst_vdpaudecoder_init (GstVdpauDecoder * dec, GstVdpauDecoderClass * klass)
(GST_ELEMENT_CLASS (klass), "sink"), "sink");
gst_pad_set_setcaps_function (dec->sink, gst_vdpaudecoder_sink_set_caps);
gst_element_add_pad (GST_ELEMENT (dec), dec->sink);
+ gst_pad_set_active (dec->sink, TRUE);
}
static void
diff --git a/sys/vdpau/gstvdpaudecoder.h b/sys/vdpau/gstvdpaudecoder.h
index 336e4b8a..d8b8aa33 100644
--- a/sys/vdpau/gstvdpaudecoder.h
+++ b/sys/vdpau/gstvdpaudecoder.h
@@ -29,16 +29,12 @@
G_BEGIN_DECLS
-#define GST_TYPE_VDPAU_DECODER \
- (gst_vdpaudecoder_get_type())
-#define GST_VDPAU_DECODER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VDPAU_DECODER,GstVdpauDecoder))
-#define GST_VDPAU_DECODER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VDPAU_DECODER,GstVdpauDecoderClass))
-#define GST_IS_VDPAU_DECODER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VDPAU_DECODER))
-#define GST_IS_VDPAU_DECODER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VDPAU_DECODER))
+#define GST_TYPE_VDPAU_DECODER (gst_vdpaudecoder_get_type())
+#define GST_VDPAU_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VDPAU_DECODER,GstVdpauDecoder))
+#define GST_VDPAU_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VDPAU_DECODER,GstVdpauDecoderClass))
+#define GST_VDPAU_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VDPAU_DECODER, GstVdpauDecoderClass))
+#define GST_IS_VDPAU_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VDPAU_DECODER))
+#define GST_IS_VDPAU_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VDPAU_DECODER))
typedef struct _GstVdpauDecoder GstVdpauDecoder;
typedef struct _GstVdpauDecoderClass GstVdpauDecoderClass;
@@ -62,6 +58,8 @@ struct _GstVdpauDecoder {
struct _GstVdpauDecoderClass {
GstBaseTransformClass parent_class;
+
+ gboolean (*set_caps) (GstVdpauDecoder *dec, GstCaps *caps);
};
GType gst_vdpaudecoder_get_type (void);
diff --git a/sys/vdpau/gstvdpaumpegdecoder.c b/sys/vdpau/gstvdpaumpegdecoder.c
index c22c27f3..380cf602 100644
--- a/sys/vdpau/gstvdpaumpegdecoder.c
+++ b/sys/vdpau/gstvdpaumpegdecoder.c
@@ -87,7 +87,8 @@ enum
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-mpeg, mpegversion = (int) [ 1, 2 ]")
+ GST_STATIC_CAPS ("video/mpeg, mpegversion = (int) [ 1, 2 ], "
+ "systemstream = (boolean) false")
);
GST_BOILERPLATE (GstVdpauMpegDecoder, gst_vdpau_mpeg_decoder, GstVdpauDecoder,
@@ -98,6 +99,20 @@ static void gst_vdpau_mpeg_decoder_set_property (GObject * object,
static void gst_vdpau_mpeg_decoder_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
+static gboolean
+gst_vdpau_mpeg_decoder_set_caps (GstVdpauDecoder * dec, GstCaps * caps)
+{
+ GstVdpauMpegDecoder *mpeg_dec;
+ GstStructure *structure;
+
+ mpeg_dec = GST_VDPAU_MPEG_DECODER (dec);
+
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "mpegversion", &mpeg_dec->version);
+
+ return TRUE;
+}
+
/* GObject vmethod implementations */
static void
@@ -121,9 +136,11 @@ gst_vdpau_mpeg_decoder_class_init (GstVdpauMpegDecoderClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
+ GstVdpauDecoderClass *vdpaudec_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
+ vdpaudec_class = (GstVdpauDecoderClass *) klass;
gobject_class->set_property = gst_vdpau_mpeg_decoder_set_property;
gobject_class->get_property = gst_vdpau_mpeg_decoder_get_property;
@@ -131,6 +148,8 @@ gst_vdpau_mpeg_decoder_class_init (GstVdpauMpegDecoderClass * klass)
g_object_class_install_property (gobject_class, PROP_SILENT,
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
FALSE, G_PARAM_READWRITE));
+
+ vdpaudec_class->set_caps = gst_vdpau_mpeg_decoder_set_caps;
}
static void
diff --git a/sys/vdpau/gstvdpaumpegdecoder.h b/sys/vdpau/gstvdpaumpegdecoder.h
index 14c9a3f7..97462942 100644
--- a/sys/vdpau/gstvdpaumpegdecoder.h
+++ b/sys/vdpau/gstvdpaumpegdecoder.h
@@ -53,16 +53,11 @@
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
-#define GST_TYPE_VDPAU_MPEG_DECODER \
- (gst_vdpau_mpeg_decoder_get_type())
-#define GST_VDPAU_MPEG_DECODER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VDPAU_MPEG_DECODER,GstVdpauMpegDecoder))
-#define GST_VDPAU_MPEG_DECODER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VDPAU_MPEG_DECODER,GstVdpauMpegDecoderClass))
-#define GST_IS_VDPAU_MPEG_DECODER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VDPAU_MPEG_DECODER))
-#define GST_IS_VDPAU_MPEG_DECODER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VDPAU_MPEG_DECODER))
+#define GST_TYPE_VDPAU_MPEG_DECODER (gst_vdpau_mpeg_decoder_get_type())
+#define GST_VDPAU_MPEG_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VDPAU_MPEG_DECODER,GstVdpauMpegDecoder))
+#define GST_VDPAU_MPEG_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VDPAU_MPEG_DECODER,GstVdpauMpegDecoderClass))
+#define GST_IS_VDPAU_MPEG_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VDPAU_MPEG_DECODER))
+#define GST_IS_VDPAU_MPEG_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VDPAU_MPEG_DECODER))
typedef struct _GstVdpauMpegDecoder GstVdpauMpegDecoder;
typedef struct _GstVdpauMpegDecoderClass GstVdpauMpegDecoderClass;
@@ -71,9 +66,9 @@ struct _GstVdpauMpegDecoder
{
GstVdpauDecoder dec;
- GstPad *sinkpad, *srcpad;
-
gboolean silent;
+
+ gint version;
};
struct _GstVdpauMpegDecoderClass