vdpau: add GstVdpDecoder base class
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
Sat, 26 Jun 2010 19:02:53 +0000 (21:02 +0200)
committerCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
Sat, 26 Jun 2010 19:27:32 +0000 (21:27 +0200)
sys/vdpau/Makefile.am
sys/vdpau/gstvdp/Makefile.am
sys/vdpau/gstvdp/gstvdp.c
sys/vdpau/gstvdp/gstvdpdecoder.c [new file with mode: 0644]
sys/vdpau/gstvdp/gstvdpdecoder.h [new file with mode: 0644]
sys/vdpau/h264/gstvdph264dec.c
sys/vdpau/h264/gstvdph264dec.h
sys/vdpau/mpeg/gstvdpmpegdec.c
sys/vdpau/mpeg/gstvdpmpegdec.h

index 5875caf..687534b 100644 (file)
@@ -20,7 +20,6 @@ libgstvdpau_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(X11_CFLAGS) $
 libgstvdpau_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) \
        $(GST_PLUGINS_BASE_LIBS) $(X11_LIBS) -lgstvideo-$(GST_MAJORMINOR) \
        -lgstinterfaces-$(GST_MAJORMINOR) $(VDPAU_LIBS) \
-       basevideodecoder/libgstbasevideodecoder.la \
        gstvdp/libgstvdp-@GST_MAJORMINOR@.la
        
 libgstvdpau_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
index a4d2a7b..4f18847 100644 (file)
@@ -7,6 +7,7 @@ libgstvdp_@GST_MAJORMINOR@_la_SOURCES = \
        gstvdpoutputbuffer.c \
        gstvdpvideosrcpad.c \
        gstvdpoutputsrcpad.c \
+       gstvdpdecoder.c \
        gstvdp.c 
        
 libgstvdp_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/vdpau
@@ -16,13 +17,15 @@ libgstvdp_@GST_MAJORMINOR@include_HEADERS = \
        gstvdpoutputbuffer.h \
        gstvdpvideosrcpad.h \
        gstvdpoutputsrcpad.h \
+       gstvdpdecoder.h \
        gstvdp.h
  
 libgstvdp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
        $(GST_PLUGINS_BASE_CFLAGS) $(X11_CFLAGS) $(VDPAU_CFLAGS)
   
 libgstvdp_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(X11_LIBS) $(VDPAU_LIBS) \
-       -lgstvideo-$(GST_MAJORMINOR)
+       -lgstvideo-$(GST_MAJORMINOR) \
+       ../basevideodecoder/libgstbasevideodecoder.la
   
 libgstvdp_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_LT_LDFLAGS) $(GST_ALL_LDFLAGS)
 libgstvdp_@GST_MAJORMINOR@_la_LIBTOOLFLAGS = --tag=disable-static
\ No newline at end of file
index 8d927a1..42f0fc6 100644 (file)
@@ -25,6 +25,7 @@
 #include "gstvdpvideosrcpad.h"
 #include "gstvdpoutputbuffer.h"
 #include "gstvdpoutputsrcpad.h"
+#include "gstvdpdecoder.h"
 
 #include "gstvdp.h"
 
@@ -39,6 +40,7 @@ gst_vdp_init (void)
   gst_vdp_video_buffer_get_type ();
   gst_vdp_video_src_pad_get_type ();
   gst_vdp_output_src_pad_get_type ();
+  gst_vdp_decoder_get_type ();
 
   GST_DEBUG_CATEGORY_INIT (gst_vdp_debug, "vdp", 0, "GstVdp debug category");
 }
