mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
vdpau: extract mpeg version
This commit is contained in:
parent
367708e2ae
commit
090638ccec
4 changed files with 40 additions and 23 deletions
|
@ -286,6 +286,7 @@ static gboolean
|
||||||
gst_vdpaudecoder_sink_set_caps (GstPad * pad, GstCaps * caps)
|
gst_vdpaudecoder_sink_set_caps (GstPad * pad, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstVdpauDecoder *dec = GST_VDPAU_DECODER (GST_OBJECT_PARENT (pad));
|
GstVdpauDecoder *dec = GST_VDPAU_DECODER (GST_OBJECT_PARENT (pad));
|
||||||
|
GstVdpauDecoderClass *dec_class = GST_VDPAU_DECODER_GET_CLASS (dec);
|
||||||
|
|
||||||
GstCaps *src_caps, *new_caps;
|
GstCaps *src_caps, *new_caps;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
@ -324,6 +325,9 @@ gst_vdpaudecoder_sink_set_caps (GstPad * pad, GstCaps * caps)
|
||||||
dec->height = height;
|
dec->height = height;
|
||||||
dec->format = fourcc_format;
|
dec->format = fourcc_format;
|
||||||
|
|
||||||
|
if (dec_class->set_caps && !dec_class->set_caps (dec, caps))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +408,7 @@ gst_vdpaudecoder_init (GstVdpauDecoder * dec, GstVdpauDecoderClass * klass)
|
||||||
(GST_ELEMENT_CLASS (klass), "sink"), "sink");
|
(GST_ELEMENT_CLASS (klass), "sink"), "sink");
|
||||||
gst_pad_set_setcaps_function (dec->sink, gst_vdpaudecoder_sink_set_caps);
|
gst_pad_set_setcaps_function (dec->sink, gst_vdpaudecoder_sink_set_caps);
|
||||||
gst_element_add_pad (GST_ELEMENT (dec), dec->sink);
|
gst_element_add_pad (GST_ELEMENT (dec), dec->sink);
|
||||||
|
gst_pad_set_active (dec->sink, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -29,16 +29,12 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GST_TYPE_VDPAU_DECODER \
|
#define GST_TYPE_VDPAU_DECODER (gst_vdpaudecoder_get_type())
|
||||||
(gst_vdpaudecoder_get_type())
|
#define GST_VDPAU_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VDPAU_DECODER,GstVdpauDecoder))
|
||||||
#define GST_VDPAU_DECODER(obj) \
|
#define GST_VDPAU_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VDPAU_DECODER,GstVdpauDecoderClass))
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VDPAU_DECODER,GstVdpauDecoder))
|
#define GST_VDPAU_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VDPAU_DECODER, GstVdpauDecoderClass))
|
||||||
#define GST_VDPAU_DECODER_CLASS(klass) \
|
#define GST_IS_VDPAU_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VDPAU_DECODER))
|
||||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VDPAU_DECODER,GstVdpauDecoderClass))
|
#define GST_IS_VDPAU_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VDPAU_DECODER))
|
||||||
#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 _GstVdpauDecoder GstVdpauDecoder;
|
||||||
typedef struct _GstVdpauDecoderClass GstVdpauDecoderClass;
|
typedef struct _GstVdpauDecoderClass GstVdpauDecoderClass;
|
||||||
|
@ -62,6 +58,8 @@ struct _GstVdpauDecoder {
|
||||||
|
|
||||||
struct _GstVdpauDecoderClass {
|
struct _GstVdpauDecoderClass {
|
||||||
GstBaseTransformClass parent_class;
|
GstBaseTransformClass parent_class;
|
||||||
|
|
||||||
|
gboolean (*set_caps) (GstVdpauDecoder *dec, GstCaps *caps);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_vdpaudecoder_get_type (void);
|
GType gst_vdpaudecoder_get_type (void);
|
||||||
|
|
|
@ -87,7 +87,8 @@ enum
|
||||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
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,
|
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,
|
static void gst_vdpau_mpeg_decoder_get_property (GObject * object,
|
||||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
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 */
|
/* GObject vmethod implementations */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -121,9 +136,11 @@ gst_vdpau_mpeg_decoder_class_init (GstVdpauMpegDecoderClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
GstElementClass *gstelement_class;
|
GstElementClass *gstelement_class;
|
||||||
|
GstVdpauDecoderClass *vdpaudec_class;
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) klass;
|
gobject_class = (GObjectClass *) klass;
|
||||||
gstelement_class = (GstElementClass *) klass;
|
gstelement_class = (GstElementClass *) klass;
|
||||||
|
vdpaudec_class = (GstVdpauDecoderClass *) klass;
|
||||||
|
|
||||||
gobject_class->set_property = gst_vdpau_mpeg_decoder_set_property;
|
gobject_class->set_property = gst_vdpau_mpeg_decoder_set_property;
|
||||||
gobject_class->get_property = gst_vdpau_mpeg_decoder_get_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_object_class_install_property (gobject_class, PROP_SILENT,
|
||||||
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
|
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
|
||||||
FALSE, G_PARAM_READWRITE));
|
FALSE, G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
vdpaudec_class->set_caps = gst_vdpau_mpeg_decoder_set_caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -53,16 +53,11 @@
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/* #defines don't like whitespacey bits */
|
/* #defines don't like whitespacey bits */
|
||||||
#define GST_TYPE_VDPAU_MPEG_DECODER \
|
#define GST_TYPE_VDPAU_MPEG_DECODER (gst_vdpau_mpeg_decoder_get_type())
|
||||||
(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(obj) \
|
#define GST_VDPAU_MPEG_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VDPAU_MPEG_DECODER,GstVdpauMpegDecoderClass))
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VDPAU_MPEG_DECODER,GstVdpauMpegDecoder))
|
#define GST_IS_VDPAU_MPEG_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VDPAU_MPEG_DECODER))
|
||||||
#define GST_VDPAU_MPEG_DECODER_CLASS(klass) \
|
#define GST_IS_VDPAU_MPEG_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VDPAU_MPEG_DECODER))
|
||||||
(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 _GstVdpauMpegDecoder GstVdpauMpegDecoder;
|
||||||
typedef struct _GstVdpauMpegDecoderClass GstVdpauMpegDecoderClass;
|
typedef struct _GstVdpauMpegDecoderClass GstVdpauMpegDecoderClass;
|
||||||
|
@ -71,9 +66,9 @@ struct _GstVdpauMpegDecoder
|
||||||
{
|
{
|
||||||
GstVdpauDecoder dec;
|
GstVdpauDecoder dec;
|
||||||
|
|
||||||
GstPad *sinkpad, *srcpad;
|
|
||||||
|
|
||||||
gboolean silent;
|
gboolean silent;
|
||||||
|
|
||||||
|
gint version;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstVdpauMpegDecoderClass
|
struct _GstVdpauMpegDecoderClass
|
||||||
|
|
Loading…
Reference in a new issue