summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-09-07 16:25:44 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2009-09-08 17:43:43 +0200
commitbe156bbc2f99c55503fe0f055a5cbc4661fd7832 (patch)
treeac989e0ff8a39311302364bd46053b9af3cc50e4
parent5f618018fe89303d9b6d63c2b7e5eed8973f9410 (diff)
hdpvr: add source for the Hauppauge HD PVR devicehdpvr
Add a source for the Hauppauge Hd PVR device. It can be controlled using the v4l2 API but data is simply read from /dev/video0.
-rw-r--r--configure.ac7
-rw-r--r--sys/Makefile.am8
-rw-r--r--sys/hdpvr/Makefile.am10
-rw-r--r--sys/hdpvr/hdpvrsrc.c512
-rw-r--r--sys/hdpvr/hdpvrsrc.h77
5 files changed, 613 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 438b2cd5c..f5c2cbbb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -460,6 +460,12 @@ AG_GST_CHECK_FEATURE(VCD, [Video CD], vcdsrc, [
AC_CHECK_HEADER(linux/cdrom.h, HAVE_VCD="yes", HAVE_VCD="no")
])
+dnl check for v4l2 for HDPVR
+translit(dnm, m, l) AM_CONDITIONAL(USE_V4L2, true)
+AG_GST_CHECK_FEATURE(V4L2, [Video For Linux 2], hdpvr, [
+ AC_CHECK_HEADER(linux/videodev2.h, HAVE_V4L2="yes", HAVE_V4L2="no")
+])
+
dnl *** ext plug-ins ***
dnl keep this list sorted alphabetically !
@@ -1761,6 +1767,7 @@ sys/dshowsrcwrapper/Makefile
sys/dshowvideosink/Makefile
sys/dvb/Makefile
sys/fbdev/Makefile
+sys/hdpvr/Makefile
sys/oss4/Makefile
sys/osxvideo/Makefile
sys/qtwrapper/Makefile
diff --git a/sys/Makefile.am b/sys/Makefile.am
index 5608a8e74..4c5843064 100644
--- a/sys/Makefile.am
+++ b/sys/Makefile.am
@@ -16,6 +16,12 @@ else
VCD_DIR=
endif
+if USE_V4L2
+HDPVR_DIR=hdpvr
+else
+HDPVR_DIR=
+endif
+
# if USE_CDROM
# CDROM_DIR=cdrom
# else
@@ -82,7 +88,7 @@ else
VDPAU_DIR=
endif
-SUBDIRS = $(ACM_DIR) $(DIRECTDRAW_DIR) $(DIRECTSOUND_DIR) $(DVB_DIR) $(FBDEV_DIR) $(OSS4_DIR) $(OSX_VIDEO_DIR) $(QT_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR)
+SUBDIRS = $(ACM_DIR) $(DIRECTDRAW_DIR) $(DIRECTSOUND_DIR) $(DVB_DIR) $(FBDEV_DIR) $(OSS4_DIR) $(OSX_VIDEO_DIR) $(QT_DIR) $(VCD_DIR) $(HDPVR_DIR) $(VDPAU_DIR) $(WININET_DIR)
DIST_SUBDIRS = acmenc acmmp3dec directdraw directsound dvb fbdev dshowdecwrapper dshowsrcwrapper dshowvideosink \
oss4 osxvideo qtwrapper vcd vdpau wasapi wininet winks winscreencap
diff --git a/sys/hdpvr/Makefile.am b/sys/hdpvr/Makefile.am
new file mode 100644
index 000000000..9b12a66a6
--- /dev/null
+++ b/sys/hdpvr/Makefile.am
@@ -0,0 +1,10 @@
+
+plugin_LTLIBRARIES = libgsthdpvrsrc.la
+
+libgsthdpvrsrc_la_SOURCES = hdpvrsrc.c
+libgsthdpvrsrc_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
+libgsthdpvrsrc_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
+libgsthdpvrsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgsthdpvrsrc_la_LIBTOOLFLAGS = --tag=disable-static
+
+noinst_HEADERS = hdpvrsrc.h
diff --git a/sys/hdpvr/hdpvrsrc.c b/sys/hdpvr/hdpvrsrc.c
new file mode 100644
index 000000000..05a653fd6
--- /dev/null
+++ b/sys/hdpvr/hdpvrsrc.c
@@ -0,0 +1,512 @@
+/* GStreamer
+ * Copyright (C) <2009> Wim Taymans <wim.taymans@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.
+ */
+
+/**
+ * SECTION:element-hdpvrsrc
+ *
+ * hdpvrsrc is a source to capture from the Hauppauge HD PVR capture device. See
+ * also: http://www.mythtv.org/wiki/Hauppauge_HD-PVR
+ *
+ * <refsect2>
+ * <title>Example launch lines</title>
+ * |[
+ * gst-launch hdpvrsrc ! mpegtsdemux ! ffdec_h264 ! xvimagesink
+ * ]| This pipeline shows the video captured from /dev/video0 HD PVR box.
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <errno.h>
+
+#include "hdpvrsrc.h"
+
+static const GstElementDetails gst_hdpvrsrc_details =
+GST_ELEMENT_DETAILS ("Hauppauge HD PVR Source",
+ "Source/File",
+ "read from Hauppauge HD PVR device",
+ "Wim Taymans <wim.taymans@gmail.com>");
+
+/* HDPVRSrc signals and args */
+enum
+{
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+#if 0
+
+brightness (int):
+min = 0 max = 255 step = 1 default = 134 value = 134 flags = slider contrast (int):min = 0 max = 255 step = 1 default = 128 value = 128 flags = slider saturation (int):min = 0 max = 255 step = 1 default = 128 value = 128 flags = slider hue (int):min = 0 max = 255 step = 1 default = 128 value = 128 flags = slider sharpness (int):min = 0 max = 255 step = 1 default = 128 value = 128 flags = slider audio_encoding (menu):
+min = 3 max = 4 default = 3 value = 3 flags = update video_encoding (menu):
+min = 2 max = 2 default = 2 value = 2 video_bitrate_mode (menu):
+min = 0 max = 1 default = 1 value = 1 flags = update
+ video_bitrate (int):min = 1000000 max = 13500000 step = 100000 default =
+ 6500000 value = 6500000 video_peak_bitrate (int):min = 1100000 max =
+ 20200000 step = 100000 default = 9000000 value = 9000000 flags = inactive
+#endif
+#define GST_TYPE_HDPVR_AUDIO_ENCODING (gst_hdpvr_audio_encoding_get_type())
+ static GType gst_hdpvr_audio_encoding_get_type (void)
+{
+ static GType hdpvr_audio_encoding_type = 0;
+ static const GEnumValue hdpvr_audio_encoding[] = {
+ {3, "AAC", "AAC"},
+ {4, "AC3", "AC3"},
+ {0, NULL, NULL},
+ };
+
+ if (!hdpvr_audio_encoding_type) {
+ hdpvr_audio_encoding_type =
+ g_enum_register_static ("GstHDPVRAudioEncodingType",
+ hdpvr_audio_encoding);
+ }
+ return hdpvr_audio_encoding_type;
+}
+
+
+#define GST_TYPE_HDPVR_VIDEO_BITRATE_MODE (gst_hdpvr_video_bitrate_mode_get_type())
+static GType
+gst_hdpvr_video_bitrate_mode_get_type (void)
+{
+ static GType hdpvr_video_bitrate_mode_type = 0;
+ static const GEnumValue hdpvr_video_bitrate_mode[] = {
+ {0, "Variable Bitrate", "VBR"},
+ {1, "Constant Bitrate", "CBR"},
+ {0, NULL, NULL},
+ };
+
+ if (!hdpvr_video_bitrate_mode_type) {
+ hdpvr_video_bitrate_mode_type =
+ g_enum_register_static ("GstHDPVRVideoBitrateModeType",
+ hdpvr_video_bitrate_mode);
+ }
+ return hdpvr_video_bitrate_mode_type;
+}
+
+#define DEFAULT_DEVICE "/dev/video0"
+
+/* color balance, needs to be done with the colorbalance interface */
+#define DEFAULT_BRIGHTNESS -1
+#define DEFAULT_CONTRAST -1
+#define DEFAULT_SATURATION -1
+#define DEFAULT_HUE -1
+#define DEFAULT_SHARPNESS -1
+
+#define DEFAULT_AUDIO_ENCODING 3
+#define DEFAULT_VIDEO_ENCODING -1
+
+#define DEFAULT_VIDEO_BITRATE_MODE 1
+#define DEFAULT_VIDEO_BITRATE 6500000
+#define DEFAULT_VIDEO_PEAK_BITRATE 9000000
+
+enum
+{
+ PROP_0,
+ PROP_DEVICE,
+
+ PROP_BRIGHTNESS,
+ PROP_CONTRAST,
+ PROP_SATURATION,
+ PROP_HUE,
+ PROP_SHARPNESS,
+
+ PROP_AUDIO_ENCODING,
+ PROP_VIDEO_ENCODING,
+
+ PROP_VIDEO_BITRATE_MODE,
+ PROP_VIDEO_BITRATE,
+ PROP_VIDEO_PEAK_BITRATE,
+
+ PROP_LAST
+};
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/mpegts"));
+
+GST_DEBUG_CATEGORY_STATIC (gst_hdpvrsrc_debug);
+#define GST_CAT_DEFAULT gst_hdpvrsrc_debug
+
+static void gst_hdpvrsrc_uri_handler_init (gpointer g_iface,
+ gpointer iface_data);
+
+static void
+gst_hdpvrsrc_setup_interfaces (GType type)
+{
+ static const GInterfaceInfo urihandler_info = {
+ gst_hdpvrsrc_uri_handler_init,
+ NULL,
+ NULL,
+ };
+
+ g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
+}
+
+
+GST_BOILERPLATE_FULL (GstHDPVRSrc, gst_hdpvrsrc, GstPushSrc, GST_TYPE_PUSH_SRC,
+ gst_hdpvrsrc_setup_interfaces);
+
+static void gst_hdpvrsrc_finalize (GObject * object);
+
+static void gst_hdpvrsrc_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_hdpvrsrc_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+
+static gboolean gst_hdpvrsrc_start (GstBaseSrc * src);
+static gboolean gst_hdpvrsrc_stop (GstBaseSrc * src);
+static GstFlowReturn gst_hdpvrsrc_create (GstPushSrc * src, GstBuffer ** out);
+
+static void
+gst_hdpvrsrc_base_init (gpointer g_class)
+{
+ GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details (element_class, &gst_hdpvrsrc_details);
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&srctemplate));
+}
+
+static void
+gst_hdpvrsrc_class_init (GstHDPVRSrcClass * klass)
+{
+ GObjectClass *gobject_class;
+ GstBaseSrcClass *basesrc_class;
+ GstPushSrcClass *pushsrc_class;
+
+ gobject_class = (GObjectClass *) klass;
+ basesrc_class = (GstBaseSrcClass *) klass;
+ pushsrc_class = (GstPushSrcClass *) klass;
+
+ gobject_class->set_property = gst_hdpvrsrc_set_property;
+ gobject_class->get_property = gst_hdpvrsrc_get_property;
+ gobject_class->finalize = gst_hdpvrsrc_finalize;
+
+ g_object_class_install_property (gobject_class, PROP_DEVICE,
+ g_param_spec_string ("device", "Device",
+ "CD device location", NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_AUDIO_ENCODING,
+ g_param_spec_enum ("audio-encoding", "Audio Encoding",
+ "Audio encoding to use", GST_TYPE_HDPVR_AUDIO_ENCODING,
+ DEFAULT_AUDIO_ENCODING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_VIDEO_BITRATE_MODE,
+ g_param_spec_enum ("video-bitrate-mode", "Video Bitrate Mode",
+ "Video Bitrate mode to use", GST_TYPE_HDPVR_VIDEO_BITRATE_MODE,
+ DEFAULT_VIDEO_BITRATE_MODE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_VIDEO_BITRATE,
+ g_param_spec_uint ("video-bitrate", "Video Bitrate",
+ "Video Bitrate mode to use", 1000000, 13500000,
+ DEFAULT_VIDEO_BITRATE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_VIDEO_PEAK_BITRATE,
+ g_param_spec_uint ("video-peak-bitrate", "Video Peak Bitrate",
+ "Video Peak Bitrate mode to use", 1100000, 20200000,
+ DEFAULT_VIDEO_PEAK_BITRATE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ basesrc_class->start = gst_hdpvrsrc_start;
+ basesrc_class->stop = gst_hdpvrsrc_stop;
+
+ pushsrc_class->create = gst_hdpvrsrc_create;
+
+ GST_DEBUG_CATEGORY_INIT (gst_hdpvrsrc_debug, "hdpvrsrc", 0,
+ "Hauppauge HD PVR Source element");
+}
+
+static void
+gst_hdpvrsrc_init (GstHDPVRSrc * hdpvrsrc, GstHDPVRSrcClass * klass)
+{
+ hdpvrsrc->device = g_strdup (DEFAULT_DEVICE);
+
+ hdpvrsrc->fd = 0;
+
+ hdpvrsrc->audio_encoding = DEFAULT_AUDIO_ENCODING;
+ hdpvrsrc->video_bitrate_mode = DEFAULT_VIDEO_BITRATE_MODE;
+ hdpvrsrc->video_bitrate = DEFAULT_VIDEO_BITRATE;
+ hdpvrsrc->video_peak_bitrate = DEFAULT_VIDEO_PEAK_BITRATE;
+
+ gst_base_src_set_live (GST_BASE_SRC (hdpvrsrc), TRUE);
+ gst_base_src_set_format (GST_BASE_SRC (hdpvrsrc), GST_FORMAT_TIME);
+ gst_base_src_set_do_timestamp (GST_BASE_SRC (hdpvrsrc), TRUE);
+}
+
+static void
+gst_hdpvrsrc_finalize (GObject * object)
+{
+ GstHDPVRSrc *hdpvrsrc = GST_HDPVRSRC (object);
+
+ g_free (hdpvrsrc->device);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
+gst_hdpvrsrc_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstHDPVRSrc *src;
+
+ src = GST_HDPVRSRC (object);
+
+ switch (prop_id) {
+ case PROP_DEVICE:
+ g_free (src->device);
+ src->device = g_value_dup_string (value);
+ break;
+ case PROP_AUDIO_ENCODING:
+ src->audio_encoding = g_value_get_enum (value);
+ break;
+ case PROP_VIDEO_ENCODING:
+ break;
+ case PROP_VIDEO_BITRATE_MODE:
+ src->video_bitrate_mode = g_value_get_enum (value);
+ break;
+ case PROP_VIDEO_BITRATE:
+ src->video_bitrate = g_value_get_uint (value);
+ break;
+ case PROP_VIDEO_PEAK_BITRATE:
+ src->video_peak_bitrate = g_value_get_uint (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gst_hdpvrsrc_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
+{
+ GstHDPVRSrc *src;
+
+ g_return_if_fail (GST_IS_HDPVRSRC (object));
+ src = GST_HDPVRSRC (object);
+
+ switch (prop_id) {
+ case PROP_DEVICE:
+ g_value_set_string (value, src->device);
+ break;
+ case PROP_AUDIO_ENCODING:
+ g_value_set_enum (value, src->audio_encoding);
+ break;
+ case PROP_VIDEO_ENCODING:
+ break;
+ case PROP_VIDEO_BITRATE_MODE:
+ g_value_set_enum (value, src->video_bitrate_mode);
+ break;
+ case PROP_VIDEO_BITRATE:
+ g_value_set_uint (value, src->video_bitrate);
+ break;
+ case PROP_VIDEO_PEAK_BITRATE:
+ g_value_set_uint (value, src->video_peak_bitrate);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static GstFlowReturn
+gst_hdpvrsrc_create (GstPushSrc * src, GstBuffer ** buf)
+{
+ GstHDPVRSrc *hdpvrsrc;
+ GstBuffer *outbuf;
+ guint8 *data;
+ gint blocksize;
+ gssize readbytes;
+
+ hdpvrsrc = GST_HDPVRSRC (src);
+
+ blocksize = GST_BASE_SRC_CAST (src)->blocksize;
+
+ /* create the buffer */
+ outbuf = gst_buffer_new_and_alloc (blocksize);
+
+ data = GST_BUFFER_DATA (outbuf);
+
+ do {
+ readbytes = read (hdpvrsrc->fd, data, blocksize);
+ GST_LOG_OBJECT (src, "read %" G_GSSIZE_FORMAT, readbytes);
+ } while (readbytes == -1 && errno == EINTR); /* retry if interrupted */
+
+ if (readbytes < 0)
+ goto read_error;
+
+ if (readbytes == 0)
+ goto eos;
+
+ GST_BUFFER_SIZE (outbuf) = readbytes;
+
+ *buf = outbuf;
+
+ return GST_FLOW_OK;
+
+ /* ERRORS */
+read_error:
+ {
+ GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
+ ("read error %" G_GSSIZE_FORMAT ": %s (%d)", readbytes,
+ g_strerror (errno), errno));
+ gst_buffer_unref (outbuf);
+ return GST_FLOW_ERROR;
+ }
+eos:
+ {
+ GST_DEBUG_OBJECT (src, "Read 0 bytes. EOS.");
+ gst_buffer_unref (outbuf);
+ return GST_FLOW_UNEXPECTED;
+ }
+}
+
+/* open the file, necessary to go to RUNNING state */
+static gboolean
+gst_hdpvrsrc_start (GstBaseSrc * bsrc)
+{
+ GstHDPVRSrc *src = GST_HDPVRSRC (bsrc);
+
+ /* open the device */
+ src->fd = open (src->device, O_RDONLY);
+ if (src->fd < 0)
+ goto open_failed;
+
+ return TRUE;
+
+ /* ERRORS */
+open_failed:
+ {
+ GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), GST_ERROR_SYSTEM);
+ return FALSE;
+ }
+}
+
+/* close the file */
+static gboolean
+gst_hdpvrsrc_stop (GstBaseSrc * bsrc)
+{
+ GstHDPVRSrc *src = GST_HDPVRSRC (bsrc);
+
+ /* close the file */
+ close (src->fd);
+
+ /* zero out a lot of our state */
+ src->fd = 0;
+
+ return TRUE;
+}
+
+/*
+ * URI interface.
+ */
+
+static guint
+gst_hdpvrsrc_uri_get_type (void)
+{
+ return GST_URI_SRC;
+}
+
+static gchar **
+gst_hdpvrsrc_uri_get_protocols (void)
+{
+ static gchar *protocols[] = { "hdpvr", NULL };
+
+ return protocols;
+}
+
+static const gchar *
+gst_hdpvrsrc_uri_get_uri (GstURIHandler * handler)
+{
+ gchar *result;
+
+ result = g_strdup_printf ("hdpvr://");
+
+ return result;
+}
+
+static gboolean
+gst_hdpvrsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+{
+ GstHDPVRSrc *src = GST_HDPVRSRC (handler);
+ gchar *protocol;
+
+ GST_DEBUG_OBJECT (src, "setting uri '%s'", uri);
+
+ protocol = gst_uri_get_protocol (uri);
+
+ if (protocol == NULL || strcmp (protocol, "hdpvr"))
+ goto wrong_protocol;
+
+ GST_DEBUG_OBJECT (src, "have protocol '%s'", protocol);
+ g_free (protocol);
+
+ return TRUE;
+
+ /* ERRORS */
+wrong_protocol:
+ {
+ GST_ERROR_OBJECT (src, "wrong protocol %s specified",
+ GST_STR_NULL (protocol));
+ g_free (protocol);
+ return FALSE;
+ }
+}
+
+static void
+gst_hdpvrsrc_uri_handler_init (gpointer g_iface, gpointer iface_data)
+{
+ GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
+
+ iface->get_type = gst_hdpvrsrc_uri_get_type;
+ iface->get_protocols = gst_hdpvrsrc_uri_get_protocols;
+ iface->get_uri = gst_hdpvrsrc_uri_get_uri;
+ iface->set_uri = gst_hdpvrsrc_uri_set_uri;
+}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+ return gst_element_register (plugin, "hdpvrsrc", GST_RANK_NONE,
+ GST_TYPE_HDPVRSRC);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "hdpvrsrc",
+ "Asynchronous read from Hauppauge HD PVR device",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/sys/hdpvr/hdpvrsrc.h b/sys/hdpvr/hdpvrsrc.h
new file mode 100644
index 000000000..254af9315
--- /dev/null
+++ b/sys/hdpvr/hdpvrsrc.h
@@ -0,0 +1,77 @@
+/* GStreamer
+ * Copyright (C) <2009> Wim Taymans <wim.taymans@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 __HDPVRSRC_H__
+#define __HDPVRSRC_H__
+
+#include <linux/videodev2.h>
+
+#include <gst/gst.h>
+#include <gst/base/gstpushsrc.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_HDPVRSRC \
+ (gst_hdpvrsrc_get_type())
+#define GST_HDPVRSRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_HDPVRSRC,GstHDPVRSrc))
+#define GST_HDPVRSRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_HDPVRSRC,GstHDPVRSrcClass))
+#define GST_IS_HDPVRSRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_HDPVRSRC))
+#define GST_IS_HDPVRSRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_HDPVRSRC))
+
+typedef struct _GstHDPVRSrc GstHDPVRSrc;
+typedef struct _GstHDPVRSrcClass GstHDPVRSrcClass;
+
+typedef enum {
+ GST_HDPVR_AUDIO_ENCODING_AAC = 3,
+ GST_HDPVR_AUDIO_ENCODING_AC3 = 4
+} GstHDPVRAudioEncoding;
+
+typedef enum {
+ GST_HDPVR_VIDEO_BITRATE_VBR = 0,
+ GST_HDPVR_VIDEO_BITRATE_CBR = 1
+} GstHDPVRVideoBitrateMode;
+
+struct _GstHDPVRSrc {
+ GstPushSrc parent_object;
+
+ /* device */
+ gchar *device;
+
+ /* fd */
+ gint fd;
+
+ /* properties */
+ GstHDPVRAudioEncoding audio_encoding;
+ GstHDPVRVideoBitrateMode video_bitrate_mode;
+ guint video_bitrate;
+ guint video_peak_bitrate;
+};
+
+struct _GstHDPVRSrcClass {
+ GstPushSrcClass parent_class;
+};
+
+G_END_DECLS
+
+#endif /* __HDPVRSRC_H__ */