diff --git a/sys/vdpau/gstvdp/gstvdpdecoder.c b/sys/vdpau/gstvdp/gstvdpdecoder.c
new file mode 100644 (file)
index 0000000..841a693
--- /dev/null
@@ -0,0 +1,116 @@
+/* GStreamer
+*
+* Copyright (C) 2009 Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Library General Public
+* License as published by the Free Software Foundation; either
+* version 2 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Library General Public License for more details.
+*
+* You should have received a copy of the GNU Library General Public
+* License along with this library; if not, write to the
+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+* Boston, MA 02111-1307, USA.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstvdpvideosrcpad.h"
+
+#include "gstvdpdecoder.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_vdp_decoder_debug);
+#define GST_CAT_DEFAULT gst_vdp_decoder_debug
+
+#define DEBUG_INIT(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_vdp_decoder_debug, "vdpdecoder", 0, \
+    "VDPAU decoder base class");
+
+GST_BOILERPLATE_FULL (GstVdpDecoder, gst_vdp_decoder, GstBaseVideoDecoder,
+    GST_TYPE_BASE_VIDEO_DECODER, DEBUG_INIT);
+
+static GstFlowReturn
+gst_vdp_decoder_shape_output (GstBaseVideoDecoder * base_video_decoder,
+    GstBuffer * buf)
+{
+  GstVdpVideoSrcPad *vdp_pad;
+
+  vdp_pad =
+      (GstVdpVideoSrcPad *) GST_BASE_VIDEO_DECODER_SRC_PAD (base_video_decoder);
+
+  return gst_vdp_video_src_pad_push (vdp_pad, GST_VDP_VIDEO_BUFFER (buf));
+}
+
+static GstPad *
+gst_vdp_decoder_create_srcpad (GstBaseVideoDecoder * base_video_decoder,
+    GstBaseVideoDecoderClass * base_video_decoder_class)
+{
+  GstPadTemplate *pad_template;
+  GstVdpVideoSrcPad *vdp_pad;
+
+  pad_template = gst_element_class_get_pad_template
+      (GST_ELEMENT_CLASS (base_video_decoder_class),
+      GST_BASE_VIDEO_DECODER_SRC_NAME);
+
+  vdp_pad = gst_vdp_video_src_pad_new (pad_template,
+      GST_BASE_VIDEO_DECODER_SRC_NAME);
+
+  return GST_PAD (vdp_pad);
+}
+
+GstFlowReturn
+gst_vdp_decoder_alloc_buffer (GstVdpDecoder * vdp_decoder,
+    GstVdpVideoBuffer ** video_buf)
+{
+  GstVdpVideoSrcPad *vdp_pad;
+
+  vdp_pad = (GstVdpVideoSrcPad *) GST_BASE_VIDEO_DECODER_SRC_PAD (vdp_decoder);
+  return gst_vdp_video_src_pad_alloc_buffer (vdp_pad, video_buf);
+}
+
+GstFlowReturn
+gst_vdp_decoder_get_device (GstVdpDecoder * vdp_decoder, GstVdpDevice ** device,
+    GError ** error)
+{
+  GstVdpVideoSrcPad *vdp_pad;
+
+  vdp_pad = (GstVdpVideoSrcPad *) GST_BASE_VIDEO_DECODER_SRC_PAD (vdp_decoder);
+  return gst_vdp_video_src_pad_get_device (vdp_pad, device, error);
+}
+
+static void
+gst_vdp_decoder_base_init (gpointer g_class)
+{
+  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+
+  GstCaps *src_caps;
+  GstPadTemplate *src_template;
+
+  src_caps = gst_vdp_video_buffer_get_caps (TRUE, VDP_CHROMA_TYPE_420);
+  src_template = gst_pad_template_new (GST_BASE_VIDEO_DECODER_SRC_NAME,
+      GST_PAD_SRC, GST_PAD_ALWAYS, src_caps);
+
+  gst_element_class_add_pad_template (element_class, src_template);
+}
+
+static void
+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);
+
+  base_video_decoder_class->create_srcpad = gst_vdp_decoder_create_srcpad;
+  base_video_decoder_class->shape_output = gst_vdp_decoder_shape_output;
+}
diff --git a/sys/vdpau/gstvdp/gstvdpdecoder.h b/sys/vdpau/gstvdp/gstvdpdecoder.h
new file mode 100644 (file)
index 0000000..91c7252
--- /dev/null
@@ -0,0 +1,57 @@
+/* GStreamer
+ *
+ * Copyright (C) 2009 Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_VDP_DECODER_H__
+#define __GST_VDP_DECODER_H__
+
+#include <gst/gst.h>
+
+#include "../basevideodecoder/gstbasevideodecoder.h"
+#include "../gstvdp/gstvdpvideobuffer.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_VDP_DECODER                   (gst_vdp_decoder_get_type())
+#define GST_VDP_DECODER(obj)                   (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VDP_DECODER, GstVdpDecoder))
+#define GST_VDP_DECODER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VDP_DECODER, GstVdpDecoderClass))
+#define GST_VDP_DECODER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VDP_DECODER, GstVdpDecoderClass))
+#define GST_IS_VDP_DECODER(obj)                (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VDP_DECODER))
+#define GST_IS_VDP_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VDP_DECODER))
+
+typedef struct _GstVdpDecoder GstVdpDecoder;
+typedef struct _GstVdpDecoderClass GstVdpDecoderClass;
+
+
+struct _GstVdpDecoder {
+  GstBaseVideoDecoder base_video_decoder;
+};
+
+struct _GstVdpDecoderClass {
+  GstBaseVideoDecoderClass base_video_decoder_class;
+};
+
+GstFlowReturn gst_vdp_decoder_alloc_buffer (GstVdpDecoder * vdp_decoder, GstVdpVideoBuffer **video_buf);
+GstFlowReturn gst_vdp_decoder_get_device (GstVdpDecoder * vdp_decoder, GstVdpDevice ** device, GError ** error);
+
+GType gst_vdp_decoder_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_VDP_DECODER_H__ */
\ No newline at end of file
index 1987744..c5ec7c9 100644 (file)
@@ -26,8 +26,6 @@
 #include <gst/base/gstbitreader.h>
 #include <string.h>
 
-#include "../gstvdp/gstvdpvideosrcpad.h"
-
 #include "gstvdph264frame.h"
 
 #include "gstvdph264dec.h"
@@ -46,8 +44,8 @@ GST_STATIC_PAD_TEMPLATE (GST_BASE_VIDEO_DECODER_SINK_NAME,
     GST_DEBUG_CATEGORY_INIT (gst_vdp_h264_dec_debug, "vdpauh264dec", 0, \
     "VDPAU h264 decoder");
 
-GST_BOILERPLATE_FULL (GstVdpH264Dec, gst_vdp_h264_dec, GstBaseVideoDecoder,
-    GST_TYPE_BASE_VIDEO_DECODER, DEBUG_INIT);
+GST_BOILERPLATE_FULL (GstVdpH264Dec, gst_vdp_h264_dec, GstVdpDecoder,
+    GST_TYPE_VDP_DECODER, DEBUG_INIT);
 
 #define SYNC_CODE_SIZE 3
 
@@ -72,21 +70,6 @@ GST_BOILERPLATE_FULL (GstVdpH264Dec, gst_vdp_h264_dec, GstBaseVideoDecoder,
   } \
 }
 
-static GstFlowReturn
-gst_vdp_h264_dec_alloc_buffer (GstVdpH264Dec * h264_dec,
-    GstVdpVideoBuffer ** outbuf)
-{
-  GstVdpVideoSrcPad *vdp_pad;
-  GstFlowReturn ret = GST_FLOW_OK;
-
-  vdp_pad = (GstVdpVideoSrcPad *) GST_BASE_VIDEO_DECODER_SRC_PAD (h264_dec);
-  ret = gst_vdp_video_src_pad_alloc_buffer (vdp_pad, outbuf);
-  if (ret != GST_FLOW_OK)
-    return ret;
-
-  return GST_FLOW_OK;
-}
-
 static gboolean
 gst_vdp_h264_dec_set_sink_caps (GstBaseVideoDecoder * base_video_decoder,
     GstCaps * caps)
@@ -168,18 +151,6 @@ gst_vdp_h264_dec_set_sink_caps (GstBaseVideoDecoder * base_video_decoder,
   return TRUE;
 }
 
-static GstFlowReturn
-gst_vdp_h264_dec_shape_output (GstBaseVideoDecoder * base_video_decoder,
-    GstBuffer * buf)
-{
-  GstVdpVideoSrcPad *vdp_pad;
-
-  vdp_pad =
-      (GstVdpVideoSrcPad *) GST_BASE_VIDEO_DECODER_SRC_PAD (base_video_decoder);
-
-  return gst_vdp_video_src_pad_push (vdp_pad, GST_VDP_VIDEO_BUFFER (buf));
-}
-
 static void
 gst_vdp_h264_dec_output (GstH264DPB * dpb, GstVdpH264Frame * h264_frame,
     gpointer user_data)
@@ -294,9 +265,8 @@ gst_vdp_h264_dec_idr (GstVdpH264Dec * h264_dec, GstVdpH264Frame * h264_frame)
 
     gst_base_video_decoder_update_src_caps (GST_BASE_VIDEO_DECODER (h264_dec));
 
-    ret = gst_vdp_video_src_pad_get_device
-        (GST_VDP_VIDEO_SRC_PAD (GST_BASE_VIDEO_DECODER_SRC_PAD (h264_dec)),
-        &device, NULL);
+    ret = gst_vdp_decoder_get_device (GST_VDP_DECODER (h264_dec), &device,
+        NULL);
 
     if (ret == GST_FLOW_OK) {
       GstVideoState *state;
@@ -509,7 +479,8 @@ gst_vdp_h264_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder,
 
 
   /* decoding */
-  if ((ret = gst_vdp_h264_dec_alloc_buffer (h264_dec, &outbuf) != GST_FLOW_OK))
+  if ((ret = gst_vdp_decoder_alloc_buffer (GST_VDP_DECODER (h264_dec), &outbuf)
+          != GST_FLOW_OK))
     goto alloc_error;
 
   device = GST_VDP_VIDEO_BUFFER (outbuf)->device;
@@ -846,23 +817,6 @@ gst_vdp_h264_dec_create_frame (GstBaseVideoDecoder * base_video_decoder)
   return GST_VIDEO_FRAME_CAST (gst_vdp_h264_frame_new ());
 }
 
-static GstPad *
-gst_vdp_h264_dec_create_srcpad (GstBaseVideoDecoder * base_video_decoder,
-    GstBaseVideoDecoderClass * base_video_decoder_class)
-{
-  GstPadTemplate *pad_template;
-  GstVdpVideoSrcPad *vdp_pad;
-
-  pad_template = gst_element_class_get_pad_template
-      (GST_ELEMENT_CLASS (base_video_decoder_class),
-      GST_BASE_VIDEO_DECODER_SRC_NAME);
-
-  vdp_pad = gst_vdp_video_src_pad_new (pad_template,
-      GST_BASE_VIDEO_DECODER_SRC_NAME);
-
-  return GST_PAD (vdp_pad);
-}
-
 static gboolean
 gst_vdp_h264_dec_flush (GstBaseVideoDecoder * base_video_decoder)
 {
@@ -899,18 +853,13 @@ gst_vdp_h264_dec_stop (GstBaseVideoDecoder * base_video_decoder)
 {
   GstVdpH264Dec *h264_dec = GST_VDP_H264_DEC (base_video_decoder);
 
-  GstVdpVideoSrcPad *vdp_pad;
   GstFlowReturn ret;
   GstVdpDevice *device;
 
   g_object_unref (h264_dec->parser);
   g_object_unref (h264_dec->dpb);
 
-  vdp_pad =
-      GST_VDP_VIDEO_SRC_PAD (GST_BASE_VIDEO_DECODER_SRC_PAD
-      (base_video_decoder));
-
-  ret = gst_vdp_video_src_pad_get_device (vdp_pad, &device, NULL);
+  ret = gst_vdp_decoder_get_device (GST_VDP_DECODER (h264_dec), &device, NULL);
   if (ret == GST_FLOW_OK) {
 
     if (h264_dec->decoder != VDP_INVALID_HANDLE)
@@ -925,9 +874,6 @@ gst_vdp_h264_dec_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  GstCaps *src_caps;
-  GstPadTemplate *src_template;
-
   gst_element_class_set_details_simple (element_class,
       "VDPAU H264 Decoder",
       "Decoder",
@@ -936,12 +882,6 @@ gst_vdp_h264_dec_base_init (gpointer g_class)
 
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&sink_template));
-
-  src_caps = gst_vdp_video_buffer_get_caps (TRUE, VDP_CHROMA_TYPE_420);
-  src_template = gst_pad_template_new (GST_BASE_VIDEO_DECODER_SRC_NAME,
-      GST_PAD_SRC, GST_PAD_ALWAYS, src_caps);
-
-  gst_element_class_add_pad_template (element_class, src_template);
 }
 
 static void
@@ -968,7 +908,6 @@ gst_vdp_h264_dec_class_init (GstVdpH264DecClass * klass)
   base_video_decoder_class->stop = gst_vdp_h264_dec_stop;
   base_video_decoder_class->flush = gst_vdp_h264_dec_flush;
 
-  base_video_decoder_class->create_srcpad = gst_vdp_h264_dec_create_srcpad;
   base_video_decoder_class->set_sink_caps = gst_vdp_h264_dec_set_sink_caps;
 
   base_video_decoder_class->scan_for_sync = gst_vdp_h264_dec_scan_for_sync;
@@ -978,6 +917,4 @@ gst_vdp_h264_dec_class_init (GstVdpH264DecClass * klass)
 
   base_video_decoder_class->handle_frame = gst_vdp_h264_dec_handle_frame;
   base_video_decoder_class->create_frame = gst_vdp_h264_dec_create_frame;
-
-  base_video_decoder_class->shape_output = gst_vdp_h264_dec_shape_output;
 }
index 01bb52b..4416a4e 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <gst/gst.h>
 
-#include "../basevideodecoder/gstbasevideodecoder.h"
+#include "../gstvdp/gstvdpdecoder.h"
 
 #include "gsth264parser.h"
 #include "gsth264dpb.h"
@@ -43,7 +43,7 @@ typedef struct _GstVdpH264DecClass GstVdpH264DecClass;
 
 
 struct _GstVdpH264Dec {
-  GstBaseVideoDecoder base_video_decoder;
+  GstVdpDecoder vdp_decoder;
 
   gboolean packetized;
   guint8 nal_length_size;
@@ -60,7 +60,7 @@ struct _GstVdpH264Dec {
 };
 
 struct _GstVdpH264DecClass {
-  GstBaseVideoDecoderClass base_video_decoder_class;
+  GstVdpDecoderClass vdp_decoder_class;
 };
 
 GType gst_vdp_h264_dec_get_type (void);
index 60005df..eb12244 100644 (file)
@@ -41,8 +41,6 @@
 #include <string.h>
 
 #include "mpegutil.h"
-#include "../gstvdp/gstvdpvideosrcpad.h"
-#include "../gstvdp/gstvdpvideobuffer.h"
 
 #include "gstvdpmpegdec.h"
 
@@ -78,7 +76,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
     "VDPAU mpeg decoder");
 
 GST_BOILERPLATE_FULL (GstVdpMpegDec, gst_vdp_mpeg_dec,
-    GstBaseVideoDecoder, GST_TYPE_BASE_VIDEO_DECODER, DEBUG_INIT);
+    GstVdpDecoder, GST_TYPE_VDP_DECODER, DEBUG_INIT);
 
 static void gst_vdp_mpeg_dec_init_info (VdpPictureInfoMPEG1Or2 * vdp_info);
 
@@ -101,33 +99,6 @@ gst_vdp_mpeg_dec_get_profile (MPEGSeqExtHdr * hdr)
   return profile;
 }
 
-static GstFlowReturn
-gst_vdp_mpeg_dec_alloc_buffer (GstVdpMpegDec * mpeg_dec,
-    GstVdpVideoBuffer ** outbuf)
-{
-  GstVdpVideoSrcPad *vdp_pad;
-  GstFlowReturn ret = GST_FLOW_OK;
-
-  vdp_pad = (GstVdpVideoSrcPad *) GST_BASE_VIDEO_DECODER_SRC_PAD (mpeg_dec);
-  ret = gst_vdp_video_src_pad_alloc_buffer (vdp_pad, outbuf);
-  if (ret != GST_FLOW_OK)
-    return ret;
-
-  return GST_FLOW_OK;
-}
-
-static GstFlowReturn
-gst_vdp_mpeg_dec_shape_output (GstBaseVideoDecoder * base_video_decoder,
-    GstBuffer * buf)
-{
-  GstVdpVideoSrcPad *vdp_pad;
-
-  vdp_pad =
-      (GstVdpVideoSrcPad *) GST_BASE_VIDEO_DECODER_SRC_PAD (base_video_decoder);
-
-  return gst_vdp_video_src_pad_push (vdp_pad, GST_VDP_VIDEO_BUFFER (buf));
-}
-
 static gboolean
 gst_vdp_mpeg_dec_handle_picture_coding (GstVdpMpegDec * mpeg_dec,
     GstBuffer * buffer, GstVideoFrame * frame)
@@ -248,10 +219,7 @@ gst_vdp_mpeg_dec_create_decoder (GstVdpMpegDec * mpeg_dec)
   GstFlowReturn ret;
   GstVdpDevice *device;
 
-  ret = gst_vdp_video_src_pad_get_device
-      (GST_VDP_VIDEO_SRC_PAD (GST_BASE_VIDEO_DECODER_SRC_PAD (mpeg_dec)),
-      &device, NULL);
-
+  ret = gst_vdp_decoder_get_device (GST_VDP_DECODER (mpeg_dec), &device, NULL);
   if (ret == GST_FLOW_OK) {
     VdpStatus status;
     GstVdpMpegStreamInfo *stream_info;
@@ -434,7 +402,8 @@ gst_vdp_mpeg_dec_handle_frame (GstBaseVideoDecoder * base_video_decoder,
     info->backward_reference = VDP_INVALID_HANDLE;
   }
 
-  if ((ret = gst_vdp_mpeg_dec_alloc_buffer (mpeg_dec, &outbuf) != GST_FLOW_OK))
+  if ((ret = gst_vdp_decoder_alloc_buffer (GST_VDP_DECODER (mpeg_dec), &outbuf)
+          != GST_FLOW_OK))
     goto alloc_error;
 
   /* create decoder */
@@ -634,23 +603,6 @@ done:
   return ret;
 }
 
-static GstPad *
-gst_vdp_mpeg_dec_create_srcpad (GstBaseVideoDecoder * base_video_decoder,
-    GstBaseVideoDecoderClass * base_video_decoder_class)
-{
-  GstPadTemplate *pad_template;
-  GstVdpVideoSrcPad *vdp_pad;
-
-  pad_template = gst_element_class_get_pad_template
-      (GST_ELEMENT_CLASS (base_video_decoder_class),
-      GST_BASE_VIDEO_DECODER_SRC_NAME);
-
-  vdp_pad = gst_vdp_video_src_pad_new (pad_template,
-      GST_BASE_VIDEO_DECODER_SRC_NAME);
-
-  return GST_PAD (vdp_pad);
-}
-
 static gint
 gst_vdp_mpeg_dec_scan_for_sync (GstBaseVideoDecoder * base_video_decoder,
     GstAdapter * adapter)
@@ -725,15 +677,10 @@ gst_vdp_mpeg_dec_stop (GstBaseVideoDecoder * base_video_decoder)
 {
   GstVdpMpegDec *mpeg_dec = GST_VDP_MPEG_DEC (base_video_decoder);
 
-  GstVdpVideoSrcPad *vdp_pad;
   GstFlowReturn ret;
   GstVdpDevice *device;
 
-  vdp_pad =
-      GST_VDP_VIDEO_SRC_PAD (GST_BASE_VIDEO_DECODER_SRC_PAD
-      (base_video_decoder));
-
-  ret = gst_vdp_video_src_pad_get_device (vdp_pad, &device, NULL);
+  ret = gst_vdp_decoder_get_device (GST_VDP_DECODER (mpeg_dec), &device, NULL);
   if (ret == GST_FLOW_OK) {
 
     if (mpeg_dec->decoder != VDP_INVALID_HANDLE)
@@ -799,24 +746,14 @@ gst_vdp_mpeg_dec_base_init (gpointer gclass)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
 
-  GstCaps *src_caps;
-  GstPadTemplate *src_template;
-
   gst_element_class_set_details_simple (element_class,
       "VDPAU Mpeg Decoder",
       "Decoder",
       "Decode mpeg stream with vdpau",
       "Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>");
 
-
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&sink_template));
-
-  src_caps = gst_vdp_video_buffer_get_caps (TRUE, VDP_CHROMA_TYPE_420);
-  src_template = gst_pad_template_new (GST_BASE_VIDEO_DECODER_SRC_NAME,
-      GST_PAD_SRC, GST_PAD_ALWAYS, src_caps);
-
-  gst_element_class_add_pad_template (element_class, src_template);
 }
 
 /* initialize the vdpaumpegdecoder's class */
@@ -838,7 +775,6 @@ gst_vdp_mpeg_dec_class_init (GstVdpMpegDecClass * klass)
   base_video_decoder_class->start = gst_vdp_mpeg_dec_start;
   base_video_decoder_class->stop = gst_vdp_mpeg_dec_stop;
   base_video_decoder_class->flush = gst_vdp_mpeg_dec_flush;
-  base_video_decoder_class->create_srcpad = gst_vdp_mpeg_dec_create_srcpad;
 
   base_video_decoder_class->scan_for_sync = gst_vdp_mpeg_dec_scan_for_sync;
   base_video_decoder_class->scan_for_packet_end =
@@ -848,8 +784,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;
 
-  base_video_decoder_class->shape_output = gst_vdp_mpeg_dec_shape_output;
-
   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));
index 5bd20f7..b59d617 100644 (file)
@@ -24,7 +24,7 @@
 #include <gst/gst.h>
 #include <gst/base/gstadapter.h>
 
-#include "../basevideodecoder/gstbasevideodecoder.h"
+#include "../gstvdp/gstvdpdecoder.h"
 #include "gstvdpmpegframe.h"
 
 G_BEGIN_DECLS
@@ -46,7 +46,7 @@ typedef struct _GstVdpMpegDecClass GstVdpMpegDecClass;
 
 struct _GstVdpMpegDec
 {
-  GstBaseVideoDecoder base_video_decoder;
+  GstVdpDecoder vdp_decoder;
 
   VdpDecoder decoder;
 
@@ -70,7 +70,7 @@ struct _GstVdpMpegDec
 
 struct _GstVdpMpegDecClass 
 {
-  GstBaseVideoDecoderClass base_video_decoder_class;  
+  GstVdpDecoderClass vdp_decoder_class;
 };
 
 GType gst_vdp_mpeg_dec_get_type (void);