diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-12-21 11:00:47 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-12-21 11:17:11 +0200 |
commit | 9b5de053995488d5ddc78c1bf4df651101271d70 (patch) | |
tree | 07755463428bf4460852180dc4d3155cc28bf488 /sys | |
parent | 0fdd4e2539cc8c2c794419b13594ed7761d5fccd (diff) | |
download | gstreamer-plugins-bad-9b5de053995488d5ddc78c1bf4df651101271d70.tar.gz |
Remove various unported plugins
If they were not ported after 4+ years it seems unlikely that anybody is
ever going to need them again. They're still in the GIT history if
needed.
https://bugzilla.gnome.org/show_bug.cgi?id=774530
Diffstat (limited to 'sys')
59 files changed, 3 insertions, 14373 deletions
diff --git a/sys/Makefile.am b/sys/Makefile.am index 4e6e58125..e5aa70491 100644 --- a/sys/Makefile.am +++ b/sys/Makefile.am @@ -16,12 +16,6 @@ else APPLE_MEDIA_DIR= endif -if USE_AVC -AVC_DIR=avc -else -AVC_DIR= -endif - if USE_BLUEZ BLUEZ_DIR=bluez else @@ -76,24 +70,6 @@ else DVB_DIR= endif -# if USE_DXR3 -# DXR3_DIR=dxr3 -# else -# DXR3_DIR= -# endif - -if USE_LINSYS -LINSYS_DIR=linsys -else -LINSYS_DIR= -endif - -if USE_PVR -PVR_DIR=pvr2d -else -PVR_DIR= -endif - if USE_SHM SHM_DIR=shm else @@ -106,18 +82,6 @@ else OPENSLES_DIR= endif -# if USE_QCAM -# QCAM_DIR=qcam -# else -# QCAM_DIR= -# endif - -if USE_WININET -WININET_DIR=wininet -else -WININET_DIR= -endif - if USE_VCD VCD_DIR=vcd else @@ -160,10 +124,10 @@ else MSDK_DIR= endif -SUBDIRS = $(ACM_DIR) $(ANDROID_MEDIA_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(BLUEZ_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTSOUND_DIR) $(WINKS_DIR) $(DVB_DIR) $(FBDEV_DIR) $(KMS_DIR) $(LINSYS_DIR) $(OPENSLES_DIR) $(PVR_DIR) $(SHM_DIR) $(UVCH264_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(WINSCREENCAP_DIR) $(WASAPI_DIR) $(NVENC_DIR) $(TINYALSA_DIR) $(MSDK_DIR) +SUBDIRS = $(ACM_DIR) $(ANDROID_MEDIA_DIR) $(APPLE_MEDIA_DIR) $(BLUEZ_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTSOUND_DIR) $(WINKS_DIR) $(DVB_DIR) $(FBDEV_DIR) $(KMS_DIR) $(OPENSLES_DIR) $(SHM_DIR) $(UVCH264_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(WINSCREENCAP_DIR) $(WASAPI_DIR) $(NVENC_DIR) $(TINYALSA_DIR) $(MSDK_DIR) -DIST_SUBDIRS = acmenc acmmp3dec androidmedia applemedia avc bluez d3dvideosink decklink directsound dvb linsys fbdev kms dshowdecwrapper dshowsrcwrapper dshowvideosink \ - opensles pvr2d shm uvch264 vcd vdpau wasapi wininet winks winscreencap \ +DIST_SUBDIRS = acmenc acmmp3dec androidmedia applemedia bluez d3dvideosink decklink directsound dvb fbdev kms dshowdecwrapper dshowsrcwrapper dshowvideosink \ + opensles shm uvch264 vcd vdpau wasapi winks winscreencap \ nvenc tinyalsa msdk include $(top_srcdir)/common/parallel-subdirs.mak diff --git a/sys/avc/Makefile.am b/sys/avc/Makefile.am deleted file mode 100644 index dd61d9e7c..000000000 --- a/sys/avc/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ - -plugin_LTLIBRARIES = libgstavc.la - -libgstavc_la_SOURCES = gstavcplugin.cpp gstavcsrc.cpp -libgstavc_la_CPPFLAGS = \ - $(GST_PLUGINS_BAD_CXXFLAGS) \ - $(GST_PLUGINS_BASE_CXXFLAGS) \ - $(GST_CXXFLAGS) \ - -framework AVCVideoServices \ - -Wno-deprecated-declarations -libgstavc_la_LIBADD = \ - $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \ - -lgstinterfaces-$(GST_API_VERSION) \ - $(GST_BASE_LIBS) \ - $(GST_LIBS) - -libgstavc_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) - -libgstavc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) \ - -Wl,-framework -Wl,AVCVideoServices \ - -Wl,-framework -Wl,Cocoa \ - -Wl,-framework -Wl,QuickTime - -noinst_HEADERS = gstavcsrc.h - diff --git a/sys/avc/gstavcplugin.cpp b/sys/avc/gstavcplugin.cpp deleted file mode 100644 index 82ba93525..000000000 --- a/sys/avc/gstavcplugin.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* GStreamer - * Copyright (C) 2011 David Schleef <ds@entropywave.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., 51 Franklin Street, Suite 500, - * Boston, MA 02110-1335, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include "gstavcsrc.h" - -static gboolean -plugin_init (GstPlugin * plugin) -{ - - gst_element_register (plugin, "avcsrc", GST_RANK_NONE, - gst_avc_src_get_type ()); - - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - avcsrc, - "AVC Video Services plugin", - plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/sys/avc/gstavcsrc.cpp b/sys/avc/gstavcsrc.cpp deleted file mode 100644 index 09d3f05ff..000000000 --- a/sys/avc/gstavcsrc.cpp +++ /dev/null @@ -1,423 +0,0 @@ -/* GStreamer - * Copyright (C) 2011 David Schleef <ds@entropywave.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., 51 Franklin Street, Suite 500, - * Boston, MA 02110-1335, USA. - */ -/** - * SECTION:element-gstavcsrc - * - * The avcsrc element captures video from an OS/X AVC Video Services - * devices, typically a FireWire camera. - * - * <refsect2> - * <title>Example launch line</title> - * |[ - * gst-launch -v avcsrc ! decodebin ! osxvideosink - * ]| - * - * This pipeline captures from an AVC source, decodes the stream (either - * DV or HDV), and displays the video. - * </refsect2> - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <AVCVideoServices/AVCVideoServices.h> -using namespace AVS; - -#include <gst/gst.h> -#include <gst/base/gstbasesrc.h> -#include "gstavcsrc.h" - -GST_DEBUG_CATEGORY_STATIC (gst_avc_src_debug_category); -#define GST_CAT_DEFAULT gst_avc_src_debug_category - -/* prototypes */ - - -static void gst_avc_src_set_property (GObject * object, - guint property_id, const GValue * value, GParamSpec * pspec); -static void gst_avc_src_get_property (GObject * object, - guint property_id, GValue * value, GParamSpec * pspec); -static void gst_avc_src_dispose (GObject * object); -static void gst_avc_src_finalize (GObject * object); - -static GstCaps *gst_avc_src_get_caps (GstBaseSrc * src); -static gboolean gst_avc_src_start (GstBaseSrc * src); -static gboolean gst_avc_src_stop (GstBaseSrc * src); -static gboolean gst_avc_src_is_seekable (GstBaseSrc * src); -static gboolean gst_avc_src_unlock (GstBaseSrc * src); -static gboolean gst_avc_src_event (GstBaseSrc * src, GstEvent * event); -static GstFlowReturn -gst_avc_src_create (GstBaseSrc * src, guint64 offset, guint size, - GstBuffer ** buf); -static gboolean gst_avc_src_query (GstBaseSrc * src, GstQuery * query); -static gboolean gst_avc_src_unlock_stop (GstBaseSrc * src); - -enum -{ - PROP_0 -}; - -/* pad templates */ - -static GstStaticPadTemplate gst_avc_src_src_template = - GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS - ("video/dv,systemstream=true;video/mpegts,systemstream=true,packetsize=188") - ); - - -/* class initialization */ - -#define DEBUG_INIT(bla) \ - GST_DEBUG_CATEGORY_INIT (gst_avc_src_debug_category, "avcsrc", 0, \ - "debug category for avcsrc element"); - -GST_BOILERPLATE_FULL (GstAVCSrc, gst_avc_src, GstBaseSrc, - GST_TYPE_BASE_SRC, DEBUG_INIT); - -static void -gst_avc_src_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_static_pad_template (element_class, &gst_avc_src_src_template); - - gst_element_class_set_static_metadata (element_class, - "AVC Video Services Source", "Video/Source", - "Captures DV or HDV video from Firewire port", - "David Schleef <ds@entropywave.com>"); -} - -static void -gst_avc_src_class_init (GstAVCSrcClass * klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass); - - gobject_class->set_property = gst_avc_src_set_property; - gobject_class->get_property = gst_avc_src_get_property; - gobject_class->dispose = gst_avc_src_dispose; - gobject_class->finalize = gst_avc_src_finalize; - base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_avc_src_get_caps); - base_src_class->start = GST_DEBUG_FUNCPTR (gst_avc_src_start); - base_src_class->stop = GST_DEBUG_FUNCPTR (gst_avc_src_stop); - base_src_class->is_seekable = GST_DEBUG_FUNCPTR (gst_avc_src_is_seekable); - base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_avc_src_unlock); - base_src_class->event = GST_DEBUG_FUNCPTR (gst_avc_src_event); - base_src_class->create = GST_DEBUG_FUNCPTR (gst_avc_src_create); - if (0) - base_src_class->query = GST_DEBUG_FUNCPTR (gst_avc_src_query); - if (0) - base_src_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_avc_src_unlock_stop); - -} - -static void -gst_avc_src_init (GstAVCSrc * avcsrc, GstAVCSrcClass * avcsrc_class) -{ - gst_base_src_set_live (GST_BASE_SRC (avcsrc), TRUE); - - avcsrc->srcpad = gst_pad_new_from_static_template (&gst_avc_src_src_template, - "src"); - - avcsrc->queue = gst_atomic_queue_new (16); - avcsrc->cond = g_cond_new (); - avcsrc->queue_lock = g_mutex_new (); -} - -void -gst_avc_src_set_property (GObject * object, guint property_id, - const GValue * value, GParamSpec * pspec) -{ - /* GstAVCSrc *avcsrc = GST_AVC_SRC (object); */ - - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -void -gst_avc_src_get_property (GObject * object, guint property_id, - GValue * value, GParamSpec * pspec) -{ - /* GstAVCSrc *avcsrc = GST_AVC_SRC (object); */ - - switch (property_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -void -gst_avc_src_dispose (GObject * object) -{ - /* GstAVCSrc *avcsrc = GST_AVC_SRC (object); */ - - /* clean up as possible. may be called multiple times */ - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -void -gst_avc_src_finalize (GObject * object) -{ - GstAVCSrc *avcsrc = GST_AVC_SRC (object); - - /* clean up object here */ - gst_atomic_queue_unref (avcsrc->queue); - g_cond_free (avcsrc->cond); - g_mutex_free (avcsrc->queue_lock); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - - -static GstCaps * -gst_avc_src_get_caps (GstBaseSrc * src) -{ - /* GstAVCSrc *avcsrc = GST_AVC_SRC (src); */ - - return gst_caps_from_string ("video/mpegts,systemstream=true,packetsize=188"); -} - -#define kNumCyclesInMPEGReceiverSegment 200 -#define kNumSegmentsInMPEGReceiverProgram 10 - -void -MPEGReceiverMessageReceivedProc (UInt32 msg, UInt32 param1, UInt32 param2, - void *pRefCon) -{ - -} - -IOReturn -MyStructuredDataPushProc (UInt32 CycleDataCount, - MPEGReceiveCycleData * pCycleData, void *pRefCon) -{ - GstAVCSrc *avcsrc = GST_AVC_SRC (pRefCon); - - if (avcsrc) { - UInt32 numPackets = 0; - for (UInt32 cycle = 0; cycle < CycleDataCount; cycle++) - numPackets += pCycleData[cycle].tsPacketCount; - GstBuffer *buffer; - - buffer = gst_buffer_new_and_alloc (numPackets*kMPEG2TSPacketSize); - - guint8 *data = GST_BUFFER_DATA (buffer); - - for (UInt32 cycle = 0; cycle < CycleDataCount; cycle++) { - GST_LOG("Received cycle %lu of %lu - %lu packets (fw time %lx)", - cycle, CycleDataCount, pCycleData[cycle].tsPacketCount, - pCycleData[cycle].fireWireTimeStamp); - for (UInt32 sourcePacket = 0; sourcePacket < pCycleData[cycle].tsPacketCount; - sourcePacket++) { - memcpy (data, - pCycleData[cycle].pBuf[sourcePacket], kMPEG2TSPacketSize); - data += kMPEG2TSPacketSize; - - avcsrc->packets_enqueued++; - } - } - - gst_atomic_queue_push (avcsrc->queue, buffer); - - g_mutex_lock (avcsrc->queue_lock); - g_cond_signal (avcsrc->cond); - g_mutex_unlock (avcsrc->queue_lock); - } - - return 0; -} - -static gboolean -gst_avc_src_start (GstBaseSrc * src) -{ - GstAVCSrc *avcsrc = GST_AVC_SRC (src); - - GST_DEBUG_OBJECT (avcsrc, "start"); - - avcsrc->unlock = FALSE; - - // Create a AVCDeviceController - if (!avcsrc->pAVCDeviceController) - CreateAVCDeviceController (&avcsrc->pAVCDeviceController); - if (!avcsrc->pAVCDeviceController) { - // TODO: This should never happen (unless we've run out of memory), but we should handle it cleanly anyway - GST_ERROR ("Failed to create AVC device controller."); - return FALSE; - } - - GST_INFO ("Created AVC device controller."); - - if (avcsrc->deviceIndex >= CFArrayGetCount (avcsrc->pAVCDeviceController->avcDeviceArray)) { - GST_ERROR ("Failed to find AVC device %d", avcsrc->deviceIndex); - return FALSE; - } - - avcsrc->pAVCDevice = (AVCDevice *) - CFArrayGetValueAtIndex (avcsrc->pAVCDeviceController->avcDeviceArray, - avcsrc->deviceIndex); - - if (!avcsrc->pAVCDevice) { - GST_ERROR ("Failed to find AVC device %d", avcsrc->deviceIndex); - return FALSE; - } - - GST_INFO ("Found device with GUID 0x%016llX\n", avcsrc->pAVCDevice->guid); - - avcsrc->pAVCDevice->openDevice (nil, nil); - - avcsrc->pAVCDeviceStream = avcsrc->pAVCDevice->CreateMPEGReceiverForDevicePlug (0, nil, // We'll install the structured callback later (MyStructuredDataPushProc), - nil, - MPEGReceiverMessageReceivedProc, - nil, - nil, kNumCyclesInMPEGReceiverSegment, kNumSegmentsInMPEGReceiverProgram); - - avcsrc->pAVCDeviceStream->pMPEGReceiver->registerStructuredDataPushCallback - (MyStructuredDataPushProc, - kNumCyclesInMPEGReceiverSegment, (void *) avcsrc); - - avcsrc->pAVCDevice->StartAVCDeviceStream (avcsrc->pAVCDeviceStream); - - return TRUE; -} - -static gboolean -gst_avc_src_stop (GstBaseSrc * src) -{ - GstAVCSrc *avcsrc = GST_AVC_SRC (src); - GstBuffer *buffer; - - GST_DEBUG_OBJECT (avcsrc, "stop"); - - // Stop the stream - avcsrc->pAVCDevice->StopAVCDeviceStream(avcsrc->pAVCDeviceStream); - // Destroy the stream - avcsrc->pAVCDevice->DestroyAVCDeviceStream(avcsrc->pAVCDeviceStream); - avcsrc->pAVCDeviceStream = nil; - - // Forget about the device (don't destroy it; pAVCDeviceController manages it) - avcsrc->pAVCDevice = nil; - - GST_DEBUG("Packets enqueued = %llu", avcsrc->packets_enqueued); - GST_DEBUG("Packets dequeued = %llu", avcsrc->packets_dequeued); - - while ((buffer = GST_BUFFER (gst_atomic_queue_pop (avcsrc->queue))) != NULL) { - gst_buffer_unref (buffer); - } - - return TRUE; -} - -static gboolean -gst_avc_src_is_seekable (GstBaseSrc * src) -{ - GstAVCSrc *avcsrc = GST_AVC_SRC (src); - - GST_DEBUG_OBJECT (avcsrc, "is_seekable"); - - return FALSE; -} - -static gboolean -gst_avc_src_unlock (GstBaseSrc * src) -{ - GstAVCSrc *avcsrc = GST_AVC_SRC (src); - - GST_DEBUG_OBJECT (avcsrc, "unlock"); - - g_mutex_lock (avcsrc->queue_lock); - avcsrc->unlock = TRUE; - g_cond_signal (avcsrc->cond); - g_mutex_unlock (avcsrc->queue_lock); - - return TRUE; -} - -static gboolean -gst_avc_src_event (GstBaseSrc * src, GstEvent * event) -{ - GstAVCSrc *avcsrc = GST_AVC_SRC (src); - - GST_DEBUG_OBJECT (avcsrc, "event of type '%s'", GST_EVENT_TYPE_NAME(event)); - - GST_DEBUG("Packets enqueued = %llu, dequeued = %llu", - avcsrc->packets_enqueued, avcsrc->packets_dequeued); - - return TRUE; -} - -static GstFlowReturn -gst_avc_src_create (GstBaseSrc * src, guint64 offset, guint size, - GstBuffer ** buf) -{ - GstAVCSrc *avcsrc = GST_AVC_SRC (src); - GstBuffer *buffer; - - GST_DEBUG_OBJECT (avcsrc, "create"); - - g_mutex_lock (avcsrc->queue_lock); - buffer = GST_BUFFER (gst_atomic_queue_pop (avcsrc->queue)); - while (buffer == NULL && !avcsrc->unlock) { - g_cond_wait (avcsrc->cond, avcsrc->queue_lock); - buffer = GST_BUFFER (gst_atomic_queue_pop (avcsrc->queue)); - } - g_mutex_unlock (avcsrc->queue_lock); - - if (avcsrc->unlock) { - if (buffer) - gst_buffer_unref (buffer); - return GST_FLOW_FLUSHING; - } - - gst_buffer_set_caps (buffer, GST_PAD_CAPS (avcsrc->srcpad)); - - *buf = buffer; - - avcsrc->packets_dequeued++; - - return GST_FLOW_OK; -} - -static gboolean -gst_avc_src_query (GstBaseSrc * src, GstQuery * query) -{ - GstAVCSrc *avcsrc = GST_AVC_SRC (src); - - GST_DEBUG_OBJECT (avcsrc, "query"); - - return TRUE; -} - -static gboolean -gst_avc_src_unlock_stop (GstBaseSrc * src) -{ - GstAVCSrc *avcsrc = GST_AVC_SRC (src); - - GST_DEBUG_OBJECT (avcsrc, "stop"); - - return TRUE; -} diff --git a/sys/avc/gstavcsrc.h b/sys/avc/gstavcsrc.h deleted file mode 100644 index 81c6f1c71..000000000 --- a/sys/avc/gstavcsrc.h +++ /dev/null @@ -1,67 +0,0 @@ -/* GStreamer - * Copyright (C) 2011 FIXME <fixme@example.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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _GST_AVC_SRC_H_ -#define _GST_AVC_SRC_H_ - -#include <gst/base/gstbasesrc.h> -#include <AVCVideoServices/AVCVideoServices.h> -using namespace AVS; - -G_BEGIN_DECLS - -#define GST_TYPE_AVC_SRC (gst_avc_src_get_type()) -#define GST_AVC_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVC_SRC,GstAVCSrc)) -#define GST_AVC_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVC_SRC,GstAVCSrcClass)) -#define GST_IS_AVC_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVC_SRC)) -#define GST_IS_AVC_SRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVC_SRC)) - -typedef struct _GstAVCSrc GstAVCSrc; -typedef struct _GstAVCSrcClass GstAVCSrcClass; - -struct _GstAVCSrc -{ - GstBaseSrc base_avcsrc; - - GstPad *srcpad; - - AVCDeviceController *pAVCDeviceController; - AVCDevice *pAVCDevice; - AVCDeviceStream *pAVCDeviceStream; - int deviceIndex; - - guint64 packets_enqueued; - guint64 packets_dequeued; - - GstAtomicQueue *queue; - GCond *cond; - GMutex *queue_lock; - gboolean unlock; -}; - -struct _GstAVCSrcClass -{ - GstBaseSrcClass base_avcsrc_class; -}; - -GType gst_avc_src_get_type (void); - -G_END_DECLS - -#endif diff --git a/sys/dxr3/.gitignore b/sys/dxr3/.gitignore deleted file mode 100644 index 58fd01e03..000000000 --- a/sys/dxr3/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dxr3marshal.c diff --git a/sys/dxr3/Makefile.am b/sys/dxr3/Makefile.am deleted file mode 100644 index dc81c0c44..000000000 --- a/sys/dxr3/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ - -plugin_LTLIBRARIES = libgstdxr3.la - -libgstdxr3_la_SOURCES = dxr3videosink.c dxr3audiosink.c dxr3spusink.c \ - dxr3init.c ac3_padder.c -nodist_libgstdxr3_la_SOURCES = dxr3marshal.c -libgstdxr3_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_CFLAGS) -libgstdxr3_la_LIBADD = -libgstdxr3_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstdxr3_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) - -BUILT_SOURCES = dxr3marshal.c dxr3marshal.h -built_headers = dxr3marshal.h - -noinst_HEADERS = dxr3videosink.h dxr3audiosink.h dxr3spusink.h \ - dxr3common.h ac3_padder.h - -EXTRA_DIST = dxr3marshal.list - - -dxr3marshal.h: dxr3marshal.list - glib-genmarshal --header --prefix=dxr3_marshal $^ > dxr3marshal.h.tmp - mv dxr3marshal.h.tmp dxr3marshal.h - -dxr3marshal.c: dxr3marshal.list - echo "#include \"dxr3marshal.h\"" >> dxr3marshal.c.tmp - glib-genmarshal --body --prefix=dxr3_marshal $^ >> dxr3marshal.c.tmp - mv dxr3marshal.c.tmp dxr3marshal.c - -CLEANFILES = $(BUILT_SOURCES) diff --git a/sys/dxr3/ac3_padder.c b/sys/dxr3/ac3_padder.c deleted file mode 100644 index e64c88bfb..000000000 --- a/sys/dxr3/ac3_padder.c +++ /dev/null @@ -1,254 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net> - * - * ac3_padder.c: Pad AC3 frames for use with an SPDIF interface. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <string.h> - -#include "ac3_padder.h" - -#define IEC61937_DATA_TYPE_AC3 1 - -struct frmsize_s -{ - unsigned short bit_rate; - unsigned short frm_size[3]; -}; - - -static const struct frmsize_s frmsizecod_tbl[64] = { - {32, {64, 69, 96}}, - {32, {64, 70, 96}}, - {40, {80, 87, 120}}, - {40, {80, 88, 120}}, - {48, {96, 104, 144}}, - {48, {96, 105, 144}}, - {56, {112, 121, 168}}, - {56, {112, 122, 168}}, - {64, {128, 139, 192}}, - {64, {128, 140, 192}}, - {80, {160, 174, 240}}, - {80, {160, 175, 240}}, - {96, {192, 208, 288}}, - {96, {192, 209, 288}}, - {112, {224, 243, 336}}, - {112, {224, 244, 336}}, - {128, {256, 278, 384}}, - {128, {256, 279, 384}}, - {160, {320, 348, 480}}, - {160, {320, 349, 480}}, - {192, {384, 417, 576}}, - {192, {384, 418, 576}}, - {224, {448, 487, 672}}, - {224, {448, 488, 672}}, - {256, {512, 557, 768}}, - {256, {512, 558, 768}}, - {320, {640, 696, 960}}, - {320, {640, 697, 960}}, - {384, {768, 835, 1152}}, - {384, {768, 836, 1152}}, - {448, {896, 975, 1344}}, - {448, {896, 976, 1344}}, - {512, {1024, 1114, 1536}}, - {512, {1024, 1115, 1536}}, - {576, {1152, 1253, 1728}}, - {576, {1152, 1254, 1728}}, - {640, {1280, 1393, 1920}}, - {640, {1280, 1394, 1920}} -}; - - - -/* Go one byte forward in the input buffer. */ -#define ac3p_in_fw(padder) ((padder)->in_ptr++, (padder)->remaining--) - -/* Go one byte forward in the output buffer. */ -#define ac3p_out_fw(padder) ((padder)->out_ptr++, (padder)->bytes_to_copy--) - - -/** - * ac3p_init: - * @padder: The padder structure to initialize. - * - * Initializes an AC3 stream padder. This structure can be - * subsequently used to parse an AC3 stream and convert it to IEC958 - * (S/PDIF) padded packets. - */ -extern void -ac3p_init (ac3_padder * padder) -{ - const char sync[4] = { 0x72, 0xF8, 0x1F, 0x4E }; - - padder->state = AC3P_STATE_SYNC1; - - /* No material to read yet. */ - padder->remaining = 0; - - /* Initialize the sync bytes in the frame. */ - memcpy (padder->frame.header, sync, 4); -} - - -/** - * ac3_push_data: - * @padder: The padder structure. - * @data: A pointer to a buffer with new data to parse. This should - * correspond to a new piece of a stream containing raw AC3 data. - * @size: The number of available bytes in the buffer. - * - * Pushes a new buffer of data to be parsed by the ac3 padder. The - * ac3_parse() function will actually parse the data and report when - * new frames are found. This funcion should only be called once at - * the beginning of the parsing process, or when the ac3_parse() - * function returns the %AC3P_EVENT_PUSH event. - */ -extern void -ac3p_push_data (ac3_padder * padder, guchar * data, guint size) -{ - padder->in_ptr = data; - padder->remaining = size; -} - - -/** - * ac3p_parse: - * @padder: The padder structure. - * - * Parses the bytes already pushed into the padder structure (see - * ac3p_push_data()) and returns an event value depending on the - * results of the parsing. - * - * Returns: %AC3P_EVENT_FRAME to indicate that a new AC3 was found and - * padded for IEC958 transmission. This frame can be read inmediatly - * with ac3p_frame(). %AC3P_EVENT_PUSH to indicate that new data from - * the input stream must be pushed into the padder using - * ac3p_push_data(). This function should be called again after - * pushing the data. - */ -extern int -ac3p_parse (ac3_padder * padder) -{ - while (padder->remaining > 0) { - switch (padder->state) { - case AC3P_STATE_SYNC1: - if (*(padder->in_ptr) == 0x0b) { - /* The first sync byte was found. Go to the next state. */ - padder->frame.sync_byte1 = 0x0b; - padder->state = AC3P_STATE_SYNC2; - } - ac3p_in_fw (padder); - break; - - case AC3P_STATE_SYNC2: - if (*(padder->in_ptr) == 0x77) { - /* The second sync byte was seen right after the first. Go to - the next state. */ - padder->frame.sync_byte2 = 0x77; - padder->state = AC3P_STATE_HEADER; - - /* Skip one byte. */ - ac3p_in_fw (padder); - - /* Prepare for reading the header. */ - padder->out_ptr = (guchar *) & (padder->frame.crc1); - /* Discount the 2 sync bytes from the header size. */ - padder->bytes_to_copy = AC3P_AC3_HEADER_SIZE - 2; - } else { - /* The second sync byte was not seen. Go back to the - first state. */ - padder->state = AC3P_STATE_SYNC1; - } - break; - - case AC3P_STATE_HEADER: - if (padder->bytes_to_copy > 0) { - /* Copy one byte. */ - *(padder->out_ptr) = *(padder->in_ptr); - ac3p_in_fw (padder); - ac3p_out_fw (padder); - } else { - int fscod; - - /* The header is ready: */ - - fscod = (padder->frame.code >> 6) & 0x03; - - /* Calculate the frame size. */ - padder->ac3_frame_size = - 2 * frmsizecod_tbl[padder->frame.code & 0x3f].frm_size[fscod]; - - /* Set up the IEC header. */ - if (padder->ac3_frame_size > 0) { - padder->frame.header[4] = IEC61937_DATA_TYPE_AC3; - } else { - /* Don't know what it is, better be careful. */ - padder->state = AC3P_STATE_SYNC1; - break; - } - padder->frame.header[5] = 0x00; - padder->frame.header[6] = (padder->ac3_frame_size * 8) & 0xFF; - padder->frame.header[7] = ((padder->ac3_frame_size * 8) >> 8) & 0xFF; - - /* Prepare for reading the body. */ - padder->bytes_to_copy = padder->ac3_frame_size - AC3P_AC3_HEADER_SIZE; - padder->state = AC3P_STATE_CONTENT; - } - break; - - case AC3P_STATE_CONTENT: - if (padder->bytes_to_copy > 0) { - /* Copy one byte. */ - *(padder->out_ptr) = *(padder->in_ptr); - ac3p_in_fw (padder); - ac3p_out_fw (padder); - } else { - guint16 *ptr, i; - - /* Frame ready. Prepare for output: */ - - /* Zero the non AC3 portion of the padded frame. */ - memset (&(padder->frame.sync_byte1) + padder->ac3_frame_size, 0, - AC3P_IEC_FRAME_SIZE - AC3P_IEC_HEADER_SIZE - - padder->ac3_frame_size); - - /* Fix the byte order in the AC3 portion: */ - ptr = (guint16 *) & (padder->frame.sync_byte1); - i = padder->ac3_frame_size / 2; - while (i > 0) { - *ptr = GUINT16_TO_BE (*ptr); - ptr++; - i--; - } - - /* Start over again. */ - padder->state = AC3P_STATE_SYNC1; - - return AC3P_EVENT_FRAME; - } - break; - } - } - - return AC3P_EVENT_PUSH; -} diff --git a/sys/dxr3/ac3_padder.h b/sys/dxr3/ac3_padder.h deleted file mode 100644 index 7c0313810..000000000 --- a/sys/dxr3/ac3_padder.h +++ /dev/null @@ -1,129 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net> - * - * ac3_padder.h: Pad AC3 frames for use with an SPDIF interface. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef AC3_PADDER_INC -#define AC3_PADDER_INC - -#include <glib.h> - - -/* Size of an IEC958 padded AC3 frame. */ -#define AC3P_IEC_FRAME_SIZE 6144 -/* Size of the IEC958 header. */ -#define AC3P_IEC_HEADER_SIZE 8 -/* Size of the AC3 header. */ -#define AC3P_AC3_HEADER_SIZE 7 - - -/* An IEC958 padded AC3 frame. */ -typedef struct { - /* IEC header. */ - guchar header[AC3P_IEC_HEADER_SIZE]; - - /* Begin of AC3 header. */ - guchar sync_byte1; - guchar sync_byte2; - - guchar crc1[2]; - guchar code; - guchar bsidmod; - guchar acmod; - /* End of AC3 header. */ - - unsigned char data[AC3P_IEC_FRAME_SIZE - AC3P_IEC_HEADER_SIZE - - AC3P_AC3_HEADER_SIZE]; -} ac3p_iec958_burst_frame; - - -/* Possible states for the reading automaton: */ - -/* Searching for sync byte 1. */ -#define AC3P_STATE_SYNC1 1 -/* Searching for sync byte 2. */ -#define AC3P_STATE_SYNC2 2 -/* Reading AC3 header. */ -#define AC3P_STATE_HEADER 3 -/* Reading packet contents.*/ -#define AC3P_STATE_CONTENT 4 - - -/* Events generated by the parse function: */ - -/* The parser needs new data to be pushed. */ -#define AC3P_EVENT_PUSH 1 -/* There is a new padded frame ready to read from the padder structure. */ -#define AC3P_EVENT_FRAME 2 - - -/* The internal state for the padder. */ -typedef struct { - guint state; /* State of the reading automaton. */ - - guchar *in_ptr; /* Input pointer, marking the current - postion in the input buffer. */ - guint remaining; /* The number of bytes remaining in the current - reading buffer. */ - - guchar *out_ptr; /* Output pointer, marking the current - position in the output frame. */ - guint bytes_to_copy; - /* Number of bytes that still must be copied - to the output frame *during this reading - stage*. */ - - guint ac3_frame_size; - /* The size in bytes of the pure AC3 portion - of the current frame. */ - - ac3p_iec958_burst_frame frame; - /* The current output frame. */ -} ac3_padder; - - - -extern void -ac3p_init(ac3_padder *padder); - -extern void -ac3p_push_data(ac3_padder *padder, guchar *data, guint size); - -extern int -ac3p_parse(ac3_padder *padder); - - -/* - * ac3p_frame - * @padder The padder structure. - * - * Returns a pointer to the padded frame contained in the padder. - */ -#define ac3p_frame(padder) ((guint *) &((padder)->frame)) - -/* - * ac3p_frame_size - * @padder The padder structure. - * - * Returns the length in bytes of the last read raw AC3 frame. - */ -#define ac3p_frame_size(padder) ((padder)->ac3_frame_size) - - -#endif diff --git a/sys/dxr3/dxr3audiosink.c b/sys/dxr3/dxr3audiosink.c deleted file mode 100644 index 9638feb01..000000000 --- a/sys/dxr3/dxr3audiosink.c +++ /dev/null @@ -1,740 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net> - * - * dxr3audiosink.c: Audio sink for em8300 based DVD cards. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <errno.h> -#include <string.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/ioctl.h> - -#include <linux/soundcard.h> -#include <linux/em8300.h> - -#include <gst/gst-i18n-plugin.h> -#include <gst/gst.h> - -#include "dxr3audiosink.h" -#include "dxr3marshal.h" -#include "dxr3common.h" - -/* Our only supported AC3 byte rate. */ -#define AC3_BYTE_RATE 48000 - -/* Determines the amount of time to play the given number of bytes of - the original AC3 stream. The result is expressed as MPEG2. */ -#define TIME_FOR_BYTES(bytes) (((bytes) * 90) / 48) - -/* Dxr3AudioSink signals and args */ -enum -{ - SIGNAL_FLUSHED, - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_DIGITAL_PCM -}; - -static GstStaticPadTemplate dxr3audiosink_pcm_sink_factory = -GST_STATIC_PAD_TEMPLATE ("pcm_sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) BYTE_ORDER, " - "signed = (boolean) TRUE, " - "width = (int) 16, " - "depth = (int) 16, " - "rate = (int) { 32000, 44100, 48000, 66000 }, " "channels = (int) 2") - ); - -static GstStaticPadTemplate dxr3audiosink_ac3_sink_factory = -GST_STATIC_PAD_TEMPLATE ("ac3_sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-ac3" - /* no parameters needed, we don't need a parsed stream */ - ) - ); - - -static void dxr3audiosink_class_init (Dxr3AudioSinkClass * klass); -static void dxr3audiosink_base_init (Dxr3AudioSinkClass * klass); -static void dxr3audiosink_init (Dxr3AudioSink * sink); - -static void dxr3audiosink_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void dxr3audiosink_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - -static gboolean dxr3audiosink_open (Dxr3AudioSink * sink); -static gboolean dxr3audiosink_set_mode_pcm (Dxr3AudioSink * sink); -static gboolean dxr3audiosink_set_mode_ac3 (Dxr3AudioSink * sink); -static void dxr3audiosink_close (Dxr3AudioSink * sink); -static gboolean dxr3audiosink_set_clock (GstElement * element, - GstClock * clock); - -static GstPadLinkReturn dxr3audiosink_pcm_sinklink (GstPad * pad, - const GstCaps * caps); -static void dxr3audiosink_set_scr (Dxr3AudioSink * sink, guint32 scr); - -static gboolean dxr3audiosink_handle_event (GstPad * pad, GstEvent * event); -static void dxr3audiosink_chain_pcm (GstPad * pad, GstData * buf); -static void dxr3audiosink_chain_ac3 (GstPad * pad, GstData * buf); - -/* static void dxr3audiosink_wait (Dxr3AudioSink *sink, */ -/* GstClockTime time); */ -/* static int dxr3audiosink_mvcommand (Dxr3AudioSink *sink, */ -/* int command); */ - -static GstStateChangeReturn dxr3audiosink_change_state (GstElement * element, - GstStateChange transition); - -static void dxr3audiosink_flushed (Dxr3AudioSink * sink); - -static GstElementClass *parent_class = NULL; -static guint dxr3audiosink_signals[LAST_SIGNAL] = { 0 }; - - -extern GType -dxr3audiosink_get_type (void) -{ - static GType dxr3audiosink_type = 0; - - if (!dxr3audiosink_type) { - static const GTypeInfo dxr3audiosink_info = { - sizeof (Dxr3AudioSinkClass), - (GBaseInitFunc) dxr3audiosink_base_init, - NULL, - (GClassInitFunc) dxr3audiosink_class_init, - NULL, - NULL, - sizeof (Dxr3AudioSink), - 0, - (GInstanceInitFunc) dxr3audiosink_init, - }; - - dxr3audiosink_type = g_type_register_static (GST_TYPE_ELEMENT, - "Dxr3AudioSink", &dxr3audiosink_info, 0); - } - - return dxr3audiosink_type; -} - - -static void -dxr3audiosink_base_init (Dxr3AudioSinkClass * klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_static_pad_template (element_class, - &dxr3audiosink_pcm_sink_factory); - gst_element_class_add_static_pad_template (element_class, - &dxr3audiosink_ac3_sink_factory); - gst_element_class_set_static_metadata (element_class, - "dxr3/Hollywood+ mpeg decoder board audio plugin", "Audio/Sink", - "Feeds audio to Sigma Designs em8300 based boards", - "Martin Soto <martinsoto@users.sourceforge.net>"); -} - -static void -dxr3audiosink_class_init (Dxr3AudioSinkClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - dxr3audiosink_signals[SIGNAL_FLUSHED] = - g_signal_new ("flushed", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Dxr3AudioSinkClass, flushed), - NULL, NULL, dxr3_marshal_VOID__VOID, G_TYPE_NONE, 0); - - klass->flushed = dxr3audiosink_flushed; - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DIGITAL_PCM, - g_param_spec_boolean ("digital-pcm", "Digital PCM", - "Use the digital output for PCM sound", FALSE, G_PARAM_READWRITE)); - - gobject_class->set_property = dxr3audiosink_set_property; - gobject_class->get_property = dxr3audiosink_get_property; - - gstelement_class->change_state = dxr3audiosink_change_state; - gstelement_class->set_clock = dxr3audiosink_set_clock; -} - - -static void -dxr3audiosink_init (Dxr3AudioSink * sink) -{ - GstPadTemplate *temp; - - /* Create the PCM pad. */ - temp = gst_static_pad_template_get (&dxr3audiosink_pcm_sink_factory); - sink->pcm_sinkpad = gst_pad_new_from_template (temp, "pcm_sink"); - gst_pad_set_chain_function (sink->pcm_sinkpad, dxr3audiosink_chain_pcm); - gst_pad_set_link_function (sink->pcm_sinkpad, dxr3audiosink_pcm_sinklink); - gst_element_add_pad (GST_ELEMENT (sink), sink->pcm_sinkpad); - - /* Create the AC3 pad. */ - temp = gst_static_pad_template_get (&dxr3audiosink_ac3_sink_factory); - sink->ac3_sinkpad = gst_pad_new_from_template (temp, "ac3_sink"); - gst_pad_set_chain_function (sink->ac3_sinkpad, dxr3audiosink_chain_ac3); - gst_element_add_pad (GST_ELEMENT (sink), sink->ac3_sinkpad); - - GST_OBJECT_FLAG_SET (GST_ELEMENT (sink), GST_ELEMENT_EVENT_AWARE); - - sink->card_number = 0; - - sink->audio_filename = NULL; - sink->audio_fd = -1; - - sink->control_filename = NULL; - sink->control_fd = -1; - - /* Since we don't know any better, we set the initial scr to 0. */ - sink->scr = 0; - - /* Initially don't use digital output. */ - sink->digital_pcm = FALSE; - - /* Initially there's no padder. */ - sink->padder = NULL; - - sink->mode = DXR3AUDIOSINK_MODE_NONE; -} - - -static void -dxr3audiosink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - Dxr3AudioSink *sink; - - sink = DXR3AUDIOSINK (object); - - switch (prop_id) { - case ARG_DIGITAL_PCM: - sink->digital_pcm = g_value_get_boolean (value); - /* Refresh the setup of the device. */ - if (sink->mode == DXR3AUDIOSINK_MODE_PCM) { - dxr3audiosink_set_mode_pcm (sink); - } - g_object_notify (G_OBJECT (sink), "digital-pcm"); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - - -static void -dxr3audiosink_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - Dxr3AudioSink *sink; - - g_return_if_fail (GST_IS_DXR3AUDIOSINK (object)); - - sink = DXR3AUDIOSINK (object); - - switch (prop_id) { - case ARG_DIGITAL_PCM: - g_value_set_boolean (value, sink->digital_pcm); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - - -static gboolean -dxr3audiosink_open (Dxr3AudioSink * sink) -{ - g_return_val_if_fail (!GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN), - FALSE); - - /* Compute the name of the audio device file. */ - sink->audio_filename = g_strdup_printf ("/dev/em8300_ma-%d", - sink->card_number); - - sink->audio_fd = open (sink->audio_filename, O_WRONLY); - if (sink->audio_fd < 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, - (_("Could not open audio device \"%s\" for writing."), - sink->audio_filename), GST_ERROR_SYSTEM); - return FALSE; - } - - /* Open the control device. */ - sink->control_filename = g_strdup_printf ("/dev/em8300-%d", - sink->card_number); - - sink->control_fd = open (sink->control_filename, O_WRONLY); - if (sink->control_fd < 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, - (_("Could not open control device \"%s\" for writing."), - sink->control_filename), GST_ERROR_SYSTEM); - return FALSE; - } - - GST_OBJECT_FLAG_SET (sink, DXR3AUDIOSINK_OPEN); - - dxr3audiosink_set_mode_pcm (sink); - - return TRUE; -} - - -/** - * dxr3audiosink_set_mode: - * @sink: The sink element to operate on. - * - * Set the operation mode of the element to PCM. - */ -static gboolean -dxr3audiosink_set_mode_pcm (Dxr3AudioSink * sink) -{ - int tmp, oss_mode, audiomode; - - if (sink->audio_fd == -1 || sink->control_fd == -1) { - return FALSE; - } - - /* Set the audio device mode. */ - oss_mode = (G_BYTE_ORDER == G_BIG_ENDIAN ? AFMT_S16_BE : AFMT_S16_LE); - tmp = oss_mode; - if (ioctl (sink->audio_fd, SNDCTL_DSP_SETFMT, &tmp) < 0 || tmp != oss_mode) { - GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, - (_("Could not configure audio device \"%s\"."), sink->audio_filename), - GST_ERROR_SYSTEM); - return FALSE; - } - - /* Set the card's general audio output mode. */ - audiomode = sink->digital_pcm ? - EM8300_AUDIOMODE_DIGITALPCM : EM8300_AUDIOMODE_ANALOG; - ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode); - - /* Set the sampling rate. */ - tmp = sink->rate; - if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, - (_("Could not set audio device \"%s\" to %d Hz."), sink->audio_filename, - sink->rate), GST_ERROR_SYSTEM); - return FALSE; - } - - /* Get rid of the padder, if any. */ - if (sink->padder != NULL) { - g_free (sink->padder); - sink->padder = NULL; - } - - sink->mode = DXR3AUDIOSINK_MODE_PCM; - - return TRUE; -} - - -/** - * dxr3audiosink_set_mode: - * @sink: The sink element to operate on - * - * Set the operation mode of the element to AC3. - */ -static gboolean -dxr3audiosink_set_mode_ac3 (Dxr3AudioSink * sink) -{ - int tmp, audiomode; - - if (sink->audio_fd == -1 || sink->control_fd == -1) { - return FALSE; - } - - /* Set the sampling rate. */ - tmp = AC3_BYTE_RATE; - if (ioctl (sink->audio_fd, SNDCTL_DSP_SPEED, &tmp) < 0 || - tmp != AC3_BYTE_RATE) { - GST_ELEMENT_ERROR (sink, RESOURCE, SETTINGS, - (_("Could not set audio device \"%s\" to %d Hz."), sink->audio_filename, - AC3_BYTE_RATE), GST_ERROR_SYSTEM); - return FALSE; - } - - /* Set the card's general audio output mode to AC3. */ - audiomode = EM8300_AUDIOMODE_DIGITALAC3; - ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode); - - /* Create a padder if necessary, */ - if (sink->padder == NULL) { - sink->padder = g_malloc (sizeof (ac3_padder)); - ac3p_init (sink->padder); - } - - sink->mode = DXR3AUDIOSINK_MODE_AC3; - - return TRUE; -} - - -static void -dxr3audiosink_close (Dxr3AudioSink * sink) -{ - g_return_if_fail (GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN)); - - if (close (sink->audio_fd) != 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE, - (_("Could not close audio device \"%s\"."), sink->audio_filename), - GST_ERROR_SYSTEM); - return; - } - - if (close (sink->control_fd) != 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE, - (_("Could not close control device \"%s\"."), sink->audio_filename), - GST_ERROR_SYSTEM); - return; - } - - GST_OBJECT_FLAG_UNSET (sink, DXR3AUDIOSINK_OPEN); - - g_free (sink->audio_filename); - sink->audio_filename = NULL; - - g_free (sink->control_filename); - sink->control_filename = NULL; - - /* Get rid of the padder, if any. */ - if (sink->padder != NULL) { - g_free (sink->padder); - sink->padder = NULL; - } -} - - -static gboolean -dxr3audiosink_set_clock (GstElement * element, GstClock * clock) -{ - Dxr3AudioSink *src = DXR3AUDIOSINK (element); - - src->clock = clock; - - return GST_ELEMENT_CLASS (parent_class)->set_clock (element, clock); -} - - -static GstPadLinkReturn -dxr3audiosink_pcm_sinklink (GstPad * pad, const GstCaps * caps) -{ - Dxr3AudioSink *sink = DXR3AUDIOSINK (gst_pad_get_parent (pad)); - GstStructure *structure = gst_caps_get_structure (caps, 0); - gint rate; - - if (!gst_caps_is_fixed (caps)) { - return GST_PAD_LINK_DELAYED; - } - - gst_structure_get_int (structure, "rate", &rate); - sink->rate = rate; - - return GST_PAD_LINK_OK; -} - - -static void -dxr3audiosink_set_scr (Dxr3AudioSink * sink, guint32 scr) -{ - guint32 zero = 0; - -/* fprintf (stderr, "====== Adjusting SCR\n"); */ - ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &zero); - ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &scr); -} - - -static gboolean -dxr3audiosink_handle_event (GstPad * pad, GstEvent * event) -{ - GstEventType type; - Dxr3AudioSink *sink = DXR3AUDIOSINK (gst_pad_get_parent (pad)); - - type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN; - - switch (type) { - case GST_EVENT_FLUSH: - if (sink->control_fd >= 0) { - unsigned audiomode; - - if (sink->mode == DXR3AUDIOSINK_MODE_AC3) { - audiomode = EM8300_AUDIOMODE_DIGITALPCM; - ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode); - audiomode = EM8300_AUDIOMODE_DIGITALAC3; - ioctl (sink->control_fd, EM8300_IOCTL_SET_AUDIOMODE, &audiomode); - } - - /* Report the flush operation. */ - g_signal_emit (G_OBJECT (sink), - dxr3audiosink_signals[SIGNAL_FLUSHED], 0); - } - break; - default: - gst_pad_event_default (pad, event); - break; - } - - return TRUE; -} - - -static void -dxr3audiosink_chain_pcm (GstPad * pad, GstData * _data) -{ - Dxr3AudioSink *sink; - gint bytes_written = 0; - GstBuffer *buf; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (_data != NULL); - - sink = DXR3AUDIOSINK (gst_pad_get_parent (pad)); - - if (GST_IS_EVENT (_data)) { - dxr3audiosink_handle_event (pad, GST_EVENT (_data)); - return; - } - - buf = GST_BUFFER (_data); - - if (sink->mode != DXR3AUDIOSINK_MODE_PCM) { - /* Switch to PCM mode. */ - dxr3audiosink_set_mode_pcm (sink); - } - - if (GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN)) { - if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { - /* We have a new scr value. */ - sink->scr = GSTTIME_TO_MPEGTIME (GST_BUFFER_TIMESTAMP (buf)); - } - - /* Update the system reference clock (SCR) in the card. */ - { - unsigned in, out, odelay; - unsigned diff; - - ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &out); - - ioctl (sink->audio_fd, SNDCTL_DSP_GETODELAY, &odelay); - - in = MPEGTIME_TO_DXRTIME (sink->scr - (odelay * 90) / 192); - diff = in > out ? in - out : out - in; - if (diff > 1800) { - dxr3audiosink_set_scr (sink, in); - } - } - - /* Update our SCR value. */ - sink->scr += (unsigned) (GST_BUFFER_SIZE (buf) * - (90000.0 / ((float) sink->rate * 4))); - - /* Write the buffer to the sound device. */ - bytes_written = write (sink->audio_fd, GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf)); - if (bytes_written < GST_BUFFER_SIZE (buf)) { - fprintf (stderr, "dxr3audiosink: Warning: %d bytes should be " - "written, only %d bytes written\n", - GST_BUFFER_SIZE (buf), bytes_written); - } - } - - gst_buffer_unref (buf); -} - - -static void -dxr3audiosink_chain_ac3 (GstPad * pad, GstData * _data) -{ - Dxr3AudioSink *sink; - gint bytes_written = 0; - GstBuffer *buf; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (_data != NULL); - - sink = DXR3AUDIOSINK (gst_pad_get_parent (pad)); - - if (GST_IS_EVENT (_data)) { - dxr3audiosink_handle_event (pad, GST_EVENT (_data)); - return; - } - - buf = GST_BUFFER (_data); - - if (sink->mode != DXR3AUDIOSINK_MODE_AC3) { - /* Switch to AC3 mode. */ - dxr3audiosink_set_mode_ac3 (sink); - } - - if (GST_OBJECT_FLAG_IS_SET (sink, DXR3AUDIOSINK_OPEN)) { - int event; - - if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { - /* We have a new scr value. */ - -/* fprintf (stderr, "------ Audio Time %.04f\n", */ -/* (double) GST_BUFFER_TIMESTAMP (buf) / GST_SECOND); */ - - sink->scr = GSTTIME_TO_MPEGTIME (GST_BUFFER_TIMESTAMP (buf)); - } - - /* Push the new data into the padder. */ - ac3p_push_data (sink->padder, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); - - /* Parse the data. */ - event = ac3p_parse (sink->padder); - while (event != AC3P_EVENT_PUSH) { - switch (event) { - case AC3P_EVENT_FRAME: - /* We have a new frame: */ - - /* Update the system reference clock (SCR) in the card. */ - { - unsigned in, out, odelay; - unsigned diff; - - ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &out); - - ioctl (sink->audio_fd, SNDCTL_DSP_GETODELAY, &odelay); - /* 192000 bytes/sec */ - - in = MPEGTIME_TO_DXRTIME (sink->scr - (odelay * 90) / 192); - diff = in > out ? in - out : out - in; - if (diff > 1800) { - dxr3audiosink_set_scr (sink, in); - } - } - - /* Update our SCR value. */ - sink->scr += TIME_FOR_BYTES (ac3p_frame_size (sink->padder)); - - /* Write the frame to the sound device. */ - bytes_written = write (sink->audio_fd, ac3p_frame (sink->padder), - AC3P_IEC_FRAME_SIZE); - - if (bytes_written < AC3P_IEC_FRAME_SIZE) { - fprintf (stderr, "dxr3audiosink: Warning: %d bytes should be " - "written, only %d bytes written\n", - AC3P_IEC_FRAME_SIZE, bytes_written); - } - - break; - } - - event = ac3p_parse (sink->padder); - } - } - - gst_buffer_unref (buf); -} - -#if 0 -/** - * dxr3audiosink_wait: - * - * Make the sink wait the specified amount of time. - */ -static void -dxr3audiosink_wait (Dxr3AudioSink * sink, GstClockTime time) -{ - GstClockID id; - GstClockTimeDiff jitter; - GstClockReturn ret; - GstClockTime current_time = gst_clock_get_time (sink->clock); - - id = gst_clock_new_single_shot_id (sink->clock, current_time + time); - ret = gst_clock_id_wait (id, &jitter); - gst_clock_id_free (id); -} - - -static int -dxr3audiosink_mvcommand (Dxr3AudioSink * sink, int command) -{ - em8300_register_t regs; - - regs.microcode_register = 1; - regs.reg = 0; - regs.val = command; - - return ioctl (sink->control_fd, EM8300_IOCTL_WRITEREG, ®s); -} -#endif - -static GstStateChangeReturn -dxr3audiosink_change_state (GstElement * element, GstStateChange transition) -{ - g_return_val_if_fail (GST_IS_DXR3AUDIOSINK (element), - GST_STATE_CHANGE_FAILURE); - - if (GST_STATE_PENDING (element) == GST_STATE_NULL) { - if (GST_OBJECT_FLAG_IS_SET (element, DXR3AUDIOSINK_OPEN)) { - dxr3audiosink_close (DXR3AUDIOSINK (element)); - } - } else { - if (!GST_OBJECT_FLAG_IS_SET (element, DXR3AUDIOSINK_OPEN)) { - if (!dxr3audiosink_open (DXR3AUDIOSINK (element))) { - return GST_STATE_CHANGE_FAILURE; - } - } - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) { - return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - } - - return GST_STATE_CHANGE_SUCCESS; -} - - -/** - * dxr3audiosink_flushed: - * - * Default do nothing implementation for the "flushed" signal. The - * "flushed" signal will be fired right after flushing the hardware - * queues due to a received flush event - */ -static void -dxr3audiosink_flushed (Dxr3AudioSink * sink) -{ - /* Do nothing. */ -} diff --git a/sys/dxr3/dxr3audiosink.h b/sys/dxr3/dxr3audiosink.h deleted file mode 100644 index d1394a057..000000000 --- a/sys/dxr3/dxr3audiosink.h +++ /dev/null @@ -1,112 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net> - * - * dxr3audiosink.h: Audio sink for em8300 based DVD cards. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __DXR3AUDIOSINK_H__ -#define __DXR3AUDIOSINK_H__ - -#include <gst/gst.h> - -#include "ac3_padder.h" - -G_BEGIN_DECLS - - -#define GST_TYPE_DXR3AUDIOSINK \ - (dxr3audiosink_get_type()) -#define DXR3AUDIOSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DXR3AUDIOSINK,Dxr3AudioSink)) -#define DXR3AUDIOSINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DXR3AUDIOSINK,Dxr3AudioSinkClass)) -#define GST_IS_DXR3AUDIOSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DXR3AUDIOSINK)) -#define GST_IS_DXR3AUDIOSINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DXR3AUDIOSINK)) - - -typedef struct _Dxr3AudioSink Dxr3AudioSink; -typedef struct _Dxr3AudioSinkClass Dxr3AudioSinkClass; - - -typedef enum { - DXR3AUDIOSINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0), - DXR3AUDIOSINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2), -} Dxr3AudioSinkFlags; - - -/* PCM or AC3? */ -typedef enum { - DXR3AUDIOSINK_MODE_NONE, /* No mode set. */ - DXR3AUDIOSINK_MODE_AC3, /* AC3 out. */ - DXR3AUDIOSINK_MODE_PCM, /* PCM out. */ -} Dxr3AudioSinkMode; - - -/* Information for a delayed SCR set operation. */ -typedef struct { - struct _Dxr3AudioSink *sink; - guint32 scr; -} Dxr3AudioSinkDelayedSCR; - - -struct _Dxr3AudioSink { - GstElement element; - - GstPad *pcm_sinkpad; /* The AC3 audio sink pad. */ - GstPad *ac3_sinkpad; /* The PCM audio sink pad. */ - - int card_number; /* The number of the card to open. */ - - gchar *audio_filename; /* File name for the audio device. */ - int audio_fd; /* File descriptor for the audio device. */ - - gchar *control_filename; /* File name for the control device. */ - int control_fd; /* File descriptor for the control - device. */ - - guint64 scr; /* The current System Reference Clock value - for the audio stream. */ - - gboolean digital_pcm; /* Should PCM use the digital or the - analog output? */ - - Dxr3AudioSinkMode mode; /* The current sound output mode. */ - - gint rate; /* The sampling rate for PCM sound. */ - - ac3_padder *padder; /* AC3 to SPDIF padder object. */ - - GstClock *clock; /* The clock for this element. */ -}; - - -struct _Dxr3AudioSinkClass { - GstElementClass parent_class; - - /* signals */ - void (*flushed) (Dxr3AudioSink *sink); -}; - - -extern GType dxr3audiosink_get_type (void); - -G_END_DECLS - -#endif /* __DXR3AUDIOINK_H__ */ diff --git a/sys/dxr3/dxr3common.h b/sys/dxr3/dxr3common.h deleted file mode 100644 index 40aec8f41..000000000 --- a/sys/dxr3/dxr3common.h +++ /dev/null @@ -1,39 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net> - * - * dxr3videosink.h: Common declarations for the DXR3 plugin. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __DXR3COMMON_H__ -#define __DXR3COMMON_H__ - -/* Convert from GStreamer time to MPEG time. */ -#define GSTTIME_TO_MPEGTIME(time) (((time) * 9) / (GST_MSECOND/10)) - - -/* The em8300 driver expresses time in units of 1/45000 of second. */ - -/* Convert from MPEG time to em8300 time. */ -#define MPEGTIME_TO_DXRTIME(time) ((guint32) ((time) >> 1)) - -/* Convert from em8300 time to GStreamer time. */ -#define DXRTIME_TO_GSTTIME(time) \ - ((GstClockTime) ((double) (time) * (((double) GST_MSECOND) / 45.0))) - - -#endif /* __DXR3COMMON_H__ */ diff --git a/sys/dxr3/dxr3init.c b/sys/dxr3/dxr3init.c deleted file mode 100644 index ba3631685..000000000 --- a/sys/dxr3/dxr3init.c +++ /dev/null @@ -1,56 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net> - * - * dxr3init.c: DXR3 plugin initialization. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "gst/gst-i18n-plugin.h" - -#include "dxr3videosink.h" -#include "dxr3spusink.h" -#include "dxr3audiosink.h" - - -static gboolean -plugin_init (GstPlugin * plugin) -{ - if (!gst_element_register (plugin, "dxr3videosink", - GST_RANK_NONE, GST_TYPE_DXR3VIDEOSINK) || - !gst_element_register (plugin, "dxr3audiosink", - GST_RANK_NONE, GST_TYPE_DXR3AUDIOSINK) || - !gst_element_register (plugin, "dxr3spusink", - GST_RANK_NONE, GST_TYPE_DXR3SPUSINK)) - return FALSE; - -#ifdef ENABLE_NLS - setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); -#endif /* ENABLE_NLS */ - - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - dxr3, - "dxr3 mpeg video board elements", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/sys/dxr3/dxr3marshal.list b/sys/dxr3/dxr3marshal.list deleted file mode 100644 index 7b99b1ef3..000000000 --- a/sys/dxr3/dxr3marshal.list +++ /dev/null @@ -1,5 +0,0 @@ -VOID:VOID -VOID:BOOLEAN -VOID:POINTER -VOID:UINT,UINT,UINT,UINT,UINT,UINT - diff --git a/sys/dxr3/dxr3spusink.c b/sys/dxr3/dxr3spusink.c deleted file mode 100644 index fbf1cf50c..000000000 --- a/sys/dxr3/dxr3spusink.c +++ /dev/null @@ -1,513 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net> - * - * dxr3spusink.h: Subpicture sink for em8300 based cards. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <errno.h> -#include <string.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/ioctl.h> - -#include <linux/em8300.h> - -#include <gst/gst-i18n-plugin.h> -#include <gst/gst.h> - -#include "dxr3spusink.h" -#include "dxr3marshal.h" - -#include "dxr3common.h" - -/* Dxr3SpuSink signals and args */ -enum -{ - SET_CLUT_SIGNAL, - HIGHLIGHT_ON_SIGNAL, - HIGHLIGHT_OFF_SIGNAL, - SIGNAL_FLUSHED, - LAST_SIGNAL -}; - -enum -{ - ARG_0 -}; - - -static GstStaticPadTemplate dxr3spusink_sink_factory = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - - -static void dxr3spusink_class_init (Dxr3SpuSinkClass * klass); -static void dxr3spusink_base_init (Dxr3SpuSinkClass * klass); -static void dxr3spusink_init (Dxr3SpuSink * dxr3spusink); - -static void dxr3spusink_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void dxr3spusink_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - -static gboolean dxr3spusink_open (Dxr3SpuSink * sink); -static void dxr3spusink_close (Dxr3SpuSink * sink); -static gboolean dxr3spusink_set_clock (GstElement * element, GstClock * clock); - -static gboolean dxr3spusink_handle_event (GstPad * pad, GstEvent * event); -static void dxr3spusink_chain (GstPad * pad, GstData * _data); - -static GstStateChangeReturn dxr3spusink_change_state (GstElement * element, - GstStateChange transition); - -/* static void dxr3spusink_wait (Dxr3SpuSink *sink, */ -/* GstClockTime time); */ - -static void dxr3spusink_set_clut (Dxr3SpuSink * sink, const guint32 * clut); -static void dxr3spusink_highlight_on (Dxr3SpuSink * sink, - unsigned palette, - unsigned sx, unsigned sy, unsigned ex, unsigned ey, unsigned pts); -static void dxr3spusink_highlight_off (Dxr3SpuSink * sink); - -static void dxr3spusink_flushed (Dxr3SpuSink * sink); - - -static GstElementClass *parent_class = NULL; -static guint dxr3spusink_signals[LAST_SIGNAL] = { 0 }; - - -GType -dxr3spusink_get_type (void) -{ - static GType dxr3spusink_type = 0; - - if (!dxr3spusink_type) { - static const GTypeInfo dxr3spusink_info = { - sizeof (Dxr3SpuSinkClass), - (GBaseInitFunc) dxr3spusink_base_init, - NULL, - (GClassInitFunc) dxr3spusink_class_init, - NULL, - NULL, - sizeof (Dxr3SpuSink), - 0, - (GInstanceInitFunc) dxr3spusink_init, - }; - - dxr3spusink_type = g_type_register_static (GST_TYPE_ELEMENT, - "Dxr3SpuSink", &dxr3spusink_info, 0); - } - return dxr3spusink_type; -} - - -static void -dxr3spusink_base_init (Dxr3SpuSinkClass * klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_static_pad_template (element_class, - &dxr3spusink_sink_factory); - gst_element_class_set_static_metadata (element_class, - "dxr3/Hollywood+ mpeg decoder board subpicture element", "Sink/Video", - "Feeds subpicture information to Sigma Designs em8300 based boards", - "Martin Soto <martinsoto@users.sourceforge.net>"); -} - -static void -dxr3spusink_class_init (Dxr3SpuSinkClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - dxr3spusink_signals[SET_CLUT_SIGNAL] = - g_signal_new ("set-clut", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (Dxr3SpuSinkClass, set_clut), - NULL, NULL, dxr3_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - - dxr3spusink_signals[HIGHLIGHT_ON_SIGNAL] = - g_signal_new ("highlight-on", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (Dxr3SpuSinkClass, highlight_on), - NULL, NULL, - dxr3_marshal_VOID__UINT_UINT_UINT_UINT_UINT_UINT, - G_TYPE_NONE, 6, - G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, - G_TYPE_UINT, G_TYPE_UINT); - - dxr3spusink_signals[HIGHLIGHT_OFF_SIGNAL] = - g_signal_new ("highlight-off", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (Dxr3SpuSinkClass, highlight_off), - NULL, NULL, dxr3_marshal_VOID__VOID, G_TYPE_NONE, 0); - - dxr3spusink_signals[SIGNAL_FLUSHED] = - g_signal_new ("flushed", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Dxr3SpuSinkClass, flushed), - NULL, NULL, dxr3_marshal_VOID__VOID, G_TYPE_NONE, 0); - - klass->set_clut = dxr3spusink_set_clut; - klass->highlight_on = dxr3spusink_highlight_on; - klass->highlight_off = dxr3spusink_highlight_off; - klass->flushed = dxr3spusink_flushed; - - gobject_class->set_property = dxr3spusink_set_property; - gobject_class->get_property = dxr3spusink_get_property; - - gstelement_class->change_state = dxr3spusink_change_state; - gstelement_class->set_clock = dxr3spusink_set_clock; -} - - -static void -dxr3spusink_init (Dxr3SpuSink * sink) -{ - GstPad *pad; - - pad = gst_pad_new_from_static_template (&dxr3spusink_sink_factory, "sink"); - gst_element_add_pad (GST_ELEMENT (sink), pad); - gst_pad_set_chain_function (pad, dxr3spusink_chain); - - GST_OBJECT_FLAG_SET (GST_ELEMENT (sink), GST_ELEMENT_EVENT_AWARE); - - sink->card_number = 0; - - sink->spu_filename = NULL; - sink->spu_fd = -1; - sink->control_filename = NULL; - sink->control_fd = -1; - - sink->clock = NULL; -} - - -static void -dxr3spusink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - Dxr3SpuSink *sink; - - sink = DXR3SPUSINK (object); - - switch (prop_id) { - default: - break; - } -} - - -static void -dxr3spusink_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - Dxr3SpuSink *sink; - - g_return_if_fail (GST_IS_DXR3SPUSINK (object)); - - sink = DXR3SPUSINK (object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - - -static gboolean -dxr3spusink_open (Dxr3SpuSink * sink) -{ - g_return_val_if_fail (!GST_OBJECT_FLAG_IS_SET (sink, DXR3SPUSINK_OPEN), - FALSE); - - /* Compute the name of the spu device file. */ - sink->spu_filename = g_strdup_printf ("/dev/em8300_sp-%d", sink->card_number); - - sink->spu_fd = open (sink->spu_filename, O_WRONLY); - if (sink->spu_fd < 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, - (_("Could not open spu device \"%s\" for writing."), - sink->spu_filename), GST_ERROR_SYSTEM); - return FALSE; - } - - /* Open the control device. */ - sink->control_filename = g_strdup_printf ("/dev/em8300-%d", - sink->card_number); - - sink->control_fd = open (sink->control_filename, O_WRONLY); - if (sink->control_fd < 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, - (_("Could not open control device \"%s\" for writing."), - sink->control_filename), GST_ERROR_SYSTEM); - return FALSE; - } - - GST_OBJECT_FLAG_SET (sink, DXR3SPUSINK_OPEN); - - return TRUE; -} - - -static void -dxr3spusink_close (Dxr3SpuSink * sink) -{ - g_return_if_fail (GST_OBJECT_FLAG_IS_SET (sink, DXR3SPUSINK_OPEN)); - - if (close (sink->spu_fd) != 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE, - (_("Could not close spu device \"%s\"."), sink->spu_filename), - GST_ERROR_SYSTEM); - return; - } - - if (close (sink->control_fd) != 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE, - (_("Could not close control device \"%s\"."), sink->control_filename), - GST_ERROR_SYSTEM); - return; - } - - GST_OBJECT_FLAG_UNSET (sink, DXR3SPUSINK_OPEN); - - free (sink->spu_filename); - sink->spu_filename = NULL; -} - - -static gboolean -dxr3spusink_set_clock (GstElement * element, GstClock * clock) -{ - Dxr3SpuSink *src = DXR3SPUSINK (element); - - src->clock = clock; - - return GST_ELEMENT_CLASS (element)->set_clock (element, clock); -} - - -static gboolean -dxr3spusink_handle_event (GstPad * pad, GstEvent * event) -{ - GstEventType type; - Dxr3SpuSink *sink; - - sink = DXR3SPUSINK (gst_pad_get_parent (pad)); - - type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN; - - switch (type) { - case GST_EVENT_FLUSH: - if (sink->control_fd >= 0) { - int subdevice; - - subdevice = EM8300_SUBDEVICE_SUBPICTURE; - ioctl (sink->control_fd, EM8300_IOCTL_FLUSH, &subdevice); - - /* FIXME: There should be a nicer way to do this, but I tried - everything and nothing else seems to really reset the video - fifo. */ -/* dxr3spusink_close (sink); */ -/* dxr3spusink_open (sink); */ - - /* Report the flush operation. */ - g_signal_emit (G_OBJECT (sink), dxr3spusink_signals[SIGNAL_FLUSHED], 0); - } - break; - default: - gst_pad_event_default (pad, event); - break; - } - - return TRUE; -} - - -static void -dxr3spusink_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - Dxr3SpuSink *sink; - gint bytes_written = 0; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - sink = DXR3SPUSINK (gst_pad_get_parent (pad)); - - if (GST_IS_EVENT (buf)) { - dxr3spusink_handle_event (pad, GST_EVENT (buf)); - return; - } - - if (GST_OBJECT_FLAG_IS_SET (sink, DXR3SPUSINK_OPEN)) { - /* If we have PTS information for the SPU unit, register it now. - The card needs the PTS to be written *before* the actual data. */ - if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) { - guint pts = (guint) GSTTIME_TO_MPEGTIME (GST_BUFFER_TIMESTAMP (buf)); - - ioctl (sink->spu_fd, EM8300_IOCTL_SPU_SETPTS, &pts); - } - - bytes_written = write (sink->spu_fd, GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf)); - if (bytes_written < GST_BUFFER_SIZE (buf)) { - fprintf (stderr, "dxr3spusink: Warning: %d bytes should be written," - " only %d bytes written\n", GST_BUFFER_SIZE (buf), bytes_written); - } - } - - gst_buffer_unref (buf); -} - - -static GstStateChangeReturn -dxr3spusink_change_state (GstElement * element, GstStateChange transition) -{ - g_return_val_if_fail (GST_IS_DXR3SPUSINK (element), GST_STATE_CHANGE_FAILURE); - - switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - if (!GST_OBJECT_FLAG_IS_SET (element, DXR3SPUSINK_OPEN)) { - if (!dxr3spusink_open (DXR3SPUSINK (element))) { - return GST_STATE_CHANGE_FAILURE; - } - } - break; - case GST_STATE_CHANGE_READY_TO_PAUSED: - break; - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - break; - case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - break; - case GST_STATE_CHANGE_READY_TO_NULL: - if (GST_OBJECT_FLAG_IS_SET (element, DXR3SPUSINK_OPEN)) { - dxr3spusink_close (DXR3SPUSINK (element)); - } - break; - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) { - return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - } - - return GST_STATE_CHANGE_SUCCESS; -} - -#if 0 -/** - * dxr3spusink_wait: - * - * Make the sink wait the specified amount of time. - */ -static void -dxr3spusink_wait (Dxr3SpuSink * sink, GstClockTime time) -{ - GstClockID id; - GstClockTimeDiff jitter; - GstClockReturn ret; - GstClockTime current_time = gst_clock_get_time (sink->clock); - - id = gst_clock_new_single_shot_id (sink->clock, current_time + time); - ret = gst_clock_id_wait (id, &jitter); - gst_clock_id_free (id); -} -#endif - -/** - * dxr3spusink_set_clut: - * - * Set a new SPU color lookup table (clut) in the dxr3 card. - */ -static void -dxr3spusink_set_clut (Dxr3SpuSink * sink, const guint32 * clut) -{ - guint32 clut_fixed[16]; - int i; - - /* Fix the byte order of the table. */ - for (i = 0; i < 16; i++) { - clut_fixed[i] = GUINT32_TO_LE (clut[i]); - } - - if (ioctl (sink->spu_fd, EM8300_IOCTL_SPU_SETPALETTE, clut_fixed)) - fprintf (stderr, "dxr3spusink: failed to set CLUT (%s)\n", - strerror (errno)); -} - - -static void -dxr3spusink_highlight_on (Dxr3SpuSink * sink, unsigned palette, - unsigned sx, unsigned sy, unsigned ex, unsigned ey, unsigned pts) -{ - em8300_button_t btn; - - btn.color = palette >> 16; - btn.contrast = palette; - btn.left = sx; - btn.top = sy; - btn.right = ex; - btn.bottom = ey; - - if (ioctl (sink->spu_fd, EM8300_IOCTL_SPU_BUTTON, &btn)) { - fprintf (stderr, "dxr3spusink: failed to set spu button (%s)\n", - strerror (errno)); - } -} - - -static void -dxr3spusink_highlight_off (Dxr3SpuSink * sink) -{ - if (ioctl (sink->spu_fd, EM8300_IOCTL_SPU_BUTTON, NULL)) { - fprintf (stderr, "dxr3spusink: failed to set spu button (%s)\n", - strerror (errno)); - } -} - - -/** - * dxr3spusink_flushed: - * - * Default do nothing implementation for the "flushed" signal. The - * "flushed" signal will be fired right after flushing the hardware - * queues due to a received flush event - */ -static void -dxr3spusink_flushed (Dxr3SpuSink * sink) -{ - /* Do nothing. */ -} diff --git a/sys/dxr3/dxr3spusink.h b/sys/dxr3/dxr3spusink.h deleted file mode 100644 index 99a80864a..000000000 --- a/sys/dxr3/dxr3spusink.h +++ /dev/null @@ -1,86 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net> - * - * dxr3spusink.h: Subpicture sink for em8300 based cards. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __DXR3SPUSINK_H__ -#define __DXR3SPUSINK_H__ - -#include <gst/gst.h> - -G_BEGIN_DECLS - - -#define GST_TYPE_DXR3SPUSINK \ - (dxr3spusink_get_type()) -#define DXR3SPUSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DXR3SPUSINK,Dxr3SpuSink)) -#define DXR3SPUSINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DXR3SPUSINK,Dxr3SpuSinkClass)) -#define GST_IS_DXR3SPUSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DXR3SPUSINK)) -#define GST_IS_DXR3SPUSINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DXR3SPUSINK)) - - -typedef struct _Dxr3SpuSink Dxr3SpuSink; -typedef struct _Dxr3SpuSinkClass Dxr3SpuSinkClass; - - -typedef enum { - DXR3SPUSINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0), - DXR3SPUSINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2), -} Dxr3SpuSinkFlags; - - -struct _Dxr3SpuSink { - GstElement element; - - int card_number; /* The number of the card to open. */ - - gchar *spu_filename; /* File name for the spu device. */ - int spu_fd; /* File descriptor for the spu device. */ - - gchar *control_filename; /* File name for the control device. */ - int control_fd; /* File descriptor for the control - device. */ - - GstClock *clock; /* The clock for this element. */ -}; - - -struct _Dxr3SpuSinkClass { - GstElementClass parent_class; - - /* Signals */ - void (*set_clut) (Dxr3SpuSink *sink, const guint32 *clut); - void (*highlight_on) (Dxr3SpuSink *sink, unsigned palette, - unsigned sx, unsigned sy, - unsigned ex, unsigned ey, - unsigned pts); - void (*highlight_off) (Dxr3SpuSink *sink); - void (*flushed) (Dxr3SpuSink *sink); -}; - - -extern GType dxr3spusink_get_type (void); - -G_END_DECLS - -#endif /* __DXR3SPUSINK_H__ */ diff --git a/sys/dxr3/dxr3videosink.c b/sys/dxr3/dxr3videosink.c deleted file mode 100644 index 486786b86..000000000 --- a/sys/dxr3/dxr3videosink.c +++ /dev/null @@ -1,717 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net> - * - * dxr3videosink.c: Video sink for em8300 based cards. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <errno.h> -#include <string.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/ioctl.h> - -#include <linux/em8300.h> - -#include <gst/gst-i18n-plugin.h> -#include <gst/gst.h> - -#include "dxr3videosink.h" -#include "dxr3marshal.h" - -#include "dxr3common.h" - -/* Dxr3VideoSink signals and args */ -enum -{ - SIGNAL_FLUSHED, - LAST_SIGNAL -}; - -enum -{ - ARG_0, -}; - -/* Possible states for the MPEG start code scanner. */ -enum -{ - SCAN_STATE_WAITING, /* Waiting for a code. */ - SCAN_STATE_0, /* 0 seen. */ - SCAN_STATE_00, /* 00 seen. */ - SCAN_STATE_001 /* 001 seen. */ -}; - -/* Possible states for the MPEG sequence parser. */ -enum -{ - PARSE_STATE_WAITING, /* Waiting for the start of a sequence. */ - PARSE_STATE_START, /* Start of sequence seen. */ - PARSE_STATE_PICTURE /* Picture start seen. */ -}; - - -/* Relevant mpeg start codes. */ -#define START_CODE_PICTURE 0x00 -#define START_CODE_SEQUENCE_HEADER 0xB3 -#define START_CODE_SEQUENCE_END 0xB7 - -static GstStaticPadTemplate dxr3videosink_sink_factory = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/mpeg, " - "mpegversion = (int) { 1, 2 }, " "systemstream = (boolean) FALSE" - /* width/height/framerate omitted, we don't - * need a parsed stream */ - ) - ); - - -static void dxr3videosink_class_init (Dxr3VideoSinkClass * klass); -static void dxr3videosink_base_init (Dxr3VideoSinkClass * klass); -static void dxr3videosink_init (Dxr3VideoSink * dxr3videosink); - -static void dxr3videosink_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec); -static void dxr3videosink_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec); - -static gboolean dxr3videosink_open (Dxr3VideoSink * sink); -static void dxr3videosink_close (Dxr3VideoSink * sink); -static gboolean dxr3videosink_set_clock (GstElement * element, - GstClock * clock); - -static void dxr3videosink_reset_parser (Dxr3VideoSink * sink); -static int dxr3videosink_next_start_code (Dxr3VideoSink * sink); -static void dxr3videosink_discard_data (Dxr3VideoSink * sink, guint cut); -static void dxr3videosink_write_data (Dxr3VideoSink * sink, guint cut); -static void dxr3videosink_parse_data (Dxr3VideoSink * sink); - -static gboolean dxr3videosink_handle_event (GstPad * pad, GstEvent * event); -static void dxr3videosink_chain (GstPad * pad, GstData * _data); - -static GstStateChangeReturn dxr3videosink_change_state (GstElement * element, - GstStateChange transition); - -/* static void dxr3videosink_wait (Dxr3VideoSink *sink, */ -/* GstClockTime time); */ -static int dxr3videosink_mvcommand (Dxr3VideoSink * sink, int command); - -static void dxr3videosink_flushed (Dxr3VideoSink * sink); - -static GstElementClass *parent_class = NULL; -static guint dxr3videosink_signals[LAST_SIGNAL] = { 0 }; - - -extern GType -dxr3videosink_get_type (void) -{ - static GType dxr3videosink_type = 0; - - if (!dxr3videosink_type) { - static const GTypeInfo dxr3videosink_info = { - sizeof (Dxr3VideoSinkClass), - (GBaseInitFunc) dxr3videosink_base_init, - NULL, - (GClassInitFunc) dxr3videosink_class_init, - NULL, - NULL, - sizeof (Dxr3VideoSink), - 0, - (GInstanceInitFunc) dxr3videosink_init, - }; - - dxr3videosink_type = g_type_register_static (GST_TYPE_ELEMENT, - "Dxr3VideoSink", &dxr3videosink_info, 0); - } - - return dxr3videosink_type; -} - - -static void -dxr3videosink_base_init (Dxr3VideoSinkClass * klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_static_pad_template (element_class, - &dxr3videosink_sink_factory); - gst_element_class_set_static_metadata (element_class, - "dxr3/Hollywood+ mpeg decoder board video element", "Sink/Video", - "Feeds MPEG2 video to Sigma Designs em8300 based boards", - "Martin Soto <martinsoto@users.sourceforge.net>"); -} - -static void -dxr3videosink_class_init (Dxr3VideoSinkClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - dxr3videosink_signals[SIGNAL_FLUSHED] = - g_signal_new ("flushed", G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (Dxr3VideoSinkClass, flushed), - NULL, NULL, dxr3_marshal_VOID__VOID, G_TYPE_NONE, 0); - - klass->flushed = dxr3videosink_flushed; - - gobject_class->set_property = dxr3videosink_set_property; - gobject_class->get_property = dxr3videosink_get_property; - - gstelement_class->change_state = dxr3videosink_change_state; - gstelement_class->set_clock = dxr3videosink_set_clock; -} - - -static void -dxr3videosink_init (Dxr3VideoSink * sink) -{ - GstPad *pad; - - pad = gst_pad_new_from_static_template (&dxr3videosink_sink_factory, "sink"); - gst_element_add_pad (GST_ELEMENT (sink), pad); - gst_pad_set_chain_function (pad, dxr3videosink_chain); - - GST_OBJECT_FLAG_SET (GST_ELEMENT (sink), GST_ELEMENT_EVENT_AWARE); - - sink->card_number = 0; - - sink->video_filename = NULL; - sink->video_fd = -1; - sink->control_filename = NULL; - sink->control_fd = -1; - - sink->clock = NULL; - - sink->last_ts = GST_CLOCK_TIME_NONE; - - sink->cur_buf = NULL; - dxr3videosink_reset_parser (sink); -} - - -static void -dxr3videosink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - Dxr3VideoSink *sink; - - sink = DXR3VIDEOSINK (object); - - switch (prop_id) { - default: - break; - } -} - - -static void -dxr3videosink_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - Dxr3VideoSink *sink; - - g_return_if_fail (GST_IS_DXR3VIDEOSINK (object)); - - sink = DXR3VIDEOSINK (object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - - -static gboolean -dxr3videosink_open (Dxr3VideoSink * sink) -{ - g_return_val_if_fail (!GST_OBJECT_FLAG_IS_SET (sink, DXR3VIDEOSINK_OPEN), - FALSE); - - /* Compute the name of the video device file. */ - sink->video_filename = g_strdup_printf ("/dev/em8300_mv-%d", - sink->card_number); - - sink->video_fd = open (sink->video_filename, O_WRONLY); - if (sink->video_fd < 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, - (_("Could not open video device \"%s\" for writing."), - sink->video_filename), GST_ERROR_SYSTEM); - return FALSE; - } - - /* Open the control device. */ - sink->control_filename = g_strdup_printf ("/dev/em8300-%d", - sink->card_number); - - sink->control_fd = open (sink->control_filename, O_WRONLY); - if (sink->control_fd < 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, - (_("Could not open control device \"%s\" for writing."), - sink->control_filename), GST_ERROR_SYSTEM); - return FALSE; - } - - GST_OBJECT_FLAG_SET (sink, DXR3VIDEOSINK_OPEN); - - return TRUE; -} - - -static void -dxr3videosink_close (Dxr3VideoSink * sink) -{ - g_return_if_fail (GST_OBJECT_FLAG_IS_SET (sink, DXR3VIDEOSINK_OPEN)); - - if (close (sink->video_fd) != 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE, - (_("Could not close video device \"%s\"."), sink->video_filename), - GST_ERROR_SYSTEM); - return; - } - - if (close (sink->control_fd) != 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, CLOSE, - (_("Could not close control device \"%s\"."), sink->control_filename), - GST_ERROR_SYSTEM); - return; - } - - GST_OBJECT_FLAG_UNSET (sink, DXR3VIDEOSINK_OPEN); - - free (sink->video_filename); - sink->video_filename = NULL; -} - - -static gboolean -dxr3videosink_set_clock (GstElement * element, GstClock * clock) -{ - Dxr3VideoSink *src = DXR3VIDEOSINK (element); - - src->clock = clock; - - return GST_ELEMENT_CLASS (parent_class)->set_clock (element, clock); -} - - -static void -dxr3videosink_reset_parser (Dxr3VideoSink * sink) -{ - if (sink->cur_buf != NULL) { - gst_buffer_unref (sink->cur_buf); - sink->cur_buf = NULL; - } - sink->cur_ts = GST_CLOCK_TIME_NONE; - - sink->scan_state = SCAN_STATE_WAITING; - sink->scan_pos = 0; - - sink->parse_state = PARSE_STATE_WAITING; -} - - -static int -dxr3videosink_next_start_code (Dxr3VideoSink * sink) -{ - guchar c; - - g_return_val_if_fail (sink->cur_buf != NULL, -1); - - while (sink->scan_pos < GST_BUFFER_SIZE (sink->cur_buf)) { - c = (GST_BUFFER_DATA (sink->cur_buf))[sink->scan_pos]; - - switch (sink->scan_state) { - case SCAN_STATE_WAITING: - if (c == 0x00) { - sink->scan_state = SCAN_STATE_0; - } - break; - case SCAN_STATE_0: - if (c == 0x00) { - sink->scan_state = SCAN_STATE_00; - } else { - sink->scan_state = SCAN_STATE_WAITING; - } - break; - case SCAN_STATE_00: - if (c == 0x01) { - sink->scan_state = SCAN_STATE_001; - } else if (c != 0x00) { - sink->scan_state = SCAN_STATE_WAITING; - } - break; - case SCAN_STATE_001: - sink->scan_pos++; - sink->scan_state = SCAN_STATE_WAITING; - return c; - } - - sink->scan_pos++; - } - - return -1; -} - - -static void -dxr3videosink_discard_data (Dxr3VideoSink * sink, guint cut) -{ - GstBuffer *sub; - guint size; - - g_return_if_fail (sink->cur_buf != NULL); - g_assert (cut <= sink->scan_pos); - - size = sink->scan_pos - cut; - - g_return_if_fail (size <= GST_BUFFER_SIZE (sink->cur_buf)); - - if (GST_BUFFER_SIZE (sink->cur_buf) == size) { - gst_buffer_unref (sink->cur_buf); - sink->cur_buf = NULL; - } else { - sub = gst_buffer_create_sub (sink->cur_buf, size, - GST_BUFFER_SIZE (sink->cur_buf) - - size); - gst_buffer_unref (sink->cur_buf); - sink->cur_buf = sub; - } - - sink->scan_state = SCAN_STATE_WAITING; - sink->scan_pos = cut; - - sink->cur_ts = GST_CLOCK_TIME_NONE; -} - - -static void -dxr3videosink_write_data (Dxr3VideoSink * sink, guint cut) -{ - guint size, written; - guint8 *data; - - g_return_if_fail (sink->cur_buf != NULL); - - if (GST_OBJECT_FLAG_IS_SET (sink, DXR3VIDEOSINK_OPEN)) { - if (sink->cur_ts != GST_CLOCK_TIME_NONE) { - guint pts; - -/* fprintf (stderr, "------ Video Time %.04f\n", */ -/* (double) sink->cur_ts / GST_SECOND); */ - - pts = (guint) GSTTIME_TO_MPEGTIME (sink->cur_ts); - ioctl (sink->video_fd, EM8300_IOCTL_VIDEO_SETPTS, &pts); - sink->cur_ts = GST_CLOCK_TIME_NONE; - } - - data = GST_BUFFER_DATA (sink->cur_buf); - size = sink->scan_pos - cut; - - g_assert (size <= GST_BUFFER_SIZE (sink->cur_buf)); - - /* We should always write data that corresponds to whole MPEG - video sintactical elements. They should always start with an - MPEG start code. */ - g_assert (size >= 4 && data[0] == 0 && data[1] == 0 && data[2] == 1); - - while (size > 0) { - written = write (sink->video_fd, data, size); - if (written < 0) { - GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, - (_("Could not write to device \"%s\"."), sink->video_filename), - GST_ERROR_SYSTEM); - break; - } - size = size - written; - data = data + written; - }; - } - - dxr3videosink_discard_data (sink, cut); -} - - -static void -dxr3videosink_parse_data (Dxr3VideoSink * sink) -{ - int code; - - /* Timestamp handling assumes that timestamps are associated to - sequence starts. This seems to be the case, at least for - DVDs. */ - - code = dxr3videosink_next_start_code (sink); - while (code >= 0) { - switch (sink->parse_state) { - - case PARSE_STATE_WAITING: - if (code == START_CODE_SEQUENCE_HEADER) { - dxr3videosink_discard_data (sink, 4); - sink->parse_state = PARSE_STATE_START; - sink->cur_ts = sink->last_ts; - } - break; - - case PARSE_STATE_START: - switch (code) { - case START_CODE_SEQUENCE_HEADER: - dxr3videosink_discard_data (sink, 4); - sink->cur_ts = sink->last_ts; - break; - case START_CODE_SEQUENCE_END: - dxr3videosink_discard_data (sink, 0); - sink->parse_state = PARSE_STATE_WAITING; - break; - case START_CODE_PICTURE: - sink->parse_state = PARSE_STATE_PICTURE; - break; - } - break; - - case PARSE_STATE_PICTURE: - switch (code) { - case START_CODE_SEQUENCE_HEADER: - dxr3videosink_write_data (sink, 4); - sink->parse_state = PARSE_STATE_START; - sink->cur_ts = sink->last_ts; - break; - case START_CODE_SEQUENCE_END: - dxr3videosink_write_data (sink, 0); - sink->parse_state = PARSE_STATE_WAITING; - break; - case START_CODE_PICTURE: - dxr3videosink_write_data (sink, 4); - break; - } - break; - - } - - code = dxr3videosink_next_start_code (sink); - } - - if (sink->parse_state == PARSE_STATE_WAITING) { - dxr3videosink_discard_data (sink, 0); - } -} - - -static gboolean -dxr3videosink_handle_event (GstPad * pad, GstEvent * event) -{ - GstEventType type; - Dxr3VideoSink *sink; - - sink = DXR3VIDEOSINK (gst_pad_get_parent (pad)); - - type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN; - - switch (type) { - case GST_EVENT_EMPTY: - //fprintf (stderr, "++++++ Video empty event\n"); - { - /* FIXME: Handle this with a discontinuity or something. */ - /* Write an MPEG2 sequence end code, to ensure that the card - actually displays the last picture. Apparently some DVDs are - encoded without proper sequence end codes. */ - static const guint8 sec[4] = { 0x00, 0x00, 0x01, 0xb7 }; - - if (sink->cur_buf != NULL) { - dxr3videosink_write_data (sink, 0); - } - - write (sink->video_fd, &sec, 4); - } - break; - - case GST_EVENT_DISCONTINUOUS: - //fprintf (stderr, "++++++ Video discont event\n"); - { - gint64 time; - gboolean has_time; - unsigned cur_scr, mpeg_scr, diff; - - has_time = gst_event_discont_get_value (event, GST_FORMAT_TIME, &time); - if (has_time) { -/* fprintf (stderr, "^^^^^^ Discontinuous event has time %.4f\n", */ -/* (double) time / GST_SECOND); */ - - /* If the SCR in the card is way off, fix it. */ - ioctl (sink->control_fd, EM8300_IOCTL_SCR_GET, &cur_scr); - mpeg_scr = MPEGTIME_TO_DXRTIME (GSTTIME_TO_MPEGTIME (time)); - - diff = cur_scr > mpeg_scr ? cur_scr - mpeg_scr : mpeg_scr - cur_scr; - if (diff > 1800) { - unsigned zero = 0; - -/* fprintf (stderr, "====== Adjusting SCR from video\n"); */ - - ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &zero); - ioctl (sink->control_fd, EM8300_IOCTL_SCR_SET, &mpeg_scr); - } - } else { -/* fprintf (stderr, "^^^^^^ Discontinuous event has no time\n"); */ - } - } - break; - - case GST_EVENT_FLUSH: - dxr3videosink_reset_parser (sink); - break; - - default: - gst_pad_event_default (pad, event); - break; - } - - return TRUE; -} - - -static void -dxr3videosink_chain (GstPad * pad, GstData * _data) -{ - GstBuffer *buf = GST_BUFFER (_data); - Dxr3VideoSink *sink; - - g_return_if_fail (pad != NULL); - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (buf != NULL); - - sink = DXR3VIDEOSINK (gst_pad_get_parent (pad)); - - if (GST_IS_EVENT (buf)) { - dxr3videosink_handle_event (pad, GST_EVENT (buf)); - return; - } - -/* fprintf (stderr, "^^^^^^ Video block\n"); */ - - if (sink->cur_buf == NULL) { - sink->cur_buf = buf; - } else { - sink->cur_buf = gst_buffer_append (sink->cur_buf, buf); - } - - sink->last_ts = GST_BUFFER_TIMESTAMP (buf); - - dxr3videosink_parse_data (sink); -} - - -static GstStateChangeReturn -dxr3videosink_change_state (GstElement * element, GstStateChange transition) -{ - g_return_val_if_fail (GST_IS_DXR3VIDEOSINK (element), - GST_STATE_CHANGE_FAILURE); - - switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - if (!GST_OBJECT_FLAG_IS_SET (element, DXR3VIDEOSINK_OPEN)) { - if (!dxr3videosink_open (DXR3VIDEOSINK (element))) { - return GST_STATE_CHANGE_FAILURE; - } - } - break; - case GST_STATE_CHANGE_READY_TO_PAUSED: - dxr3videosink_mvcommand (DXR3VIDEOSINK (element), MVCOMMAND_PAUSE); - break; - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - dxr3videosink_mvcommand (DXR3VIDEOSINK (element), MVCOMMAND_START); - break; - case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - dxr3videosink_mvcommand (DXR3VIDEOSINK (element), MVCOMMAND_PAUSE); - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - dxr3videosink_mvcommand (DXR3VIDEOSINK (element), MVCOMMAND_STOP); - break; - case GST_STATE_CHANGE_READY_TO_NULL: - if (GST_OBJECT_FLAG_IS_SET (element, DXR3VIDEOSINK_OPEN)) { - dxr3videosink_close (DXR3VIDEOSINK (element)); - } - break; - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) { - return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - } - - return GST_STATE_CHANGE_SUCCESS; -} - -#if 0 -/** - * dxr3videosink_wait: - * - * Make the sink wait the specified amount of time. - */ -static void -dxr3videosink_wait (Dxr3VideoSink * sink, GstClockTime time) -{ - GstClockID id; - GstClockTimeDiff jitter; - GstClockReturn ret; - GstClockTime current_time = gst_clock_get_time (sink->clock); - - id = gst_clock_new_single_shot_id (sink->clock, current_time + time); - ret = gst_clock_id_wait (id, &jitter); - gst_clock_id_free (id); -} -#endif - -/** - * dxr3videosink_mvcommand - * - * Send an MVCOMMAND to the card. - */ -static int -dxr3videosink_mvcommand (Dxr3VideoSink * sink, int command) -{ - em8300_register_t regs; - - regs.microcode_register = 1; - regs.reg = 0; - regs.val = command; - - return ioctl (sink->control_fd, EM8300_IOCTL_WRITEREG, ®s); -} - - -/** - * dxr3videosink_flushed: - * - * Default do nothing implementation for the "flushed" signal. The - * "flushed" signal will be fired right after flushing the hardware - * queues due to a received flush event - */ -static void -dxr3videosink_flushed (Dxr3VideoSink * sink) -{ - /* Do nothing. */ -} diff --git a/sys/dxr3/dxr3videosink.h b/sys/dxr3/dxr3videosink.h deleted file mode 100644 index 1fd3669e7..000000000 --- a/sys/dxr3/dxr3videosink.h +++ /dev/null @@ -1,96 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Martin Soto <martinsoto@users.sourceforge.net> - * - * dxr3videosink.h: Video sink for em8300 based cards. - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __DXR3VIDEOSINK_H__ -#define __DXR3VIDEOSINK_H__ - -#include <gst/gst.h> - -G_BEGIN_DECLS - - -#define GST_TYPE_DXR3VIDEOSINK \ - (dxr3videosink_get_type()) -#define DXR3VIDEOSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DXR3VIDEOSINK,Dxr3VideoSink)) -#define DXR3VIDEOSINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DXR3VIDEOSINK,Dxr3VideoSinkClass)) -#define GST_IS_DXR3VIDEOSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DXR3VIDEOSINK)) -#define GST_IS_DXR3VIDEOSINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DXR3VIDEOSINK)) - - -typedef struct _Dxr3VideoSink Dxr3VideoSink; -typedef struct _Dxr3VideoSinkClass Dxr3VideoSinkClass; - - -typedef enum { - DXR3VIDEOSINK_OPEN = (GST_ELEMENT_FLAG_LAST << 0), - DXR3VIDEOSINK_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2), -} Dxr3VideoSinkFlags; - - -struct _Dxr3VideoSink { - GstElement element; - - int card_number; /* The number of the card to open. */ - - gchar *video_filename; /* File name for the video device. */ - int video_fd; /* File descriptor for the video device. */ - - gchar *control_filename; /* File name for the control device. */ - int control_fd; /* File descriptor for the control - device. */ - - GstClock *clock; /* The clock for this element. */ - - GstClockTime last_ts; /* Last timestamp received. */ - - GstBuffer *cur_buf; /* The buffer we are currently - building. */ - GstClockTime cur_ts; /* Timestamp associated to the - current buffer. */ - - guchar scan_state; /* The current state of the MPEG start - code scanner. */ - guint scan_pos; /* The current position of the MPEG - start code scanner (with respect to - the start of the current buffer. */ - - guchar parse_state; /* The current state of the MPEG - sequence parser. */ -}; - - -struct _Dxr3VideoSinkClass { - GstElementClass parent_class; - - /* signals */ - void (*flushed) (Dxr3VideoSink *sink); -}; - - -extern GType dxr3videosink_get_type (void); - -G_END_DECLS - -#endif /* __DXR3VIDEOSINK_H__ */ diff --git a/sys/linsys/Makefile.am b/sys/linsys/Makefile.am deleted file mode 100644 index 8b1047248..000000000 --- a/sys/linsys/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ - - -plugin_LTLIBRARIES = libgstlinsys.la - -libgstlinsys_la_SOURCES = \ - gstlinsyssdisink.c \ - gstlinsyssdisrc.c \ - gstlinsys.c - -noinst_HEADERS = \ - gstlinsyssdisink.h \ - gstlinsyssdisrc.h \ - include/asi.h \ - include/master.h \ - include/sdi.h \ - include/sdiaudio.h \ - include/sdivideo.h - -libgstlinsys_la_CFLAGS = \ - -I$(srcdir)/include \ - $(GST_BASE_CFLAGS) \ - $(GST_CFLAGS) -libgstlinsys_la_LDFLAGS = \ - $(GST_PLUGIN_LDFLAGS) -libgstlinsys_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) -libgstlinsys_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) diff --git a/sys/linsys/gstlinsys.c b/sys/linsys/gstlinsys.c deleted file mode 100644 index 4893fbe34..000000000 --- a/sys/linsys/gstlinsys.c +++ /dev/null @@ -1,47 +0,0 @@ -/* GStreamer - * Copyright (C) 2010 FIXME <fixme@example.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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include <gst/base/gstbasesrc.h> - -#include "gstlinsyssdisink.h" -#include "gstlinsyssdisrc.h" - -static gboolean -plugin_init (GstPlugin * plugin) -{ - - gst_element_register (plugin, "linsyssdisrc", GST_RANK_NONE, - gst_linsys_sdi_src_get_type ()); - gst_element_register (plugin, "linsyssdisink", GST_RANK_NONE, - gst_linsys_sdi_sink_get_type ()); - - return TRUE; -} - -#define PACKAGE_ORIGIN "http://FIXME.org/" - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - linsys, "FIXME", plugin_init, VERSION, "LGPL", PACKAGE_NAME, PACKAGE_ORIGIN) diff --git a/sys/linsys/gstlinsyssdisink.c b/sys/linsys/gstlinsyssdisink.c deleted file mode 100644 index a8edf3731..000000000 --- a/sys/linsys/gstlinsyssdisink.c +++ /dev/null @@ -1,488 +0,0 @@ -/* GStreamer - * Copyright (C) 2010 David Schleef <ds@entropywave.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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include <gst/base/gstbasesink.h> -#include "gstlinsyssdisink.h" - -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <poll.h> -#include <sys/ioctl.h> - -#include "sdivideo.h" - -/* prototypes */ - - -static void gst_linsys_sdi_sink_set_property (GObject * object, - guint property_id, const GValue * value, GParamSpec * pspec); -static void gst_linsys_sdi_sink_get_property (GObject * object, - guint property_id, GValue * value, GParamSpec * pspec); -static void gst_linsys_sdi_sink_dispose (GObject * object); -static void gst_linsys_sdi_sink_finalize (GObject * object); - -static GstCaps *gst_linsys_sdi_sink_get_caps (GstBaseSink * sink); -static gboolean gst_linsys_sdi_sink_set_caps (GstBaseSink * sink, - GstCaps * caps); -static GstFlowReturn gst_linsys_sdi_sink_buffer_alloc (GstBaseSink * sink, - guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); -static void gst_linsys_sdi_sink_get_times (GstBaseSink * sink, - GstBuffer * buffer, GstClockTime * start, GstClockTime * end); -static gboolean gst_linsys_sdi_sink_start (GstBaseSink * sink); -static gboolean gst_linsys_sdi_sink_stop (GstBaseSink * sink); -static gboolean gst_linsys_sdi_sink_unlock (GstBaseSink * sink); -static gboolean gst_linsys_sdi_sink_event (GstBaseSink * sink, - GstEvent * event); -static GstFlowReturn gst_linsys_sdi_sink_preroll (GstBaseSink * sink, - GstBuffer * buffer); -static GstFlowReturn gst_linsys_sdi_sink_render (GstBaseSink * sink, - GstBuffer * buffer); -static GstStateChangeReturn gst_linsys_sdi_sink_async_play (GstBaseSink * sink); -static gboolean gst_linsys_sdi_sink_activate_pull (GstBaseSink * sink, - gboolean active); -static void gst_linsys_sdi_sink_fixate (GstBaseSink * sink, GstCaps * caps); -static gboolean gst_linsys_sdi_sink_unlock_stop (GstBaseSink * sink); -static GstFlowReturn -gst_linsys_sdi_sink_render_list (GstBaseSink * sink, - GstBufferList * buffer_list); - -enum -{ - PROP_0, - PROP_DEVICE -}; - -#define DEFAULT_DEVICE "/dev/sditx0" - -/* pad templates */ - -static GstStaticPadTemplate gst_linsys_sdi_sink_sink_template = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-raw-yuv,format=(fourcc)UYVY," - "width=720,height=480,pixel-aspect-ratio=10/11," - "framerate=30000/1001,interlaced=true," - "colorspec=sdtv,chroma-site=mpeg2") - ); - -/* class initialization */ - -GST_BOILERPLATE (GstLinsysSdiSink, gst_linsys_sdi_sink, GstBaseSink, - GST_TYPE_BASE_SINK); - -static void -gst_linsys_sdi_sink_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_static_pad_template (element_class, - &gst_linsys_sdi_sink_sink_template); - - gst_element_class_set_static_metadata (element_class, "SDI video sink", - "Sink/Video", "Writes video from SDI transmit device", - "David Schleef <ds@entropywave.com>"); -} - -static void -gst_linsys_sdi_sink_class_init (GstLinsysSdiSinkClass * klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass); - - gobject_class->set_property = gst_linsys_sdi_sink_set_property; - gobject_class->get_property = gst_linsys_sdi_sink_get_property; - gobject_class->dispose = gst_linsys_sdi_sink_dispose; - gobject_class->finalize = gst_linsys_sdi_sink_finalize; - base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_get_caps); - base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_set_caps); - if (0) - base_sink_class->buffer_alloc = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_buffer_alloc); - base_sink_class->get_times = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_get_times); - base_sink_class->start = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_start); - base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_stop); - base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_unlock); - base_sink_class->event = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_event); - base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_preroll); - base_sink_class->render = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_render); - if (0) - base_sink_class->async_play = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_async_play); - if (0) - base_sink_class->activate_pull = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_activate_pull); - base_sink_class->fixate = GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_fixate); - base_sink_class->unlock_stop = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_unlock_stop); - base_sink_class->render_list = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_sink_render_list); - - g_object_class_install_property (gobject_class, PROP_DEVICE, - g_param_spec_string ("device", "Device", "device to transmit data on", - DEFAULT_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -static void -gst_linsys_sdi_sink_init (GstLinsysSdiSink * linsyssdisink, - GstLinsysSdiSinkClass * linsyssdisink_class) -{ - linsyssdisink->device = g_strdup (DEFAULT_DEVICE); -} - -void -gst_linsys_sdi_sink_set_property (GObject * object, guint property_id, - const GValue * value, GParamSpec * pspec) -{ - GstLinsysSdiSink *linsyssdisink; - - g_return_if_fail (GST_IS_LINSYS_SDI_SINK (object)); - linsyssdisink = GST_LINSYS_SDI_SINK (object); - - switch (property_id) { - case PROP_DEVICE: - g_free (linsyssdisink->device); - linsyssdisink->device = g_value_dup_string (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -void -gst_linsys_sdi_sink_get_property (GObject * object, guint property_id, - GValue * value, GParamSpec * pspec) -{ - GstLinsysSdiSink *linsyssdisink; - - g_return_if_fail (GST_IS_LINSYS_SDI_SINK (object)); - linsyssdisink = GST_LINSYS_SDI_SINK (object); - - switch (property_id) { - case PROP_DEVICE: - g_value_set_string (value, linsyssdisink->device); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -void -gst_linsys_sdi_sink_dispose (GObject * object) -{ - GstLinsysSdiSink *linsyssdisink; - - g_return_if_fail (GST_IS_LINSYS_SDI_SINK (object)); - linsyssdisink = GST_LINSYS_SDI_SINK (object); - - /* clean up as possible. may be called multiple times */ - g_free (linsyssdisink->device); - linsyssdisink->device = NULL; - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -void -gst_linsys_sdi_sink_finalize (GObject * object) -{ - g_return_if_fail (GST_IS_LINSYS_SDI_SINK (object)); - - /* clean up object here */ - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - - - -static GstCaps * -gst_linsys_sdi_sink_get_caps (GstBaseSink * sink) -{ - GST_ERROR_OBJECT (sink, "get_caps"); - - return NULL; -} - -static gboolean -gst_linsys_sdi_sink_set_caps (GstBaseSink * sink, GstCaps * caps) -{ - GST_ERROR_OBJECT (sink, "set_caps"); - - return TRUE; -} - -static GstFlowReturn -gst_linsys_sdi_sink_buffer_alloc (GstBaseSink * sink, guint64 offset, - guint size, GstCaps * caps, GstBuffer ** buf) -{ - GST_ERROR_OBJECT (sink, "buffer_alloc"); - - return GST_FLOW_ERROR; -} - -static void -gst_linsys_sdi_sink_get_times (GstBaseSink * sink, GstBuffer * buffer, - GstClockTime * start, GstClockTime * end) -{ - -} - -static gboolean -gst_linsys_sdi_sink_start (GstBaseSink * sink) -{ - GstLinsysSdiSink *linsyssdisink = GST_LINSYS_SDI_SINK (sink); - int fd; - - GST_ERROR_OBJECT (sink, "start"); - - fd = open (linsyssdisink->device, O_WRONLY, 0); - if (fd < 0) { - GST_ERROR_OBJECT (sink, "failed to open device"); - return FALSE; - } - - linsyssdisink->fd = fd; - linsyssdisink->tmpdata = g_malloc (858 * 525 * 2); - - return TRUE; -} - -static gboolean -gst_linsys_sdi_sink_stop (GstBaseSink * sink) -{ - GstLinsysSdiSink *linsyssdisink = GST_LINSYS_SDI_SINK (sink); - - GST_ERROR_OBJECT (sink, "stop"); - - if (linsyssdisink->fd > 0) { - close (linsyssdisink->fd); - } - g_free (linsyssdisink->tmpdata); - linsyssdisink->tmpdata = NULL; - - return TRUE; -} - -static gboolean -gst_linsys_sdi_sink_unlock (GstBaseSink * sink) -{ - GST_ERROR_OBJECT (sink, "unlock"); - - return TRUE; -} - -static gboolean -gst_linsys_sdi_sink_event (GstBaseSink * sink, GstEvent * event) -{ - GST_ERROR_OBJECT (sink, "event"); - - return TRUE; -} - -static GstFlowReturn -gst_linsys_sdi_sink_preroll (GstBaseSink * sink, GstBuffer * buffer) -{ - GST_ERROR_OBJECT (sink, "preroll"); - - return GST_FLOW_OK; -} - -#define EAV 0x74 -#define SAV 0x80 - -static int -get_av (int f, int v, int h) -{ - static const int table[] = { - 0x80, 0x9d, 0xab, 0xb6, 0xc7, 0xda, 0xec, 0xf1 - }; - - return table[(f << 2) | (v << 1) | h]; -} - -static void -sdi_mux (guint8 * data, GstBuffer * buffer) -{ - int j; - int i; - guint8 *dest; - int f, v; - int line; - - for (j = 0; j < 525; j++) { - dest = data + 858 * 2 * j; - - line = (j + 4) % 525; - - if (line < 10 || (line >= 264 && line < 273)) { - v = 1; - } else { - v = 0; - } - - if (line >= 266 || line < 4) { - f = 1; - } else { - f = 0; - } - - dest[0] = 0xff; - dest[1] = 0; - dest[2] = 0; - dest[3] = get_av (f, v, 1); - - for (i = 1; i < (858 - 720) / 2 - 1; i++) { - dest[i * 4 + 0] = 0x200 >> 2; - dest[i * 4 + 1] = 0x040 >> 2; - dest[i * 4 + 2] = 0x200 >> 2; - dest[i * 4 + 3] = 0x040 >> 2; - } - - i = (858 - 720) / 2 - 1; - dest[i * 4 + 0] = 0xff; - dest[i * 4 + 1] = 0x00; - dest[i * 4 + 2] = 0x00; - dest[3] = get_av (f, v, 0); - - i = (858 - 720) / 2; - if (line >= 23 && line <= 262) { - int src_line = (line - 23) * 2 + 1; - memcpy (dest + i * 4, GST_BUFFER_DATA (buffer) + 720 * 2 * src_line, - 720 * 2); - } else if (line >= 285 && line <= 525) { - int src_line = (line - 285) * 2 + 0; - memcpy (dest + i * 4, GST_BUFFER_DATA (buffer) + 720 * 2 * src_line, - 720 * 2); - } else { - for (i = (858 - 720) / 2; i < 858 / 2; i++) { - dest[i * 4 + 0] = 0x200 >> 2; - dest[i * 4 + 1] = 0x040 >> 2; - dest[i * 4 + 2] = 0x200 >> 2; - dest[i * 4 + 3] = 0x040 >> 2; - } - } - } - -} - -static GstFlowReturn -gst_linsys_sdi_sink_render (GstBaseSink * sink, GstBuffer * buffer) -{ - GstLinsysSdiSink *linsyssdisink = GST_LINSYS_SDI_SINK (sink); - int ret; - struct pollfd pfd; - int offset; - guint8 *data = linsyssdisink->tmpdata; - - GST_ERROR_OBJECT (sink, "render"); - - sdi_mux (data, buffer); - - offset = 0; -#define SIZE (858*525*2) - while (offset < SIZE) { - pfd.fd = linsyssdisink->fd; - pfd.events = POLLOUT | POLLPRI; - ret = poll (&pfd, 1, -1); - if (ret < 0) { - GST_ERROR_OBJECT (sink, "poll failed %d", ret); - return GST_FLOW_ERROR; - } - - if (pfd.revents & POLLOUT) { - ret = write (linsyssdisink->fd, data + offset, SIZE - offset); - if (ret < 0) { - GST_ERROR_OBJECT (sink, "write failed %d", ret); - return GST_FLOW_ERROR; - } - offset += ret; - } - if (pfd.revents & POLLPRI) { - long val; - - ret = ioctl (linsyssdisink->fd, SDIVIDEO_IOC_TXGETEVENTS, &val); - if (ret < 0) { - GST_ERROR_OBJECT (sink, "ioctl failed %d", ret); - return GST_FLOW_ERROR; - } - if (val & SDIVIDEO_EVENT_TX_BUFFER) { - GST_ERROR_OBJECT (sink, "transmit buffer underrun"); - return GST_FLOW_ERROR; - } - if (val & SDIVIDEO_EVENT_TX_FIFO) { - GST_ERROR_OBJECT (sink, "transmit FIFO underrun"); - return GST_FLOW_ERROR; - } - if (val & SDIVIDEO_EVENT_TX_DATA) { - GST_ERROR_OBJECT (sink, "transmit status change"); - } - } - } - - return GST_FLOW_OK; -} - -static GstStateChangeReturn -gst_linsys_sdi_sink_async_play (GstBaseSink * sink) -{ - GST_ERROR_OBJECT (sink, "render"); - - return GST_STATE_CHANGE_SUCCESS; -} - -static gboolean -gst_linsys_sdi_sink_activate_pull (GstBaseSink * sink, gboolean active) -{ - GST_ERROR_OBJECT (sink, "activate_pull"); - - return TRUE; -} - -static void -gst_linsys_sdi_sink_fixate (GstBaseSink * sink, GstCaps * caps) -{ - GST_ERROR_OBJECT (sink, "fixate"); - -} - -static gboolean -gst_linsys_sdi_sink_unlock_stop (GstBaseSink * sink) -{ - GST_ERROR_OBJECT (sink, "unlock_stop"); - - return TRUE; -} - -static GstFlowReturn -gst_linsys_sdi_sink_render_list (GstBaseSink * sink, - GstBufferList * buffer_list) -{ - GST_ERROR_OBJECT (sink, "render_list"); - - return GST_FLOW_OK; -} diff --git a/sys/linsys/gstlinsyssdisink.h b/sys/linsys/gstlinsyssdisink.h deleted file mode 100644 index f036af72a..000000000 --- a/sys/linsys/gstlinsyssdisink.h +++ /dev/null @@ -1,59 +0,0 @@ -/* GStreamer - * Copyright (C) 2010 FIXME <fixme@example.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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _GST_LINSYS_SDI_SINK_H_ -#define _GST_LINSYS_SDI_SINK_H_ - -#include <gst/gst.h> -#include <gst/base/gstbasesink.h> - - -G_BEGIN_DECLS - -#define GST_TYPE_LINSYS_SDI_SINK (gst_linsys_sdi_sink_get_type()) -#define GST_LINSYS_SDI_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LINSYS_SDI_SINK,GstLinsysSdiSink)) -#define GST_LINSYS_SDI_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LINSYS_SDI_SINK,GstLinsysSdiSinkClass)) -#define GST_IS_LINSYS_SDI_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LINSYS_SDI_SINK)) -#define GST_IS_LINSYS_SDI_SINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LINSYS_SDI_SINK)) - -typedef struct _GstLinsysSdiSink GstLinsysSdiSink; -typedef struct _GstLinsysSdiSinkClass GstLinsysSdiSinkClass; - -struct _GstLinsysSdiSink -{ - GstBaseSink base_linsyssdisink; - - /* properties */ - gchar *device; - - /* state */ - int fd; - guint8 *tmpdata; -}; - -struct _GstLinsysSdiSinkClass -{ - GstBaseSinkClass base_linsyssdisink_class; -}; - -GType gst_linsys_sdi_sink_get_type (void); - -G_END_DECLS - -#endif diff --git a/sys/linsys/gstlinsyssdisrc.c b/sys/linsys/gstlinsyssdisrc.c deleted file mode 100644 index 43e289881..000000000 --- a/sys/linsys/gstlinsyssdisrc.c +++ /dev/null @@ -1,551 +0,0 @@ -/* GStreamer - * Copyright (C) 2010 David Schleef <ds@entropywave.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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gst/gst.h> -#include <gst/base/gstbasesrc.h> -#include "gstlinsyssdisrc.h" - -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <poll.h> -#include <sys/ioctl.h> - -#include "sdivideo.h" - -/* prototypes */ - - -static void gst_linsys_sdi_src_set_property (GObject * object, - guint property_id, const GValue * value, GParamSpec * pspec); -static void gst_linsys_sdi_src_get_property (GObject * object, - guint property_id, GValue * value, GParamSpec * pspec); -static void gst_linsys_sdi_src_dispose (GObject * object); -static void gst_linsys_sdi_src_finalize (GObject * object); - -static GstCaps *gst_linsys_sdi_src_get_caps (GstBaseSrc * src); -static gboolean gst_linsys_sdi_src_set_caps (GstBaseSrc * src, GstCaps * caps); -static gboolean gst_linsys_sdi_src_negotiate (GstBaseSrc * src); -static gboolean gst_linsys_sdi_src_newsegment (GstBaseSrc * src); -static gboolean gst_linsys_sdi_src_start (GstBaseSrc * src); -static gboolean gst_linsys_sdi_src_stop (GstBaseSrc * src); -static void -gst_linsys_sdi_src_get_times (GstBaseSrc * src, GstBuffer * buffer, - GstClockTime * start, GstClockTime * end); -static gboolean gst_linsys_sdi_src_get_size (GstBaseSrc * src, guint64 * size); -static gboolean gst_linsys_sdi_src_is_seekable (GstBaseSrc * src); -static gboolean gst_linsys_sdi_src_unlock (GstBaseSrc * src); -static gboolean gst_linsys_sdi_src_event (GstBaseSrc * src, GstEvent * event); -static GstFlowReturn -gst_linsys_sdi_src_create (GstBaseSrc * src, guint64 offset, guint size, - GstBuffer ** buf); -static gboolean gst_linsys_sdi_src_do_seek (GstBaseSrc * src, - GstSegment * segment); -static gboolean gst_linsys_sdi_src_query (GstBaseSrc * src, GstQuery * query); -static gboolean gst_linsys_sdi_src_check_get_range (GstBaseSrc * src); -static void gst_linsys_sdi_src_fixate (GstBaseSrc * src, GstCaps * caps); -static gboolean gst_linsys_sdi_src_unlock_stop (GstBaseSrc * src); -static gboolean -gst_linsys_sdi_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek, - GstSegment * segment); - -enum -{ - PROP_0, - PROP_DEVICE -}; - -#define DEFAULT_DEVICE "/dev/sdirx0" - -GST_DEBUG_CATEGORY (gst_linsys_sdi_src_debug); -#define GST_CAT_DEFAULT gst_linsys_sdi_src_debug - -/* pad templates */ - -static GstStaticPadTemplate gst_linsys_sdi_src_src_template = -GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("video/x-raw-yuv,format=(fourcc)UYVY," - "width=720,height=480,pixel-aspect-ratio=10/11," - "framerate=30000/1001,interlaced=true," - "colorspec=sdtv,chroma-site=mpeg2") - ); - -/* class initialization */ - -GST_BOILERPLATE (GstLinsysSdiSrc, gst_linsys_sdi_src, GstBaseSrc, - GST_TYPE_BASE_SRC); - -static void -gst_linsys_sdi_src_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_static_pad_template (element_class, - &gst_linsys_sdi_src_src_template); - - gst_element_class_set_static_metadata (element_class, "SDI video source", - "Source/Video", "Reads video from SDI capture device", - "David Schleef <ds@entropywave.com>"); -} - -static void -gst_linsys_sdi_src_class_init (GstLinsysSdiSrcClass * klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass); - - GST_DEBUG_CATEGORY_INIT (gst_linsys_sdi_src_debug, "linsyssdisrc", 0, - "FIXME"); - - gobject_class->set_property = gst_linsys_sdi_src_set_property; - gobject_class->get_property = gst_linsys_sdi_src_get_property; - gobject_class->dispose = gst_linsys_sdi_src_dispose; - gobject_class->finalize = gst_linsys_sdi_src_finalize; - base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_get_caps); - base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_set_caps); - if (0) - base_src_class->negotiate = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_negotiate); - base_src_class->newsegment = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_newsegment); - base_src_class->start = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_start); - base_src_class->stop = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_stop); - base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_get_times); - base_src_class->get_size = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_get_size); - base_src_class->is_seekable = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_is_seekable); - base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_unlock); - base_src_class->event = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_event); - base_src_class->create = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_create); - if (0) - base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_do_seek); - base_src_class->query = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_query); - base_src_class->check_get_range = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_check_get_range); - base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_fixate); - base_src_class->unlock_stop = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_unlock_stop); - base_src_class->prepare_seek_segment = - GST_DEBUG_FUNCPTR (gst_linsys_sdi_src_prepare_seek_segment); - - g_object_class_install_property (gobject_class, PROP_DEVICE, - g_param_spec_string ("device", "Device", "device to transmit data on", - DEFAULT_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -static void -gst_linsys_sdi_src_init (GstLinsysSdiSrc * linsyssdisrc, - GstLinsysSdiSrcClass * linsyssdisrc_class) -{ - - gst_base_src_set_live (GST_BASE_SRC (linsyssdisrc), TRUE); - gst_base_src_set_blocksize (GST_BASE_SRC (linsyssdisrc), 720 * 480 * 2); - - linsyssdisrc->device = g_strdup (DEFAULT_DEVICE); - - linsyssdisrc->is_625 = FALSE; - linsyssdisrc->fd = -1; -} - -void -gst_linsys_sdi_src_set_property (GObject * object, guint property_id, - const GValue * value, GParamSpec * pspec) -{ - GstLinsysSdiSrc *linsyssdisrc; - - g_return_if_fail (GST_IS_LINSYS_SDI_SRC (object)); - linsyssdisrc = GST_LINSYS_SDI_SRC (object); - - switch (property_id) { - case PROP_DEVICE: - g_free (linsyssdisrc->device); - linsyssdisrc->device = g_value_dup_string (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -void -gst_linsys_sdi_src_get_property (GObject * object, guint property_id, - GValue * value, GParamSpec * pspec) -{ - GstLinsysSdiSrc *linsyssdisrc; - - g_return_if_fail (GST_IS_LINSYS_SDI_SRC (object)); - linsyssdisrc = GST_LINSYS_SDI_SRC (object); - - switch (property_id) { - case PROP_DEVICE: - g_value_set_string (value, linsyssdisrc->device); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -void -gst_linsys_sdi_src_dispose (GObject * object) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (object); - g_return_if_fail (linsyssdisrc != NULL); - - /* clean up as possible. may be called multiple times */ - g_free (linsyssdisrc->device); - linsyssdisrc->device = NULL; - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -void -gst_linsys_sdi_src_finalize (GObject * object) -{ - g_return_if_fail (GST_IS_LINSYS_SDI_SRC (object)); - - /* clean up object here */ - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - - -static GstCaps * -gst_linsys_sdi_src_get_caps (GstBaseSrc * src) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "get_caps"); - - return NULL; -} - -static gboolean -gst_linsys_sdi_src_set_caps (GstBaseSrc * src, GstCaps * caps) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "set_caps"); - - return TRUE; -} - -static gboolean -gst_linsys_sdi_src_negotiate (GstBaseSrc * src) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "negotiate"); - - return TRUE; -} - -static gboolean -gst_linsys_sdi_src_newsegment (GstBaseSrc * src) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "newsegment"); - - return TRUE; -} - -static gboolean -gst_linsys_sdi_src_start (GstBaseSrc * src) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - int fd; - - GST_DEBUG_OBJECT (linsyssdisrc, "start"); - - fd = open (linsyssdisrc->device, O_RDONLY); - if (fd < 0) { - GST_ERROR_OBJECT (src, "failed to open device"); - return FALSE; - } - - linsyssdisrc->fd = fd; - - if (linsyssdisrc->is_625) { - linsyssdisrc->tmpdata = g_malloc (864 * 625 * 2); - } else { - linsyssdisrc->tmpdata = g_malloc (858 * 525 * 2); - } - linsyssdisrc->have_sync = FALSE; - - return TRUE; -} - -static gboolean -gst_linsys_sdi_src_stop (GstBaseSrc * src) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "stop"); - -#if 0 - if (linsyssdisrc->fd > 0) { - close (linsyssdisrc->fd); - linsyssdisrc->fd = -1; - } - g_free (linsyssdisrc->tmpdata); - linsyssdisrc->tmpdata = NULL; -#endif - - return TRUE; -} - -static void -gst_linsys_sdi_src_get_times (GstBaseSrc * src, GstBuffer * buffer, - GstClockTime * start, GstClockTime * end) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "get_times"); -} - -static gboolean -gst_linsys_sdi_src_get_size (GstBaseSrc * src, guint64 * size) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "get_size"); - - return FALSE; -} - -static gboolean -gst_linsys_sdi_src_is_seekable (GstBaseSrc * src) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "is_seekable"); - - return FALSE; -} - -static gboolean -gst_linsys_sdi_src_unlock (GstBaseSrc * src) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "unlock"); - - return TRUE; -} - -static gboolean -gst_linsys_sdi_src_event (GstBaseSrc * src, GstEvent * event) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "event"); - - return TRUE; -} - -static void -sdi_demux (guint8 * data, GstBuffer * buf, gboolean is_625) -{ - int j; - int line; - int offset; - - if (is_625) { - offset = (864 - 720) / 2; - - for (j = 0; j < 480; j++) { - if (j & 1) { - line = 23 + (j - 1) / 2; - } else { - line = 335 + j / 2; - } - memcpy (GST_BUFFER_DATA (buf) + j * 720 * 2, - data + (line - 1) * 864 * 2 + offset * 4, 720 * 2); - } - } else { - offset = (858 - 720) / 2; - - for (j = 0; j < 480; j++) { - if (j & 1) { - line = 23 + (j - 1) / 2; - } else { - line = 285 + j / 2; - } - memcpy (GST_BUFFER_DATA (buf) + j * 720 * 2, - data + (line - 1) * 858 * 2 + offset * 4, 720 * 2); - } - } - -} - -static GstFlowReturn -gst_linsys_sdi_src_create (GstBaseSrc * src, guint64 _offset, guint size, - GstBuffer ** buf) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - int offset; - int ret; - struct pollfd pfd; - int sdi_size; - int sdi_width; - guint8 *data = linsyssdisrc->tmpdata; - - if (linsyssdisrc->fd < 0) - return GST_FLOW_FLUSHING; - - if (linsyssdisrc->is_625) { - sdi_width = 864; - sdi_size = 864 * 625 * 2; - } else { - sdi_width = 858; - sdi_size = 858 * 525 * 2; - } - - GST_DEBUG_OBJECT (linsyssdisrc, "create size=%d fd=%d", size, - linsyssdisrc->fd); - - offset = 0; - while (offset < sdi_size) { - pfd.fd = linsyssdisrc->fd; - pfd.events = POLLIN | POLLPRI; - ret = poll (&pfd, 1, 1000); - if (ret < 0) { - GST_ERROR_OBJECT (src, "poll failed %d", ret); - return GST_FLOW_ERROR; - } - - if (pfd.revents & POLLIN) { - if (linsyssdisrc->have_sync) { - ret = read (linsyssdisrc->fd, data + offset, sdi_size - offset); - } else { - ret = read (linsyssdisrc->fd, data + offset, sdi_width * 2); - } - if (ret < 0) { - GST_ERROR_OBJECT (src, "read failed %d", ret); - return GST_FLOW_ERROR; - } - - if (!linsyssdisrc->have_sync) { - int v = (data[3] >> 5) & 1; - int f = (data[3] >> 6) & 1; - if (!linsyssdisrc->have_vblank && (f == 0) && (v == 1)) { - linsyssdisrc->have_vblank = TRUE; - } else if (linsyssdisrc->have_vblank && (f == 0) && (v == 0)) { - offset += sdi_width * 2 * 9; - linsyssdisrc->have_sync = TRUE; - offset += ret; - } - } else { - offset += ret; - } - } - if (pfd.revents & POLLPRI) { - long val; - - ret = ioctl (linsyssdisrc->fd, SDIVIDEO_IOC_RXGETEVENTS, &val); - if (ret < 0) { - GST_ERROR_OBJECT (src, "ioctl failed %d", ret); - return GST_FLOW_ERROR; - } - if (val & SDIVIDEO_EVENT_RX_BUFFER) { - GST_ERROR_OBJECT (src, "receive buffer overrun"); - return GST_FLOW_ERROR; - } - if (val & SDIVIDEO_EVENT_RX_FIFO) { - GST_ERROR_OBJECT (src, "receive FIFO overrun"); - return GST_FLOW_ERROR; - } - if (val & SDIVIDEO_EVENT_RX_CARRIER) { - GST_ERROR_OBJECT (src, "carrier status change"); - } - } - } - - *buf = gst_buffer_new_and_alloc (size); - sdi_demux (data, *buf, linsyssdisrc->is_625); - - return GST_FLOW_OK; -} - -static gboolean -gst_linsys_sdi_src_do_seek (GstBaseSrc * src, GstSegment * segment) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "do_seek"); - - return FALSE; -} - -static gboolean -gst_linsys_sdi_src_query (GstBaseSrc * src, GstQuery * query) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "query"); - - return TRUE; -} - -static gboolean -gst_linsys_sdi_src_check_get_range (GstBaseSrc * src) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "get_range"); - - return FALSE; -} - -static void -gst_linsys_sdi_src_fixate (GstBaseSrc * src, GstCaps * caps) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "fixate"); -} - -static gboolean -gst_linsys_sdi_src_unlock_stop (GstBaseSrc * src) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "stop"); - - return TRUE; -} - -static gboolean -gst_linsys_sdi_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek, - GstSegment * segment) -{ - GstLinsysSdiSrc *linsyssdisrc = GST_LINSYS_SDI_SRC (src); - - GST_DEBUG_OBJECT (linsyssdisrc, "seek_segment"); - - return FALSE; -} diff --git a/sys/linsys/gstlinsyssdisrc.h b/sys/linsys/gstlinsyssdisrc.h deleted file mode 100644 index 80d8d3148..000000000 --- a/sys/linsys/gstlinsyssdisrc.h +++ /dev/null @@ -1,62 +0,0 @@ -/* GStreamer - * Copyright (C) 2010 FIXME <fixme@example.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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef _GST_LINSYS_SDI_SRC_H_ -#define _GST_LINSYS_SDI_SRC_H_ - -#include <gst/gst.h> -#include <gst/base/gstbasesrc.h> - -G_BEGIN_DECLS - -#define GST_TYPE_LINSYS_SDI_SRC (gst_linsys_sdi_src_get_type()) -#define GST_LINSYS_SDI_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_LINSYS_SDI_SRC,GstLinsysSdiSrc)) -#define GST_LINSYS_SDI_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_LINSYS_SDI_SRC,GstLinsysSdiSrcClass)) -#define GST_IS_LINSYS_SDI_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_LINSYS_SDI_SRC)) -#define GST_IS_LINSYS_SDI_SRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_LINSYS_SDI_SRC)) - -typedef struct _GstLinsysSdiSrc GstLinsysSdiSrc; -typedef struct _GstLinsysSdiSrcClass GstLinsysSdiSrcClass; - -struct _GstLinsysSdiSrc -{ - GstBaseSrc base_linsyssdisrc; - - /* properties */ - gchar *device; - gboolean is_625; - - /* state */ - int fd; - guint8 *tmpdata; - gboolean have_sync; - gboolean have_vblank; - -}; - -struct _GstLinsysSdiSrcClass -{ - GstBaseSrcClass base_linsyssdisrc_class; -}; - -GType gst_linsys_sdi_src_get_type (void); - -G_END_DECLS - -#endif diff --git a/sys/linsys/include/asi.h b/sys/linsys/include/asi.h deleted file mode 100644 index 89635886d..000000000 --- a/sys/linsys/include/asi.h +++ /dev/null @@ -1,255 +0,0 @@ -/* asi.h - * - * Shared header file for the Linux user-space API for - * Linear Systems Ltd. DVB Master ASI interface boards. - * - * Copyright (C) 1999 Tony Bolger <d7v@indigo.ie> - * Copyright (C) 2000-2009 Linear Systems Ltd. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Linear Systems Ltd. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY LINEAR SYSTEMS LTD. "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL LINEAR SYSTEMS LTD. OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Linear Systems can be contacted at <http://www.linsys.ca/>. - * - */ - -#ifndef _ASI_H -#define _ASI_H - -/* Driver info */ -#define ASI_DRIVER_NAME "asi" - -#define ASI_MAJOR 61 /* Set to 0 for dynamic allocation. - * Otherwise, 61 is available. - * See /usr/src/linux/Documentation/devices.txt */ - -#define ASI_TX_BUFFERS_MIN 2 /* This must be at least 2 */ -/* The minimum transmit buffer size must be positive, divisible by 8, - * and large enough that the buffers aren't transferred to the onboard FIFOs - * too quickly for the machine to handle the interrupts. - * This is especially a problem at startup, when the FIFOs are empty. - * Relevant factors include onboard FIFO size, PCI bus throughput, - * processor speed, and interrupt latency. */ -#define ASI_TX_BUFSIZE_MIN 1024 -#define ASI_RX_BUFFERS_MIN 2 /* This must be at least 2 */ -#define ASI_RX_BUFSIZE_MIN 8 /* This must be positive and divisible by 8 */ - -#define ASI_TX_BUFFERS 54 /* This must be at least 2 */ -#define ASI_TX_BUFSIZE 38352 /* This must be positive and divisible by 8 */ -#define ASI_RX_BUFFERS 54 /* This must be at least 2 */ -#define ASI_RX_BUFSIZE 38352 /* This must be positive and divisible by 8 */ - -/* Ioctl () definitions */ -#define ASI_IOC_MAGIC '?' /* This ioctl magic number is currently free. See - * /usr/src/linux/Documentation/ioctl-number.txt */ - -#define ASI_IOC_TXGETCAP _IOR(ASI_IOC_MAGIC, 1, unsigned int) -#define ASI_IOC_TXGETEVENTS _IOR(ASI_IOC_MAGIC, 2, unsigned int) -#define ASI_IOC_TXGETBUFLEVEL _IOR(ASI_IOC_MAGIC, 3, unsigned int) -#define ASI_IOC_TXSETSTUFFING _IOW(ASI_IOC_MAGIC, 4, struct asi_txstuffing) -#define ASI_IOC_TXGETBYTECOUNT _IOR(ASI_IOC_MAGIC, 5, unsigned int) -/* #define ASI_IOC_TXGETFIFO _IOR(ASI_IOC_MAGIC, 6, int) */ -#define ASI_IOC_TXGETTXD _IOR(ASI_IOC_MAGIC, 7, int) -#define ASI_IOC_TXGET27COUNT _IOR(ASI_IOC_MAGIC, 8, unsigned int) -/* Provide compatibility with applications compiled for older API */ -#define ASI_IOC_TXSETPID_DEPRECATED _IOR(ASI_IOC_MAGIC, 9, unsigned int) -#define ASI_IOC_TXSETPID _IOW(ASI_IOC_MAGIC, 9, unsigned int) -#define ASI_IOC_TXGETPCRSTAMP _IOR(ASI_IOC_MAGIC, 10, struct asi_pcrstamp) -/* Provide compatibility with applications compiled for older API */ -#define ASI_IOC_TXCHANGENEXTIP_DEPRECATED _IOR(ASI_IOC_MAGIC, 11, int) -#define ASI_IOC_TXCHANGENEXTIP _IOW(ASI_IOC_MAGIC, 11, int) - -#define ASI_IOC_RXGETCAP _IOR(ASI_IOC_MAGIC, 65, unsigned int) -#define ASI_IOC_RXGETEVENTS _IOR(ASI_IOC_MAGIC, 66, unsigned int) -#define ASI_IOC_RXGETBUFLEVEL _IOR(ASI_IOC_MAGIC, 67, unsigned int) -/* #define ASI_IOC_RXSETREFRAME _IOW(ASI_IOC_MAGIC, 68, int) */ -#define ASI_IOC_RXGETSTATUS _IOR(ASI_IOC_MAGIC, 69, int) -#define ASI_IOC_RXGETBYTECOUNT _IOR(ASI_IOC_MAGIC, 70, unsigned int) -/* #define ASI_IOC_RXGETFIFO _IOR(ASI_IOC_MAGIC, 71, int) */ -#define ASI_IOC_RXSETINVSYNC _IOW(ASI_IOC_MAGIC, 72, int) -#define ASI_IOC_RXGETCARRIER _IOR(ASI_IOC_MAGIC, 73, int) -#define ASI_IOC_RXSETDSYNC _IOW(ASI_IOC_MAGIC, 74, int) -#define ASI_IOC_RXGETRXD _IOR(ASI_IOC_MAGIC, 75, int) -#define ASI_IOC_RXSETPF _IOW(ASI_IOC_MAGIC, 76, unsigned int [256]) -/* #define ASI_IOC_RXSETPFE _IOW(ASI_IOC_MAGIC, 77, int) */ -#define ASI_IOC_RXSETPID0 _IOW(ASI_IOC_MAGIC, 78, int) -#define ASI_IOC_RXGETPID0COUNT _IOR(ASI_IOC_MAGIC, 79, unsigned int) -#define ASI_IOC_RXSETPID1 _IOW(ASI_IOC_MAGIC, 80, int) -#define ASI_IOC_RXGETPID1COUNT _IOR(ASI_IOC_MAGIC, 81, unsigned int) -#define ASI_IOC_RXSETPID2 _IOW(ASI_IOC_MAGIC, 82, int) -#define ASI_IOC_RXGETPID2COUNT _IOR(ASI_IOC_MAGIC, 83, unsigned int) -#define ASI_IOC_RXSETPID3 _IOW(ASI_IOC_MAGIC, 84, int) -#define ASI_IOC_RXGETPID3COUNT _IOR(ASI_IOC_MAGIC, 85, unsigned int) -/* #define ASI_IOC_RXGETSTAMP _IOR(ASI_IOC_MAGIC, 86, unsigned int) */ -#define ASI_IOC_RXGET27COUNT _IOR(ASI_IOC_MAGIC, 87, unsigned int) -#define ASI_IOC_RXGETSTATUS2 _IOR(ASI_IOC_MAGIC, 88, int) -/* Provide compatibility with applications compiled for older API */ -#define ASI_IOC_RXSETINPUT_DEPRECATED _IOR(ASI_IOC_MAGIC, 89, int) -#define ASI_IOC_RXSETINPUT _IOW(ASI_IOC_MAGIC, 89, int) -#define ASI_IOC_RXGETRXD2 _IOR(ASI_IOC_MAGIC, 90, int) - -#define ASI_IOC_GETID _IOR(ASI_IOC_MAGIC, 129, unsigned int) -#define ASI_IOC_GETVERSION _IOR(ASI_IOC_MAGIC, 130, unsigned int) - -/* Transmitter event flag bit locations */ -#define ASI_EVENT_TX_BUFFER_ORDER 0 -#define ASI_EVENT_TX_BUFFER (1 << ASI_EVENT_TX_BUFFER_ORDER) -#define ASI_EVENT_TX_FIFO_ORDER 1 -#define ASI_EVENT_TX_FIFO (1 << ASI_EVENT_TX_FIFO_ORDER) -#define ASI_EVENT_TX_DATA_ORDER 2 -#define ASI_EVENT_TX_DATA (1 << ASI_EVENT_TX_DATA_ORDER) - -/* Receiver event flag bit locations */ -#define ASI_EVENT_RX_BUFFER_ORDER 0 -#define ASI_EVENT_RX_BUFFER (1 << ASI_EVENT_RX_BUFFER_ORDER) -#define ASI_EVENT_RX_FIFO_ORDER 1 -#define ASI_EVENT_RX_FIFO (1 << ASI_EVENT_RX_FIFO_ORDER) -#define ASI_EVENT_RX_CARRIER_ORDER 2 -#define ASI_EVENT_RX_CARRIER (1 << ASI_EVENT_RX_CARRIER_ORDER) -#define ASI_EVENT_RX_AOS_ORDER 3 -#define ASI_EVENT_RX_AOS (1 << ASI_EVENT_RX_AOS_ORDER) -#define ASI_EVENT_RX_LOS_ORDER 4 -#define ASI_EVENT_RX_LOS (1 << ASI_EVENT_RX_LOS_ORDER) -#define ASI_EVENT_RX_DATA_ORDER 5 -#define ASI_EVENT_RX_DATA (1 << ASI_EVENT_RX_DATA_ORDER) - -/** - * asi_txstuffing - Transmitter stuffing parameters - * @ib: interbyte stuffing - * @ip: interpacket stuffing - * @normal_ip: FT0 - * @big_ip: FT1 - * @il_normal: IL0 - * @il_big: IL1 - **/ -struct asi_txstuffing { - /* Number of K28.5 characters to insert between packet bytes */ - unsigned int ib; - - /* Base number of K28.5 characters to insert between packets, - * not including the two required by ASI */ - unsigned int ip; - - /* Number of packets with (ip) bytes of interpacket stuffing - * per finetuning cycle */ - unsigned int normal_ip; - - /* Number of packets with (ip + 1) bytes of interpacket stuffing - * per finetuning cycle */ - unsigned int big_ip; - - /* Number of packets with (ip) bytes of interpacket stuffing - * per interleaved finetuning cycle */ - unsigned int il_normal; - - /* Number of packets with (ip + 1) bytes of interpacket stuffing - * per interleaved finetuning cycle */ - unsigned int il_big; -}; - -/** - * asi_pcrstamp - PCR - departure time pair - * @adaptation_field_length: adaptation field length - * @adaptation_field_flags: adaptation field flags - * @PCR: a program clock reference - * @count: departure time of this PCR, in 1 / 27 MHz - **/ -struct asi_pcrstamp { - unsigned char adaptation_field_length; - unsigned char adaptation_field_flags; - unsigned char PCR[6]; - long long int count; -}; - -/* Interface capabilities */ -#define ASI_CAP_TX_MAKE204 0x00000004 -#define ASI_CAP_TX_FINETUNING 0x00000008 -#define ASI_CAP_TX_BYTECOUNTER 0x00000010 -#define ASI_CAP_TX_SETCLKSRC 0x00000020 -#define ASI_CAP_TX_FIFOUNDERRUN 0x00000040 -#define ASI_CAP_TX_LARGEIB 0x00000080 -#define ASI_CAP_TX_INTERLEAVING 0x00000100 -#define ASI_CAP_TX_DATA 0x00000200 -#define ASI_CAP_TX_RXCLKSRC 0x00000400 -/* #define ASI_CAP_TX_COMPOSITEREF 0x00000800 */ -#define ASI_CAP_TX_PCRSTAMP 0x00001000 -#define ASI_CAP_TX_CHANGENEXTIP 0x00002000 -#define ASI_CAP_TX_27COUNTER 0x00004000 -#define ASI_CAP_TX_BYTESOR27 0x00008000 -#define ASI_CAP_TX_TIMESTAMPS 0x00010000 -#define ASI_CAP_TX_PTIMESTAMPS 0x00020000 -#define ASI_CAP_TX_NULLPACKETS 0x00040000 - -#define ASI_CAP_RX_SYNC 0x00000004 -#define ASI_CAP_RX_MAKE188 0x00000008 -#define ASI_CAP_RX_BYTECOUNTER 0x00000010 -/* #define ASI_CAP_RX_FIFOSTATUS 0x00000020 */ -#define ASI_CAP_RX_INVSYNC 0x00000040 -#define ASI_CAP_RX_CD 0x00000080 -#define ASI_CAP_RX_DSYNC 0x00000100 -#define ASI_CAP_RX_DATA 0x00000200 -#define ASI_CAP_RX_PIDFILTER 0x00000400 -#define ASI_CAP_RX_PIDCOUNTER 0x00000800 -#define ASI_CAP_RX_4PIDCOUNTER 0x00001000 -#define ASI_CAP_RX_FORCEDMA 0x00002000 -#define ASI_CAP_RX_27COUNTER 0x00004000 -#define ASI_CAP_RX_BYTESOR27 0x00008000 -#define ASI_CAP_RX_TIMESTAMPS 0x00010000 -#define ASI_CAP_RX_PTIMESTAMPS 0x00020000 -#define ASI_CAP_RX_NULLPACKETS 0x00040000 -#define ASI_CAP_RX_REDUNDANT 0x00080000 -#define ASI_CAP_RX_DATA2 0x00100000 - -/* Transmitter clock source settings */ -#define ASI_CTL_TX_CLKSRC_ONBOARD 0 -#define ASI_CTL_TX_CLKSRC_EXT 1 -#define ASI_CTL_TX_CLKSRC_RX 2 -/* #define ASI_CTL_TX_CLKSRC_EXT_PAL 3 */ - -/* Transmitter mode settings */ -#define ASI_CTL_TX_MODE_188 0 -#define ASI_CTL_TX_MODE_204 1 -#define ASI_CTL_TX_MODE_MAKE204 2 - -/* Receiver mode settings */ -#define ASI_CTL_RX_MODE_RAW 0 -#define ASI_CTL_RX_MODE_188 1 -#define ASI_CTL_RX_MODE_204 2 -#define ASI_CTL_RX_MODE_AUTO 3 -#define ASI_CTL_RX_MODE_AUTOMAKE188 4 -#define ASI_CTL_RX_MODE_204MAKE188 5 - -/* Timestamping settings */ -#define ASI_CTL_TSTAMP_NONE 0 -#define ASI_CTL_TSTAMP_APPEND 1 -#define ASI_CTL_TSTAMP_PREPEND 2 - -/* Transport settings */ -#define ASI_CTL_TRANSPORT_DVB_ASI 0 -#define ASI_CTL_TRANSPORT_SMPTE_310M 1 - -#endif - diff --git a/sys/linsys/include/master.h b/sys/linsys/include/master.h deleted file mode 100644 index 1d005c668..000000000 --- a/sys/linsys/include/master.h +++ /dev/null @@ -1,69 +0,0 @@ -/* master.h - * - * Global definitions for Linear Systems Ltd. - * digital television-related boards. - * - * Copyright (C) 2004-2009 Linear Systems Ltd. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Linear Systems Ltd. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY LINEAR SYSTEMS LTD. "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL LINEAR SYSTEMS LTD. OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Linear Systems can be contacted at <http://www.linsys.ca/>. - * - */ - -#ifndef _MASTER_H -#define _MASTER_H - -#define MASTER_DRIVER_VERSION "2.7.0" -#define MASTER_DRIVER_VERSION_CODE 0x020700 -#define MASTER_DRIVER_DATE "2010-01-11" - -#define MASTER_PCI_VENDOR_ID_LINSYS 0x1254 - -/* Device capabilities */ -#define MASTER_CAP_BYPASS 0x00000001 -#define MASTER_CAP_WATCHDOG 0x00000002 -#define MASTER_CAP_GPI 0x00000004 -#define MASTER_CAP_GPO 0x00000008 -#define MASTER_CAP_UID 0x00000010 -#define MASTER_CAP_BLACKBURST 0x00000020 - -/* Bypass mode settings */ -#define MASTER_CTL_BYPASS_ENABLE 0 -#define MASTER_CTL_BYPASS_DISABLE 1 -#define MASTER_CTL_BYPASS_WATCHDOG 2 - -/* Black burst type settings */ -#define MASTER_CTL_BLACKBURST_NTSC 0 -#define MASTER_CTL_BLACKBURST_PAL 1 - -/* Maximum watchdog timeout in milliseconds. - * Limited to 32 bits at 40 MHz or 27 MHz */ -#define MASTER_WATCHDOG_MAX 100000 - -#endif - diff --git a/sys/linsys/include/sdi.h b/sys/linsys/include/sdi.h deleted file mode 100644 index 659c41847..000000000 --- a/sys/linsys/include/sdi.h +++ /dev/null @@ -1,115 +0,0 @@ -/* sdi.h - * - * Shared header file for the Linux user-space API for - * Linear Systems Ltd. SMPTE 259M-C interface boards. - * - * Copyright (C) 2004-2009 Linear Systems Ltd. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Linear Systems Ltd. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY LINEAR SYSTEMS LTD. "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL LINEAR SYSTEMS LTD. OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Linear Systems can be contacted at <http://www.linsys.ca/>. - * - */ - -#ifndef _SDI_H -#define _SDI_H - -/* Driver info */ -#define SDI_DRIVER_NAME "sdi" - -#define SDI_MAJOR 121 /* Set to 0 for dynamic allocation. - * Otherwise, 121 is available. - * See /usr/src/linux/Documentation/devices.txt */ - -#define SDI_TX_BUFFERS_MIN 2 /* This must be at least 2 */ -/* The minimum transmit buffer size must be positive, divisible by 4, - * and large enough that the buffers aren't transferred to the onboard FIFOs - * too quickly for the machine to handle the interrupts. - * This is especially a problem at startup, when the FIFOs are empty. - * Relevant factors include onboard FIFO size, PCI bus throughput, - * processor speed, and interrupt latency. */ -#define SDI_TX_BUFSIZE_MIN 1024 -#define SDI_RX_BUFFERS_MIN 2 /* This must be at least 2 */ -#define SDI_RX_BUFSIZE_MIN 8 /* This must be positive and divisible by 4 */ - -#define SDI_TX_BUFFERS 25 /* This must be at least 2 */ -#define SDI_TX_BUFSIZE 1235520 /* This must be positive and divisible by 4 */ -#define SDI_RX_BUFFERS 25 /* This must be at least 2 */ -#define SDI_RX_BUFSIZE 1235520 /* This must be positive and divisible by 4 */ - -/* Ioctl () definitions */ -#define SDI_IOC_MAGIC '=' /* This ioctl magic number is currently free. See - * /usr/src/linux/Documentation/ioctl-number.txt */ - -#define SDI_IOC_TXGETCAP _IOR(SDI_IOC_MAGIC, 1, unsigned int) -#define SDI_IOC_TXGETEVENTS _IOR(SDI_IOC_MAGIC, 2, unsigned int) -#define SDI_IOC_TXGETBUFLEVEL _IOR(SDI_IOC_MAGIC, 3, unsigned int) -#define SDI_IOC_TXGETTXD _IOR(SDI_IOC_MAGIC, 4, int) - -#define SDI_IOC_RXGETCAP _IOR(SDI_IOC_MAGIC, 65, unsigned int) -#define SDI_IOC_RXGETEVENTS _IOR(SDI_IOC_MAGIC, 66, unsigned int) -#define SDI_IOC_RXGETBUFLEVEL _IOR(SDI_IOC_MAGIC, 67, unsigned int) -#define SDI_IOC_RXGETCARRIER _IOR(SDI_IOC_MAGIC, 68, int) -#define SDI_IOC_RXGETSTATUS _IOR(SDI_IOC_MAGIC, 69, int) - -#define SDI_IOC_GETID _IOR(SDI_IOC_MAGIC, 129, unsigned int) -#define SDI_IOC_GETVERSION _IOR(SDI_IOC_MAGIC, 130, unsigned int) -#define SDI_IOC_QBUF_DEPRECATED _IOR(SDI_IOC_MAGIC, 131, unsigned int) -#define SDI_IOC_QBUF _IOW(SDI_IOC_MAGIC, 131, unsigned int) -#define SDI_IOC_DQBUF_DEPRECATED _IOR(SDI_IOC_MAGIC, 132, unsigned int) -#define SDI_IOC_DQBUF _IOW(SDI_IOC_MAGIC, 132, unsigned int) - -/* Transmitter event flag bit locations */ -#define SDI_EVENT_TX_BUFFER_ORDER 0 -#define SDI_EVENT_TX_BUFFER (1 << SDI_EVENT_TX_BUFFER_ORDER) -#define SDI_EVENT_TX_FIFO_ORDER 1 -#define SDI_EVENT_TX_FIFO (1 << SDI_EVENT_TX_FIFO_ORDER) -#define SDI_EVENT_TX_DATA_ORDER 2 -#define SDI_EVENT_TX_DATA (1 << SDI_EVENT_TX_DATA_ORDER) - -/* Receiver event flag bit locations */ -#define SDI_EVENT_RX_BUFFER_ORDER 0 -#define SDI_EVENT_RX_BUFFER (1 << SDI_EVENT_RX_BUFFER_ORDER) -#define SDI_EVENT_RX_FIFO_ORDER 1 -#define SDI_EVENT_RX_FIFO (1 << SDI_EVENT_RX_FIFO_ORDER) -#define SDI_EVENT_RX_CARRIER_ORDER 2 -#define SDI_EVENT_RX_CARRIER (1 << SDI_EVENT_RX_CARRIER_ORDER) - -/* Interface capabilities */ -#define SDI_CAP_TX_RXCLKSRC 0x00000001 - -/* Transmitter clock source settings */ -#define SDI_CTL_TX_CLKSRC_ONBOARD 0 -#define SDI_CTL_TX_CLKSRC_EXT 1 -#define SDI_CTL_TX_CLKSRC_RX 2 - -/* Mode settings */ -#define SDI_CTL_MODE_8BIT 0 -#define SDI_CTL_MODE_10BIT 1 - -#endif - diff --git a/sys/linsys/include/sdiaudio.h b/sys/linsys/include/sdiaudio.h deleted file mode 100644 index 1df6f86eb..000000000 --- a/sys/linsys/include/sdiaudio.h +++ /dev/null @@ -1,149 +0,0 @@ -/* sdiaudio.h - * - * Shared header file for the Linux user-space API for - * Linear Systems Ltd. SMPTE 292M and SMPTE 259M-C Audio interface boards. - * - * Copyright (C) 2009 Linear Systems Ltd. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Linear Systems Ltd. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY LINEAR SYSTEMS LTD. "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL LINEAR SYSTEMS LTD. OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Linear Systems can be contacted at <http://www.linsys.ca/>. - * - */ - -#ifndef _SDIAUDIO_H -#define _SDIAUDIO_H - -/* Driver info */ -#define SDIAUDIO_DRIVER_NAME "sdiaudio" - -#define SDIAUDIO_MAJOR 0 /* Set to 0 for dynamic allocation. - * See /usr/src/linux/Documentation/devices.txt */ - -#define SDIAUDIO_TX_BUFFERS_MIN 2 /* This must be at least 2 */ -/* The minimum transmit buffer size must be positive, divisible by 4, - * and large enough that the buffers aren't transferred to the onboard FIFOs - * too quickly for the machine to handle the interrupts. - * This is especially a problem at startup, when the FIFOs are empty. - * Relevant factors include onboard FIFO size, PCI bus throughput, - * processor speed, and interrupt latency. */ -#define SDIAUDIO_TX_BUFSIZE_MIN 1024 -#define SDIAUDIO_RX_BUFFERS_MIN 2 /* This must be at least 2 */ -#define SDIAUDIO_RX_BUFSIZE_MIN 8 /* This must be positive and divisible by 4 */ - -#define SDIAUDIO_TX_BUFFERS 30 /* This must be at least 2 */ -#define SDIAUDIO_TX_BUFSIZE 6400 /* This must be positive and divisible by 4 */ -#define SDIAUDIO_RX_BUFFERS 30 /* This must be at least 2 */ -#define SDIAUDIO_RX_BUFSIZE 6400 /* This must be positive and divisible by 4 */ - -/* Ioctl () definitions */ -#define SDIAUDIO_IOC_MAGIC '~' /* This ioctl magic number is currently free. See - * /usr/src/linux/Documentation/ioctl-number.txt */ - -#define SDIAUDIO_IOC_TXGETCAP _IOR(SDIAUDIO_IOC_MAGIC, 1, unsigned int) -#define SDIAUDIO_IOC_TXGETEVENTS _IOR(SDIAUDIO_IOC_MAGIC, 2, unsigned int) -#define SDIAUDIO_IOC_TXGETBUFLEVEL _IOR(SDIAUDIO_IOC_MAGIC, 3, unsigned int) -#define SDIAUDIO_IOC_TXGETTXD _IOR(SDIAUDIO_IOC_MAGIC, 4, int) - -#define SDIAUDIO_IOC_RXGETCAP _IOR(SDIAUDIO_IOC_MAGIC, 65, unsigned int) -#define SDIAUDIO_IOC_RXGETEVENTS _IOR(SDIAUDIO_IOC_MAGIC, 66, unsigned int) -#define SDIAUDIO_IOC_RXGETBUFLEVEL _IOR(SDIAUDIO_IOC_MAGIC, 67, unsigned int) -#define SDIAUDIO_IOC_RXGETCARRIER _IOR(SDIAUDIO_IOC_MAGIC, 68, int) -#define SDIAUDIO_IOC_RXGETSTATUS _IOR(SDIAUDIO_IOC_MAGIC, 69, int) -#define SDIAUDIO_IOC_RXGETAUDIOGR0ERROR _IOR(SDIAUDIO_IOC_MAGIC, 70, unsigned int) -#define SDIAUDIO_IOC_RXGETAUDIOGR0DELAYA _IOR(SDIAUDIO_IOC_MAGIC, 71, unsigned int) -#define SDIAUDIO_IOC_RXGETAUDIOGR0DELAYB _IOR(SDIAUDIO_IOC_MAGIC, 72, unsigned int) -#define SDIAUDIO_IOC_RXGETNONAUDIO _IOR(SDIAUDIO_IOC_MAGIC, 73, unsigned int) -#define SDIAUDIO_IOC_RXGETAUDSTAT _IOR(SDIAUDIO_IOC_MAGIC, 74, unsigned int) -#define SDIAUDIO_IOC_RXGETAUDRATE _IOR(SDIAUDIO_IOC_MAGIC, 75, unsigned int) - -#define SDIAUDIO_IOC_GETID _IOR(SDIAUDIO_IOC_MAGIC, 129, unsigned int) -#define SDIAUDIO_IOC_GETVERSION _IOR(SDIAUDIO_IOC_MAGIC, 130, unsigned int) -#define SDIAUDIO_IOC_QBUF _IOW(SDIAUDIO_IOC_MAGIC, 131, unsigned int) -#define SDIAUDIO_IOC_DQBUF _IOW(SDIAUDIO_IOC_MAGIC, 132, unsigned int) - -/* Transmitter event flag bit locations */ -#define SDIAUDIO_EVENT_TX_BUFFER_ORDER 0 -#define SDIAUDIO_EVENT_TX_BUFFER (1 << SDIAUDIO_EVENT_TX_BUFFER_ORDER) -#define SDIAUDIO_EVENT_TX_FIFO_ORDER 1 -#define SDIAUDIO_EVENT_TX_FIFO (1 << SDIAUDIO_EVENT_TX_FIFO_ORDER) -#define SDIAUDIO_EVENT_TX_DATA_ORDER 2 -#define SDIAUDIO_EVENT_TX_DATA (1 << SDIAUDIO_EVENT_TX_DATA_ORDER) - -/* Receiver event flag bit locations */ -#define SDIAUDIO_EVENT_RX_BUFFER_ORDER 0 -#define SDIAUDIO_EVENT_RX_BUFFER (1 << SDIAUDIO_EVENT_RX_BUFFER_ORDER) -#define SDIAUDIO_EVENT_RX_FIFO_ORDER 1 -#define SDIAUDIO_EVENT_RX_FIFO (1 << SDIAUDIO_EVENT_RX_FIFO_ORDER) -#define SDIAUDIO_EVENT_RX_CARRIER_ORDER 2 -#define SDIAUDIO_EVENT_RX_CARRIER (1 << SDIAUDIO_EVENT_RX_CARRIER_ORDER) -#define SDIAUDIO_EVENT_RX_DATA_ORDER 3 -#define SDIAUDIO_EVENT_RX_DATA (1 << SDIAUDIO_EVENT_RX_DATA_ORDER) - -/* Interface capabilities */ -#define SDIAUDIO_CAP_RX_CD 0x00000001 -#define SDIAUDIO_CAP_RX_DATA 0x00000002 -#define SDIAUDIO_CAP_RX_STATS 0x00000004 -#define SDIAUDIO_CAP_RX_NONAUDIO 0x00000008 -#define SDIAUDIO_CAP_RX_24BIT 0x00000010 - -/* Audio sample size */ -#define SDIAUDIO_CTL_AUDSAMP_SZ_16 16 /* 16 bit */ -#define SDIAUDIO_CTL_AUDSAMP_SZ_24 24 /* 24 bit */ -#define SDIAUDIO_CTL_AUDSAMP_SZ_32 32 /* 32 bit */ - -/* Audio channel enable */ -#define SDIAUDIO_CTL_AUDCH_EN_0 0 /* 0 channel/disable audio */ -#define SDIAUDIO_CTL_AUDCH_EN_2 2 /* 2 channel */ -#define SDIAUDIO_CTL_AUDCH_EN_4 4 /* 4 channel */ -#define SDIAUDIO_CTL_AUDCH_EN_6 6 /* 6 channel */ -#define SDIAUDIO_CTL_AUDCH_EN_8 8 /* 8 channel */ - -#define SDIAUDIO_CTL_PCM_ALLCHANNEL 0x00000000 /* PCM for channel 1 - 8 */ -#define SDIAUDIO_CTL_NONAUDIO_ALLCHANNEL 0x000000ff /* No audio for channel 1 - 8 */ - -/* Active audio channels status */ -#define SDIAUDIO_CTL_ACT_CHAN_0 0x00 /* no audio control packets */ -#define SDIAUDIO_CTL_ACT_CHAN_2 0x03 /* 2 channels */ -#define SDIAUDIO_CTL_ACT_CHAN_4 0x0f /* 4 channels */ -#define SDIAUDIO_CTL_ACT_CHAN_6 0x3f /* 6 channels */ -#define SDIAUDIO_CTL_ACT_CHAN_8 0xff /* 8 channels */ - -/* Audio rate */ -#define SDIAUDIO_CTL_SYNC_48_KHZ 0 /* Synchronous, 48 kHz */ -#define SDIAUDIO_CTL_SYNC_44_1_KHZ 2 /* Synchronous, 44.1 kHz */ -#define SDIAUDIO_CTL_SYNC_32_KHZ 4 /* Synchronous, 32 kHz */ -#define SDIAUDIO_CTL_SYNC_96_KHZ 8 /* Synchronous, 96 kHz */ -#define SDIAUDIO_CTL_SYNC_FREE_RUNNING 14 /* Synchronous, free running */ -#define SDIAUDIO_CTL_ASYNC_48_KHZ 1 /* Asynchronous, 48 kHz */ -#define SDIAUDIO_CTL_ASYNC_44_1_KHZ 3 /* Asynchronous, 44.1 kHz */ -#define SDIAUDIO_CTL_ASYNC_32_KHZ 5 /* Asynchronous, 32 kHz */ -#define SDIAUDIO_CTL_ASYNC_96_KHZ 9 /* Asynchronous, 96 kHz */ -#define SDIAUDIO_CTL_ASYNC_FREE_RUNNING 15 /* Asynchronous, free running */ - -#endif - diff --git a/sys/linsys/include/sdivideo.h b/sys/linsys/include/sdivideo.h deleted file mode 100644 index e894f6b99..000000000 --- a/sys/linsys/include/sdivideo.h +++ /dev/null @@ -1,155 +0,0 @@ -/* sdivideo.h - * - * Shared header file for the Linux user-space API for - * Linear Systems Ltd. SMPTE 292M and SMPTE 259M-C interface boards. - * - * Copyright (C) 2009-2010 Linear Systems Ltd. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of Linear Systems Ltd. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY LINEAR SYSTEMS LTD. "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL LINEAR SYSTEMS LTD. OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Linear Systems can be contacted at <http://www.linsys.ca/>. - * - */ - -#ifndef _SDIVIDEO_H -#define _SDIVIDEO_H - -/* Driver info */ -#define SDIVIDEO_DRIVER_NAME "sdivideo" - -#define SDIVIDEO_MAJOR 0 /* Set to 0 for dynamic allocation. - * See /usr/src/linux/Documentation/devices.txt */ - -#define SDIVIDEO_TX_BUFFERS_MIN 2 /* This must be at least 2 */ -/* The minimum transmit buffer size must be positive, divisible by 4, - * and large enough that the buffers aren't transferred to the onboard FIFOs - * too quickly for the machine to handle the interrupts. - * This is especially a problem at startup, when the FIFOs are empty. - * Relevant factors include onboard FIFO size, PCI bus throughput, - * processor speed, and interrupt latency. */ -#define SDIVIDEO_TX_BUFSIZE_MIN 1024 -#define SDIVIDEO_RX_BUFFERS_MIN 2 /* This must be at least 2 */ -#define SDIVIDEO_RX_BUFSIZE_MIN 8 /* This must be positive and divisible by 4 */ - -#define SDIVIDEO_TX_BUFFERS 30 /* This must be at least 2 */ -#define SDIVIDEO_TX_BUFSIZE 1843200 /* This must be positive and divisible by 4 */ -#define SDIVIDEO_RX_BUFFERS 30 /* This must be at least 2 */ -#define SDIVIDEO_RX_BUFSIZE 1843200 /* This must be positive and divisible by 4 */ - -/* Ioctl () definitions */ -#define SDIVIDEO_IOC_MAGIC '=' /* This ioctl magic number is currently free. See - * /usr/src/linux/Documentation/ioctl-number.txt */ - -#define SDIVIDEO_IOC_TXGETCAP _IOR(SDIVIDEO_IOC_MAGIC, 1, unsigned int) -#define SDIVIDEO_IOC_TXGETEVENTS _IOR(SDIVIDEO_IOC_MAGIC, 2, unsigned int) -#define SDIVIDEO_IOC_TXGETBUFLEVEL _IOR(SDIVIDEO_IOC_MAGIC, 3, unsigned int) -#define SDIVIDEO_IOC_TXGETTXD _IOR(SDIVIDEO_IOC_MAGIC, 4, int) - -#define SDIVIDEO_IOC_RXGETCAP _IOR(SDIVIDEO_IOC_MAGIC, 65, unsigned int) -#define SDIVIDEO_IOC_RXGETEVENTS _IOR(SDIVIDEO_IOC_MAGIC, 66, unsigned int) -#define SDIVIDEO_IOC_RXGETBUFLEVEL _IOR(SDIVIDEO_IOC_MAGIC, 67, unsigned int) -#define SDIVIDEO_IOC_RXGETCARRIER _IOR(SDIVIDEO_IOC_MAGIC, 68, int) -#define SDIVIDEO_IOC_RXGETSTATUS _IOR(SDIVIDEO_IOC_MAGIC, 69, int) -#define SDIVIDEO_IOC_RXGETYCRCERROR _IOR(SDIVIDEO_IOC_MAGIC, 70, unsigned int) -#define SDIVIDEO_IOC_RXGETCCRCERROR _IOR(SDIVIDEO_IOC_MAGIC, 71, unsigned int) -#define SDIVIDEO_IOC_RXGETVIDSTATUS _IOR(SDIVIDEO_IOC_MAGIC, 72, unsigned int) - -#define SDIVIDEO_IOC_GETID _IOR(SDIVIDEO_IOC_MAGIC, 129, unsigned int) -#define SDIVIDEO_IOC_GETVERSION _IOR(SDIVIDEO_IOC_MAGIC, 130, unsigned int) -#define SDIVIDEO_IOC_QBUF _IOW(SDIVIDEO_IOC_MAGIC, 131, unsigned int) -#define SDIVIDEO_IOC_DQBUF _IOW(SDIVIDEO_IOC_MAGIC, 132, unsigned int) - -/* Transmitter event flag bit locations */ -#define SDIVIDEO_EVENT_TX_BUFFER_ORDER 0 -#define SDIVIDEO_EVENT_TX_BUFFER (1 << SDIVIDEO_EVENT_TX_BUFFER_ORDER) -#define SDIVIDEO_EVENT_TX_FIFO_ORDER 1 -#define SDIVIDEO_EVENT_TX_FIFO (1 << SDIVIDEO_EVENT_TX_FIFO_ORDER) -#define SDIVIDEO_EVENT_TX_DATA_ORDER 2 -#define SDIVIDEO_EVENT_TX_DATA (1 << SDIVIDEO_EVENT_TX_DATA_ORDER) - -/* Receiver event flag bit locations */ -#define SDIVIDEO_EVENT_RX_BUFFER_ORDER 0 -#define SDIVIDEO_EVENT_RX_BUFFER (1 << SDIVIDEO_EVENT_RX_BUFFER_ORDER) -#define SDIVIDEO_EVENT_RX_FIFO_ORDER 1 -#define SDIVIDEO_EVENT_RX_FIFO (1 << SDIVIDEO_EVENT_RX_FIFO_ORDER) -#define SDIVIDEO_EVENT_RX_CARRIER_ORDER 2 -#define SDIVIDEO_EVENT_RX_CARRIER (1 << SDIVIDEO_EVENT_RX_CARRIER_ORDER) -#define SDIVIDEO_EVENT_RX_DATA_ORDER 3 -#define SDIVIDEO_EVENT_RX_DATA (1 << SDIVIDEO_EVENT_RX_DATA_ORDER) - -/* Interface capabilities */ -#define SDIVIDEO_CAP_RX_CD 0x00000001 -#define SDIVIDEO_CAP_RX_DATA 0x00000002 -#define SDIVIDEO_CAP_RX_ERR_COUNT 0x00000004 -#define SDIVIDEO_CAP_RX_VBI 0x00000008 -#define SDIVIDEO_CAP_RX_RAWMODE 0x00000010 -#define SDIVIDEO_CAP_RX_DEINTERLACING 0x00000020 - -/* Transmitter clock source settings */ -#define SDIVIDEO_CTL_TX_CLKSRC_ONBOARD 0 -#define SDIVIDEO_CTL_TX_CLKSRC_NTSC 1 -#define SDIVIDEO_CTL_TX_CLKSRC_PAL 2 - -/* Mode settings */ -#define SDIVIDEO_CTL_MODE_UYVY 0 -#define SDIVIDEO_CTL_MODE_V210 1 -#define SDIVIDEO_CTL_MODE_V210_DEINTERLACE 2 -#define SDIVIDEO_CTL_MODE_RAW 3 - -/* Frame mode settings */ -#define SDIVIDEO_CTL_UNLOCKED 0 -#define SDIVIDEO_CTL_SMPTE_125M_486I_29_97HZ 1 -#define SDIVIDEO_CTL_BT_601_576I_25HZ 2 -#define SDIVIDEO_CTL_SMPTE_267M_486I_29_97HZ 3 - -#define SDIVIDEO_CTL_SMPTE_260M_1035I_30HZ 5 -#define SDIVIDEO_CTL_SMPTE_260M_1035I_29_97HZ 6 -#define SDIVIDEO_CTL_SMPTE_295M_1080I_25HZ 7 -#define SDIVIDEO_CTL_SMPTE_274M_1080I_30HZ 8 -#define SDIVIDEO_CTL_SMPTE_274M_1080PSF_30HZ 9 -#define SDIVIDEO_CTL_SMPTE_274M_1080I_29_97HZ 10 -#define SDIVIDEO_CTL_SMPTE_274M_1080PSF_29_97HZ 11 -#define SDIVIDEO_CTL_SMPTE_274M_1080I_25HZ 12 -#define SDIVIDEO_CTL_SMPTE_274M_1080PSF_25HZ 13 -#define SDIVIDEO_CTL_SMPTE_274M_1080PSF_24HZ 14 -#define SDIVIDEO_CTL_SMPTE_274M_1080PSF_23_98HZ 15 -#define SDIVIDEO_CTL_SMPTE_274M_1080P_30HZ 16 -#define SDIVIDEO_CTL_SMPTE_274M_1080P_29_97HZ 17 -#define SDIVIDEO_CTL_SMPTE_274M_1080P_25HZ 18 -#define SDIVIDEO_CTL_SMPTE_274M_1080P_24HZ 19 -#define SDIVIDEO_CTL_SMPTE_274M_1080P_23_98HZ 20 -#define SDIVIDEO_CTL_SMPTE_296M_720P_60HZ 21 -#define SDIVIDEO_CTL_SMPTE_296M_720P_59_94HZ 22 -#define SDIVIDEO_CTL_SMPTE_296M_720P_50HZ 23 -#define SDIVIDEO_CTL_SMPTE_296M_720P_30HZ 24 -#define SDIVIDEO_CTL_SMPTE_296M_720P_29_97HZ 25 -#define SDIVIDEO_CTL_SMPTE_296M_720P_25HZ 26 -#define SDIVIDEO_CTL_SMPTE_296M_720P_24HZ 27 -#define SDIVIDEO_CTL_SMPTE_296M_720P_23_98HZ 28 - -#endif - diff --git a/sys/meson.build b/sys/meson.build index d60ad358b..a61b4d174 100644 --- a/sys/meson.build +++ b/sys/meson.build @@ -3,9 +3,7 @@ #subdir('acmmp3dec') #subdir('androidmedia') #subdir('applemedia') -#subdir('avc') subdir('bluez') -#subdir('cdrom') subdir('d3dvideosink') #subdir('decklink') subdir('directsound') @@ -13,20 +11,15 @@ subdir('directsound') #subdir('dshowsrcwrapper') #subdir('dshowvideosink') subdir('dvb') -#subdir('dxr3') subdir('fbdev') subdir('kms') -#subdir('linsys') subdir('msdk') #subdir('nvenc') #subdir('opensles') -#subdir('pvr2d') -#subdir('qcam') #subdir('shm') #subdir('uvch264') #subdir('vcd') #subdir('vdpau') subdir('wasapi') -#subdir('wininet') subdir('winks') subdir('winscreencap') diff --git a/sys/pvr2d/Makefile.am b/sys/pvr2d/Makefile.am deleted file mode 100644 index 8ed89866f..000000000 --- a/sys/pvr2d/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -plugin_LTLIBRARIES = libgstpvr.la - -libgstpvr_la_SOURCES = \ - gstpvr.c \ - gstpvrbufferpool.c \ - gstpvrvideosink.c - -libgstpvr_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(PVR_CFLAGS) - -libgstpvr_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) \ - $(GST_PLUGINS_BASE_LIBS) $(X11_LIBS) -lgstvideo-$(GST_API_VERSION) \ - -lgstinterfaces-$(GST_API_VERSION) -lpvr2d -lpvrPVR2D_DRIWSEGL\ - $(PVR_LIBS) \ - $(LIBM) - -libgstpvr_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstpvr_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) - -noinst_HEADERS = \ - gstpvr.h \ - gstpvrbufferpool.h \ - gstpvrvideosink.h diff --git a/sys/pvr2d/gstpvr.c b/sys/pvr2d/gstpvr.c deleted file mode 100644 index 1f86abc89..000000000 --- a/sys/pvr2d/gstpvr.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * GStreamer - * Copyright (c) 2010, Texas Instruments Incorporated - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation - * version 2.1 of the License. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "gstpvr.h" -#include "gstpvrvideosink.h" - -GST_DEBUG_CATEGORY (gst_debug_pvrvideosink); - -static gboolean -plugin_init (GstPlugin * plugin) -{ - GST_DEBUG_CATEGORY_INIT (gst_debug_pvrvideosink, "pvrvideosink", 0, - "pvrvideosink"); - - return gst_element_register (plugin, "pvrvideosink", GST_RANK_PRIMARY, - GST_TYPE_PVRVIDEOSINK); -} - -void * -gst_ducati_alloc_1d (gint sz) -{ - MemAllocBlock block = { - .pixelFormat = PIXEL_FMT_PAGE, - .dim.len = sz, - }; - return MemMgr_Alloc (&block, 1); -} - -void * -gst_ducati_alloc_2d (gint width, gint height, guint * sz) -{ - MemAllocBlock block[] = { { - .pixelFormat = PIXEL_FMT_8BIT, - .dim = {.area = { - .width = width, - .height = ALIGN2 (height, 1), - }}, - .stride = 4096}, { - .pixelFormat = PIXEL_FMT_16BIT, - .dim = {.area = { - .width = width, - .height = ALIGN2 (height, 1) / 2, - }}, - .stride = 4096} - }; - if (sz) { - *sz = (4096 * ALIGN2 (height, 1) * 3) / 2; - } - return MemMgr_Alloc (block, 2); -} - -static struct -{ - PVR2DERROR code; - const gchar *errstring; -} pvr2derrorcodestring[] = { - { - PVR2D_OK, "OK (0)"}, { - PVR2DERROR_INVALID_PARAMETER, "Invalid Parameter (-1)"}, { - PVR2DERROR_DEVICE_UNAVAILABLE, "Device Unavailable (-2)"}, { - PVR2DERROR_INVALID_CONTEXT, "Invalid Context (-3)"}, { - PVR2DERROR_MEMORY_UNAVAILABLE, "Memory Unavailable (-4)"}, { - PVR2DERROR_DEVICE_NOT_PRESENT, "Device not present (-5)"}, { - PVR2DERROR_IOCTL_ERROR, "ioctl Error (-6)"}, { - PVR2DERROR_GENERIC_ERROR, "Generic Error (-7)"}, { - PVR2DERROR_BLT_NOTCOMPLETE, "blt not complete (-8)"}, { - PVR2DERROR_HW_FEATURE_NOT_SUPPORTED, "Hardware feature not supported (-9)"}, { - PVR2DERROR_NOT_YET_IMPLEMENTED, "Not yet implemented (-10)"}, { - PVR2DERROR_MAPPING_FAILED, "Mapping failed (-11)"} -}; - -const gchar * -gst_pvr2d_error_get_string (PVR2DERROR code) -{ - if (code <= PVR2D_OK && code >= PVR2DERROR_MAPPING_FAILED) - return pvr2derrorcodestring[PVR2D_OK - code].errstring; - return "Uknown Error"; -} - -/* PACKAGE: this is usually set by autotools depending on some _INIT macro - * in configure.ac and then written into and defined in config.h, but we can - * just set it ourselves here in case someone doesn't use autotools to - * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined. - */ -#ifndef PACKAGE -# define PACKAGE "ducati" -#endif - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - pvr, - "Pvr2d based plugin", - plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/") diff --git a/sys/pvr2d/gstpvr.h b/sys/pvr2d/gstpvr.h deleted file mode 100644 index bbde497ae..000000000 --- a/sys/pvr2d/gstpvr.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * GStreamer - * Copyright (c) 2010, Texas Instruments Incorporated - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation - * version 2.1 of the License. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __GST_DUCATI_H__ -#define __GST_DUCATI_H__ - -#include <stdint.h> -#include <string.h> - -#include <tiler.h> -#include <tilermem.h> -#include <memmgr.h> -#include "pvr2d.h" - - -#include <gst/gst.h> - -G_BEGIN_DECLS - -/* align x to next highest multiple of 2^n */ -#define ALIGN2(x,n) (((x) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1)) - -void * gst_ducati_alloc_1d (gint sz); -void * gst_ducati_alloc_2d (gint width, gint height, guint * sz); - -const gchar * gst_pvr2d_error_get_string (PVR2DERROR code); - -G_END_DECLS - -#endif /* __GST_DUCATI_H__ */ diff --git a/sys/pvr2d/gstpvrbufferpool.c b/sys/pvr2d/gstpvrbufferpool.c deleted file mode 100644 index 620d581a1..000000000 --- a/sys/pvr2d/gstpvrbufferpool.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * GStreamer - * Copyright (c) 2010, Texas Instruments Incorporated - * Copyright (c) 2011, Collabora Ltd - * @author: Edward Hervey <edward@collabora.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation - * version 2.1 of the License. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "gstpvrbufferpool.h" - -/* Debugging category */ -#include <gst/gstinfo.h> - -/* Helper functions */ -#include <gst/video/video.h> -#include <gst/video/gstvideometa.h> -#include <gst/video/gstvideopool.h> - - -GST_DEBUG_CATEGORY_EXTERN (gst_debug_pvrvideosink); -#define GST_CAT_DEFAULT gst_debug_pvrvideosink - -static gboolean -gst_pvr_meta_init (GstPVRMeta * meta, gpointer params, GstBuffer * buffer) -{ - meta->src_mem = NULL; - meta->sink = NULL; - - return TRUE; -} - -static void -gst_pvr_meta_free (GstPVRMeta * meta, GstBuffer * buffer) -{ - GstPVRVideoSink *pvrsink = (GstPVRVideoSink *) meta->sink; - - GST_LOG ("Releasing PVRMeta for buffer %p (src_mem:%p)", - buffer, meta->src_mem); - - if (meta->src_mem) { - PVR2DERROR pvr_error; - - GST_OBJECT_LOCK (pvrsink); - if (pvrsink->dcontext == NULL || pvrsink->dcontext->pvr_context == NULL) { - GST_OBJECT_UNLOCK (pvrsink); - goto done; - } - pvr_error = PVR2DMemFree (pvrsink->dcontext->pvr_context, meta->src_mem); - GST_OBJECT_UNLOCK (pvrsink); - - if (pvr_error != PVR2D_OK) - GST_ERROR ("Failed to unwrap PVR memory buffer. Error : %s", - gst_pvr2d_error_get_string (pvr_error)); - } - -done: - gst_pvrvideosink_untrack_buffer (pvrsink, buffer); - gst_object_unref (pvrsink); -} - -const GstMetaInfo * -gst_pvr_meta_get_info (void) -{ - static const GstMetaInfo *pvr_meta_info = NULL; - - if (g_once_init_enter (&pvr_meta_info)) { - const GstMetaInfo *meta = gst_meta_register ("GstPVRMeta", "GstPVRMeta", - sizeof (GstPVRMeta), - (GstMetaInitFunction) gst_pvr_meta_init, - (GstMetaFreeFunction) gst_pvr_meta_free, - (GstMetaTransformFunction) NULL); - g_once_init_leave (&pvr_meta_info, meta); - } - return pvr_meta_info; - -} - -/* Wrap existing buffers */ -GstPVRMeta * -gst_buffer_add_pvr_meta (GstBuffer * buffer, GstElement * sink) -{ - guint8 *data; - gsize size; - GstPVRMeta *meta; - PVR2DERROR pvr_error; - GstPVRVideoSink *pvrsink = (GstPVRVideoSink *) sink; - - g_return_val_if_fail (gst_buffer_n_memory (buffer) > 0, NULL); - g_return_val_if_fail (pvrsink != NULL, NULL); - - GST_LOG_OBJECT (pvrsink, "Adding PVRMeta to buffer %p", buffer); - - /* Add the meta */ - meta = (GstPVRMeta *) gst_buffer_add_meta (buffer, GST_PVR_META_INFO, NULL); - meta->src_mem = NULL; - meta->sink = gst_object_ref (pvrsink); - gst_pvrvideosink_track_buffer (pvrsink, buffer); - - data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ); - - GST_LOG_OBJECT (pvrsink, "data:%p, size:%" G_GSIZE_FORMAT, data, size); - - GST_OBJECT_LOCK (pvrsink); - if (pvrsink->dcontext == NULL || pvrsink->dcontext->pvr_context == NULL) - goto no_pvr_context; - /* Map the memory and wrap it */ - pvr_error = - PVR2DMemWrap (pvrsink->dcontext->pvr_context, data, 0, size, NULL, - &(meta->src_mem)); - GST_OBJECT_UNLOCK (pvrsink); - - gst_buffer_unmap (buffer, data, size); - - if (pvr_error != PVR2D_OK) - goto wrap_error; - - return meta; - -wrap_error: - { - GST_WARNING_OBJECT (pvrsink, "Failed to Wrap buffer memory. Error : %s", - gst_pvr2d_error_get_string (pvr_error)); - gst_buffer_remove_meta (buffer, (GstMeta *) meta); - - return NULL; - } - -no_pvr_context: - { - GST_OBJECT_UNLOCK (pvrsink); - GST_WARNING_OBJECT (pvrsink, "No PVR2D context available"); - gst_buffer_remove_meta (buffer, (GstMeta *) meta); - return NULL; - } -} - -/* - * GstDucatiBufferPool - */ -static void gst_pvr_buffer_pool_finalize (GObject * object); - -#define gst_pvr_buffer_pool_parent_class parent_class -G_DEFINE_TYPE (GstPVRBufferPool, gst_pvr_buffer_pool, GST_TYPE_BUFFER_POOL); -static const gchar ** -pvr_buffer_pool_get_options (GstBufferPool * pool) -{ - static const gchar *options[] = { GST_BUFFER_POOL_OPTION_VIDEO_META, - GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT, NULL - }; - - return options; -} - -static gboolean -pvr_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) -{ - GstPVRBufferPool *pvrpool = GST_PVR_BUFFER_POOL_CAST (pool); - GstVideoInfo info; - guint size, align; - gboolean ret; - const GstCaps *caps; - - if (!gst_buffer_pool_config_get (config, &caps, &size, NULL, NULL, NULL, - &align)) - goto wrong_config; - - if (caps == NULL) - goto no_caps; - - /* now parse the caps from the config */ - if (!gst_video_info_from_caps (&info, caps)) - goto wrong_caps; - - GST_LOG_OBJECT (pool, "%dx%d, size:%u, align:%u caps %" GST_PTR_FORMAT, - info.width, info.height, size, align, caps); - - if (pvrpool->caps) - gst_caps_unref (pvrpool->caps); - pvrpool->caps = gst_caps_copy (caps); - pvrpool->info = info; - pvrpool->size = size; - gst_allocation_params_init (&pvrpool->params); - pvrpool->params.align = align; - pvrpool->padded_width = GST_VIDEO_INFO_WIDTH (&info); - pvrpool->padded_height = GST_VIDEO_INFO_HEIGHT (&info); - - /* enable metadata based on config of the pool */ - pvrpool->add_metavideo = - gst_buffer_pool_config_has_option (config, - GST_BUFFER_POOL_OPTION_VIDEO_META); - -#if 0 - /* parse extra alignment info */ - priv->need_alignment = gst_buffer_pool_config_has_option (config, - GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT); - - if (priv->need_alignment) { - gst_buffer_pool_config_get_video_alignment (config, &priv->align); - - GST_LOG_OBJECT (pool, "padding %u-%ux%u-%u", priv->align.padding_top, - priv->align.padding_left, priv->align.padding_left, - priv->align.padding_bottom); - - /* we need the video metadata too now */ - priv->add_metavideo = TRUE; - } - - /* add the padding */ - priv->padded_width = - GST_VIDEO_INFO_WIDTH (&info) + priv->align.padding_left + - priv->align.padding_right; - priv->padded_height = - GST_VIDEO_INFO_HEIGHT (&info) + priv->align.padding_top + - priv->align.padding_bottom; -#endif - - GST_DEBUG_OBJECT (pool, "before calling parent class"); - - ret = GST_BUFFER_POOL_CLASS (parent_class)->set_config (pool, config); - - GST_DEBUG_OBJECT (pool, "parent_class returned %d", ret); - - return ret; - - /* ERRORS */ -wrong_config: - { - GST_WARNING_OBJECT (pool, "invalid config"); - return FALSE; - } -no_caps: - { - GST_WARNING_OBJECT (pool, "no caps in config"); - return FALSE; - } -wrong_caps: - { - GST_WARNING_OBJECT (pool, - "failed getting geometry from caps %" GST_PTR_FORMAT, caps); - return FALSE; - } -} - -/* This function handles GstXImageBuffer creation depending on XShm availability */ -static GstFlowReturn -pvr_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer, - GstBufferPoolAcquireParams * params) -{ - GstPVRBufferPool *pvrpool = GST_PVR_BUFFER_POOL_CAST (pool); - GstVideoInfo *info; - GstBuffer *pvr; - GstPVRMeta *meta; - - info = &pvrpool->info; - - pvr = gst_buffer_new_allocate (NULL, pvrpool->size, &pvrpool->params); - meta = gst_buffer_add_pvr_meta (pvr, pvrpool->pvrsink); - if (meta == NULL) { - gst_buffer_unref (pvr); - goto no_buffer; - } - - if (pvrpool->add_metavideo) { - GstVideoMeta *meta; - - GST_DEBUG_OBJECT (pool, "adding GstVideoMeta"); - /* these are just the defaults for now */ - meta = gst_buffer_add_video_meta (pvr, GST_VIDEO_FRAME_FLAG_NONE, - GST_VIDEO_INFO_FORMAT (info), pvrpool->padded_width, - pvrpool->padded_height); - if (G_UNLIKELY (meta == NULL)) - GST_WARNING_OBJECT (pool, "Failed to add GstVideoMeta"); - -#if 0 - const GstVideoFormatInfo *vinfo = info->finfo; - gint i; - - if (pvrpool->need_alignment) { - meta->width = GST_VIDEO_INFO_WIDTH (&pvrpool->info); - meta->height = GST_VIDEO_INFO_HEIGHT (&pvrpool->info); - - /* FIXME, not quite correct, NV12 would apply the vedge twice on the second - * plane */ - for (i = 0; i < GST_VIDEO_INFO_N_COMPONENTS (info); i++) { - gint vedge, hedge, plane; - - hedge = - GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (vinfo, i, - pvrpool->align.padding_left); - vedge = - GST_VIDEO_FORMAT_INFO_SCALE_HEIGHT (vinfo, i, - pvrpool->align.padding_top); - plane = GST_VIDEO_FORMAT_INFO_PLANE (vinfo, i); - - GST_LOG_OBJECT (pool, "comp %d, plane %d: hedge %d, vedge %d", i, - plane, hedge, vedge); - - meta->offset[plane] += (vedge * meta->stride[plane]) + hedge; - } - } -#endif - } - - *buffer = pvr; - - return GST_FLOW_OK; - - /* ERROR */ -no_buffer: - { - GST_WARNING_OBJECT (pool, "can't create image"); - return GST_FLOW_ERROR; - } -} - -/** create new bufferpool - */ -GstBufferPool * -gst_pvr_buffer_pool_new (GstElement * pvrsink) -{ - GstPVRBufferPool *pool; - - g_return_val_if_fail (GST_IS_PVRVIDEOSINK (pvrsink), NULL); - - GST_DEBUG_OBJECT (pvrsink, "Creating new GstPVRBufferPool"); - - pool = g_object_new (GST_TYPE_PVR_BUFFER_POOL, NULL); - pool->pvrsink = gst_object_ref (pvrsink); - - return GST_BUFFER_POOL_CAST (pool); -} - -static void -gst_pvr_buffer_pool_class_init (GstPVRBufferPoolClass * klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass; - - gobject_class->finalize = gst_pvr_buffer_pool_finalize; - - gstbufferpool_class->get_options = pvr_buffer_pool_get_options; - gstbufferpool_class->set_config = pvr_buffer_pool_set_config; - gstbufferpool_class->alloc_buffer = pvr_buffer_pool_alloc; -} - -static void -gst_pvr_buffer_pool_init (GstPVRBufferPool * pool) -{ - -} - -static void -gst_pvr_buffer_pool_finalize (GObject * object) -{ - GstPVRBufferPool *pool = GST_PVR_BUFFER_POOL_CAST (object); - - GST_LOG_OBJECT (pool, "finalize PVR buffer pool %p", pool); - - if (pool->caps) - gst_caps_unref (pool->caps); - gst_object_unref (pool->pvrsink); - - G_OBJECT_CLASS (gst_pvr_buffer_pool_parent_class)->finalize (object); -} diff --git a/sys/pvr2d/gstpvrbufferpool.h b/sys/pvr2d/gstpvrbufferpool.h deleted file mode 100644 index b749b7cf8..000000000 --- a/sys/pvr2d/gstpvrbufferpool.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * GStreamer - * Copyright (c) 2010, 2011 Texas Instruments Incorporated - * Copyright (c) 2011, Collabora Ltda - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation - * version 2.1 of the License. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __GSTPVRBUFFERPOOL_H__ -#define __GSTPVRBUFFERPOOL_H__ - -#include "gstpvr.h" -#include <pvr2d.h> - -G_BEGIN_DECLS - -typedef struct _GstPVRMeta GstPVRMeta; - -typedef struct _GstPVRBufferPool GstPVRBufferPool; -typedef struct _GstPVRBufferPoolClass GstPVRBufferPoolClass; - -#include "gstpvrvideosink.h" - -const GstMetaInfo * gst_pvr_meta_get_info (void); -#define GST_PVR_META_INFO (gst_pvr_meta_get_info()) - -#define gst_buffer_get_pvr_meta(b) ((GstPVRMeta*)gst_buffer_get_meta((b),GST_PVR_META_INFO)) - -struct _GstPVRMeta -{ - GstMeta meta; - - PVR2DMEMINFO *src_mem; /* Memory wrapped by pvr */ - GstElement *sink; /* sink, holds a ref */ -}; - -GstPVRMeta * -gst_buffer_add_pvr_meta(GstBuffer *buffer, GstElement *pvrsink); - -#define GST_TYPE_PVR_BUFFER_POOL (gst_pvr_buffer_pool_get_type()) -#define GST_IS_PVR_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PVR_BUFFER_POOL)) -#define GST_PVR_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PVR_BUFFER_POOL, GstPVRBufferPool)) -#define GST_PVR_BUFFER_POOL_CAST(obj) ((GstPVRBufferPool*)(obj)) - -struct _GstPVRBufferPool -{ - GstBufferPool parent; - - /* output (padded) size including any codec padding: */ - gint padded_width, padded_height; - guint size; - GstAllocationParams params; - - GstElement *pvrsink; - - GstCaps *caps; - GstVideoInfo info; - gboolean add_metavideo; -}; - -struct _GstPVRBufferPoolClass -{ - GstBufferPoolClass parent_class; -}; - -GType gst_pvr_buffer_pool_get_type (void); -GstBufferPool *gst_pvr_buffer_pool_new (GstElement *pvrsink); - -G_END_DECLS - -#endif /* __GSTPVRBUFFERPOOL_H__ */ diff --git a/sys/pvr2d/gstpvrvideosink.c b/sys/pvr2d/gstpvrvideosink.c deleted file mode 100644 index 4e32a8c06..000000000 --- a/sys/pvr2d/gstpvrvideosink.c +++ /dev/null @@ -1,1479 +0,0 @@ -/* GStreamer - * - * Copyright (C) 2011 Collabora Ltda - * Copyright (C) 2011 Texas Instruments - * @author: Luciana Fujii Pontello <luciana.fujii@collabora.co.uk> - * @author: Edward Hervey <edward@collabora.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -/* Object header */ -#include "gstpvrvideosink.h" -#include "gstpvrbufferpool.h" - -#include <gst/video/gstvideosink.h> -#include <gst/video/videooverlay.h> -/* Helper functions */ -#include <gst/video/gstvideometa.h> - -/* Debugging category */ -#include <gst/gstinfo.h> - -#define LINUX -#include <dri2_ws.h> -#include <services.h> -#include <img_defs.h> -#include <servicesext.h> - -#define DEFAULT_QUEUE_SIZE 12 - -GST_DEBUG_CATEGORY_EXTERN (gst_debug_pvrvideosink); -#define GST_CAT_DEFAULT gst_debug_pvrvideosink - -#define PVR2DMEMINFO_INITIALISE(d, s) \ -{ \ - (d)->hPrivateData = (IMG_VOID *)(s); \ - (d)->hPrivateMapData = (IMG_VOID *)(s->hKernelMemInfo); \ - (d)->ui32DevAddr = (IMG_UINT32) (s)->sDevVAddr.uiAddr; \ - (d)->ui32MemSize = (s)->uAllocSize; \ - (d)->pBase = (s)->pvLinAddr;\ - (d)->ulFlags = (s)->ui32Flags;\ -} - -/* end of internal definitions */ - -static void gst_pvrvideosink_reset (GstPVRVideoSink * pvrvideosink); -static void gst_pvrvideosink_xwindow_draw_borders (GstPVRVideoSink * - pvrvideosink, GstXWindow * xwindow, GstVideoRectangle rect); -static void gst_pvrvideosink_expose (GstVideoOverlay * overlay); -static void gst_pvrvideosink_xwindow_destroy (GstPVRVideoSink * pvrvideosink, - GstXWindow * xwindow); -static void gst_pvrvideosink_dcontext_free (GstDrawContext * dcontext); - -static void gst_pvrvideosink_videooverlay_init (GstVideoOverlayInterface * - iface); - -#define gst_pvrvideosink_parent_class parent_class -G_DEFINE_TYPE_WITH_CODE (GstPVRVideoSink, gst_pvrvideosink, GST_TYPE_VIDEO_SINK, - G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_OVERLAY, - gst_pvrvideosink_videooverlay_init)); - - -static GstStaticPadTemplate gst_pvrvideosink_sink_template_factory = -GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("NV12"))); - -enum -{ - PROP_0, - PROP_FORCE_ASPECT_RATIO, - PROP_WINDOW_WIDTH, - PROP_WINDOW_HEIGHT -}; - -/* ============================================================= */ -/* */ -/* Private Methods */ -/* */ -/* ============================================================= */ - -/* pvrvideo buffers */ - -static void -gst_pvrvideosink_xwindow_update_geometry (GstPVRVideoSink * pvrvideosink) -{ - XWindowAttributes attr; - WSEGLError glerror; - WSEGLDrawableParams source_params; - PVRSRV_CLIENT_MEM_INFO *client_mem_info; - - /* Update the window geometry */ - g_mutex_lock (pvrvideosink->dcontext->x_lock); - if (G_UNLIKELY (pvrvideosink->xwindow == NULL)) { - g_mutex_unlock (pvrvideosink->dcontext->x_lock); - return; - } - pvrvideosink->redraw_borders = TRUE; - - XGetWindowAttributes (pvrvideosink->dcontext->x_display, - pvrvideosink->xwindow->window, &attr); - - pvrvideosink->xwindow->width = attr.width; - pvrvideosink->xwindow->height = attr.height; - - if (!pvrvideosink->have_render_rect) { - pvrvideosink->render_rect.x = pvrvideosink->render_rect.y = 0; - pvrvideosink->render_rect.w = attr.width; - pvrvideosink->render_rect.h = attr.height; - } - if (pvrvideosink->dcontext != NULL) { - glerror = - pvrvideosink->dcontext->wsegl_table-> - pfnWSEGL_DeleteDrawable (pvrvideosink->dcontext->drawable_handle); - if (glerror != WSEGL_SUCCESS) { - GST_ERROR_OBJECT (pvrvideosink, "Error destroying drawable"); - return; - } - glerror = - pvrvideosink->dcontext->wsegl_table-> - pfnWSEGL_CreateWindowDrawable (pvrvideosink->dcontext->display_handle, - pvrvideosink->dcontext->glconfig, - &pvrvideosink->dcontext->drawable_handle, - (NativeWindowType) pvrvideosink->xwindow->window, - &pvrvideosink->dcontext->rotation); - if (glerror != WSEGL_SUCCESS) { - GST_ERROR_OBJECT (pvrvideosink, "Error creating drawable"); - return; - } - glerror = - pvrvideosink->dcontext->wsegl_table-> - pfnWSEGL_GetDrawableParameters (pvrvideosink->dcontext->drawable_handle, - &source_params, &pvrvideosink->render_params); - if (glerror != WSEGL_SUCCESS) { - GST_ERROR_OBJECT (pvrvideosink, "Error getting Drawable params"); - return; - } - - client_mem_info = - (PVRSRV_CLIENT_MEM_INFO *) pvrvideosink->render_params.hPrivateData; - PVR2DMEMINFO_INITIALISE (&pvrvideosink->dcontext->dst_mem, client_mem_info); - } - - g_mutex_unlock (pvrvideosink->dcontext->x_lock); -} - -/* This function handles XEvents that might be in the queue. It generates - GstEvent that will be sent upstream in the pipeline to handle interactivity - and navigation. It will also listen for configure events on the window to - trigger caps renegotiation so on the fly software scaling can work. */ -static void -gst_pvrvideosink_handle_xevents (GstPVRVideoSink * pvrvideosink) -{ - XEvent e; - gboolean exposed = FALSE; - gboolean configured = FALSE; - - g_mutex_lock (pvrvideosink->flow_lock); - g_mutex_lock (pvrvideosink->dcontext->x_lock); - - /* Handle Expose */ - while (XCheckWindowEvent (pvrvideosink->dcontext->x_display, - pvrvideosink->xwindow->window, ExposureMask | StructureNotifyMask, - &e)) { - switch (e.type) { - case Expose: - exposed = TRUE; - break; - case ConfigureNotify: - g_mutex_unlock (pvrvideosink->dcontext->x_lock); - gst_pvrvideosink_xwindow_update_geometry (pvrvideosink); - g_mutex_lock (pvrvideosink->dcontext->x_lock); - configured = TRUE; - break; - default: - break; - } - } - - if (exposed || configured) { - g_mutex_unlock (pvrvideosink->dcontext->x_lock); - g_mutex_unlock (pvrvideosink->flow_lock); - - gst_pvrvideosink_expose (GST_VIDEO_OVERLAY (pvrvideosink)); - - g_mutex_lock (pvrvideosink->flow_lock); - g_mutex_lock (pvrvideosink->dcontext->x_lock); - } - - /* Handle Display events */ - while (XPending (pvrvideosink->dcontext->x_display)) { - XNextEvent (pvrvideosink->dcontext->x_display, &e); - - switch (e.type) { - case ClientMessage:{ - Atom wm_delete; - - wm_delete = XInternAtom (pvrvideosink->dcontext->x_display, - "WM_DELETE_WINDOW", True); - if (wm_delete != None && wm_delete == (Atom) e.xclient.data.l[0]) { - /* Handle window deletion by posting an error on the bus */ - GST_ELEMENT_ERROR (pvrvideosink, RESOURCE, NOT_FOUND, - ("Output window was closed"), (NULL)); - - g_mutex_unlock (pvrvideosink->dcontext->x_lock); - gst_pvrvideosink_xwindow_destroy (pvrvideosink, - pvrvideosink->xwindow); - pvrvideosink->xwindow = NULL; - g_mutex_lock (pvrvideosink->dcontext->x_lock); - } - break; - } - default: - break; - } - } - - g_mutex_unlock (pvrvideosink->dcontext->x_lock); - g_mutex_unlock (pvrvideosink->flow_lock); -} - -static gpointer -gst_pvrvideosink_event_thread (GstPVRVideoSink * pvrvideosink) -{ - GST_OBJECT_LOCK (pvrvideosink); - while (pvrvideosink->running) { - GST_OBJECT_UNLOCK (pvrvideosink); - - if (pvrvideosink->xwindow) { - gst_pvrvideosink_handle_xevents (pvrvideosink); - } - g_usleep (G_USEC_PER_SEC / 20); - - GST_OBJECT_LOCK (pvrvideosink); - } - GST_OBJECT_UNLOCK (pvrvideosink); - - return NULL; -} - -static void -gst_pvrvideosink_manage_event_thread (GstPVRVideoSink * pvrvideosink) -{ - GThread *thread = NULL; - - /* don't start the thread too early */ - if (pvrvideosink->dcontext == NULL) { - return; - } - - GST_OBJECT_LOCK (pvrvideosink); - if (!pvrvideosink->event_thread) { - /* Setup our event listening thread */ - GST_DEBUG_OBJECT (pvrvideosink, "run xevent thread"); - pvrvideosink->running = TRUE; - pvrvideosink->event_thread = g_thread_create ( - (GThreadFunc) gst_pvrvideosink_event_thread, pvrvideosink, TRUE, NULL); - } - GST_OBJECT_UNLOCK (pvrvideosink); - - /* Wait for our event thread to finish */ - if (thread) - g_thread_join (thread); -} - - -static GstDrawContext * -gst_pvrvideosink_get_dcontext (GstPVRVideoSink * pvrvideosink) -{ - GstDrawContext *dcontext = NULL; - PVR2DERROR pvr_error; - gint refresh_rate; - DRI2WSDisplay *displayImpl; - WSEGLError glerror; - const WSEGLCaps *glcaps; - - GST_DEBUG_OBJECT (pvrvideosink, "Getting draw context"); - - dcontext = g_new0 (GstDrawContext, 1); - dcontext->x_lock = g_mutex_new (); - - dcontext->p_blt_info = g_new0 (PVR2D_3DBLT_EXT, 1); - if (!dcontext->p_blt_info) - goto p_blt_info_alloc_failed; - - dcontext->p_blt2d_info = g_new0 (PVR2DBLTINFO, 1); - - GST_LOG_OBJECT (pvrvideosink, "Opening X Display"); - dcontext->x_display = XOpenDisplay (NULL); - - if (dcontext->x_display == NULL) - goto fail_open_display; - - GST_LOG_OBJECT (pvrvideosink, "WSEGL_GetFunctionTablePointer()"); - dcontext->wsegl_table = WSEGL_GetFunctionTablePointer (); - - GST_LOG_OBJECT (pvrvideosink, "pfnWSEGL_IsDisplayValid()"); - glerror = dcontext->wsegl_table->pfnWSEGL_IsDisplayValid ( - (NativeDisplayType) dcontext->x_display); - - if (glerror != WSEGL_SUCCESS) - goto display_invalid; - - GST_LOG_OBJECT (pvrvideosink, "pfnWSEGL_InitialiseDisplay()"); - - glerror = dcontext->wsegl_table->pfnWSEGL_InitialiseDisplay ( - (NativeDisplayType) dcontext->x_display, &dcontext->display_handle, - &glcaps, &dcontext->glconfig); - if (glerror != WSEGL_SUCCESS) - goto display_init_failed; - - displayImpl = (DRI2WSDisplay *) dcontext->display_handle; - dcontext->pvr_context = displayImpl->hContext; - - GST_LOG_OBJECT (pvrvideosink, "PVR2DGetScreenMode()"); - - pvr_error = PVR2DGetScreenMode (dcontext->pvr_context, - &dcontext->display_format, &dcontext->display_width, - &dcontext->display_height, &dcontext->stride, &refresh_rate); - if (pvr_error != PVR2D_OK) - goto screen_mode_failed; - - GST_DEBUG_OBJECT (pvrvideosink, - "Got format:%d, width:%d, height:%d, stride:%d, refresh_rate:%d", - dcontext->display_format, dcontext->display_width, - dcontext->display_height, dcontext->stride, refresh_rate); - - dcontext->screen_num = DefaultScreen (dcontext->x_display); - dcontext->black = XBlackPixel (dcontext->x_display, dcontext->screen_num); - - GST_DEBUG_OBJECT (pvrvideosink, "Returning dcontext %p", dcontext); - - return dcontext; - -p_blt_info_alloc_failed: - { - GST_ERROR_OBJECT (pvrvideosink, "Alloc of bltinfo failed"); - gst_pvrvideosink_dcontext_free (dcontext); - return NULL; - } - -fail_open_display: - { - GST_ERROR_OBJECT (pvrvideosink, "Failed to open X Display"); - gst_pvrvideosink_dcontext_free (dcontext); - return NULL; - } - -display_invalid: - { - GST_ERROR_OBJECT (pvrvideosink, "Display is not valid (glerror:%d)", - glerror); - gst_pvrvideosink_dcontext_free (dcontext); - return NULL; - } - -display_init_failed: - { - GST_ERROR_OBJECT (pvrvideosink, "Error initializing display (glerror:%d)", - glerror); - gst_pvrvideosink_dcontext_free (dcontext); - return NULL; - } - -screen_mode_failed: - { - GST_ERROR_OBJECT (pvrvideosink, "Failed to get screen mode. error : %s", - gst_pvr2d_error_get_string (pvr_error)); - gst_pvrvideosink_dcontext_free (dcontext); - return NULL; - } -} - -static void -gst_pvrvideosink_xwindow_set_title (GstPVRVideoSink * pvrvideosink, - GstXWindow * xwindow, const gchar * media_title) -{ - if (media_title) { - g_free (pvrvideosink->media_title); - pvrvideosink->media_title = g_strdup (media_title); - } - if (xwindow) { - /* we have a window */ - if (xwindow->internal) { - XTextProperty xproperty; - const gchar *app_name; - const gchar *title = NULL; - gchar *title_mem = NULL; - - /* set application name as a title */ - app_name = g_get_application_name (); - - if (app_name && pvrvideosink->media_title) { - title = title_mem = g_strconcat (pvrvideosink->media_title, " : ", - app_name, NULL); - } else if (app_name) { - title = app_name; - } else if (pvrvideosink->media_title) { - title = pvrvideosink->media_title; - } - - if (title) { - if ((XStringListToTextProperty (((char **) &title), 1, - &xproperty)) != 0) { - XSetWMName (pvrvideosink->dcontext->x_display, xwindow->window, - &xproperty); - XFree (xproperty.value); - } - - g_free (title_mem); - } - } - } -} - -static GstXWindow * -gst_pvrvideosink_create_window (GstPVRVideoSink * pvrvideosink, gint width, - gint height) -{ - WSEGLError glerror; - WSEGLDrawableParams source_params; - Window root; - GstXWindow *xwindow; - GstDrawContext *dcontext; - XGCValues values; - Atom wm_delete; - PVRSRV_CLIENT_MEM_INFO *client_mem_info; - - GST_DEBUG_OBJECT (pvrvideosink, "begin"); - - dcontext = pvrvideosink->dcontext; - xwindow = g_new0 (GstXWindow, 1); - - xwindow->internal = TRUE; - pvrvideosink->render_rect.x = pvrvideosink->render_rect.y = 0; - pvrvideosink->render_rect.w = width; - pvrvideosink->render_rect.h = height; - xwindow->width = width; - xwindow->height = height; - xwindow->internal = TRUE; - - g_mutex_lock (pvrvideosink->dcontext->x_lock); - - root = DefaultRootWindow (dcontext->x_display); - xwindow->window = XCreateSimpleWindow (dcontext->x_display, root, 0, 0, - width, height, 2, 2, pvrvideosink->dcontext->black); - XSelectInput (dcontext->x_display, xwindow->window, - ExposureMask | StructureNotifyMask); - - /* Tell the window manager we'd like delete client messages instead of - * being killed */ - wm_delete = XInternAtom (pvrvideosink->dcontext->x_display, - "WM_DELETE_WINDOW", True); - if (wm_delete != None) { - (void) XSetWMProtocols (pvrvideosink->dcontext->x_display, xwindow->window, - &wm_delete, 1); - } - - XMapWindow (dcontext->x_display, xwindow->window); - - /* We have to do that to prevent X from redrawing the background on - * ConfigureNotify. This takes away flickering of video when resizing. */ - XSetWindowBackgroundPixmap (pvrvideosink->dcontext->x_display, - xwindow->window, None); - - gst_pvrvideosink_xwindow_set_title (pvrvideosink, xwindow, NULL); - - xwindow->gc = XCreateGC (pvrvideosink->dcontext->x_display, - xwindow->window, 0, &values); - - g_mutex_unlock (pvrvideosink->dcontext->x_lock); - - glerror = - dcontext->wsegl_table-> - pfnWSEGL_CreateWindowDrawable (dcontext->display_handle, - dcontext->glconfig, &(dcontext->drawable_handle), - (NativeWindowType) xwindow->window, &(dcontext->rotation)); - - if (glerror != WSEGL_SUCCESS) { - GST_ERROR_OBJECT (pvrvideosink, "Error creating drawable"); - return NULL; - } - glerror = - dcontext->wsegl_table-> - pfnWSEGL_GetDrawableParameters (dcontext->drawable_handle, &source_params, - &pvrvideosink->render_params); - client_mem_info = - (PVRSRV_CLIENT_MEM_INFO *) pvrvideosink->render_params.hPrivateData; - PVR2DMEMINFO_INITIALISE (&dcontext->dst_mem, client_mem_info); - - GST_DEBUG_OBJECT (pvrvideosink, "end"); - return xwindow; -} - -static void -gst_pvrvideosink_blit (GstPVRVideoSink * pvrvideosink, GstBuffer * buffer) -{ - PVR2DERROR pvr_error; - GstDrawContext *dcontext = pvrvideosink->dcontext; - gint video_width; - gint video_height; - gboolean draw_border = FALSE; - PPVR2D_3DBLT_EXT p_blt_3d; - PVR2DMEMINFO *src_mem; - PVR2DFORMAT pvr_format; - GstVideoRectangle result; - GstPVRMeta *meta; - GstVideoCropMeta *cropmeta; - - GST_DEBUG_OBJECT (pvrvideosink, "buffer %p", buffer); - - pvr_format = - GST_VIDEO_INFO_FORMAT (&pvrvideosink->info) == - GST_VIDEO_FORMAT_NV12 ? PVR2D_YUV420_2PLANE : PVR2D_ARGB8888; - - g_mutex_lock (pvrvideosink->flow_lock); - if (buffer == NULL) - buffer = pvrvideosink->current_buffer; - - if (buffer == NULL) - goto done; - - meta = gst_buffer_get_pvr_meta (buffer); - if (G_UNLIKELY (meta == NULL)) - goto no_pvr_meta; - - src_mem = meta->src_mem; - p_blt_3d = dcontext->p_blt_info; - - video_width = GST_VIDEO_SINK_WIDTH (pvrvideosink); - video_height = GST_VIDEO_SINK_HEIGHT (pvrvideosink); - - g_mutex_lock (pvrvideosink->dcontext->x_lock); - - /* Draw borders when displaying the first frame. After this - draw borders only on expose event or after a size change. */ - if (!(pvrvideosink->current_buffer) || pvrvideosink->redraw_borders) { - draw_border = TRUE; - } - - /* Store a reference to the last image we put, lose the previous one */ - if (buffer && pvrvideosink->current_buffer != buffer) { - if (pvrvideosink->current_buffer) { - GST_LOG_OBJECT (pvrvideosink, "unreffing %p", - pvrvideosink->current_buffer); - gst_buffer_unref (GST_BUFFER_CAST (pvrvideosink->current_buffer)); - } - GST_LOG_OBJECT (pvrvideosink, "reffing %p as our current buffer", buffer); - pvrvideosink->current_buffer = gst_buffer_ref (buffer); - } - - if (pvrvideosink->keep_aspect) { - GstVideoRectangle src = { 0, }; - GstVideoRectangle dst = { 0, }; - - src.w = GST_VIDEO_SINK_WIDTH (pvrvideosink); - src.h = GST_VIDEO_SINK_HEIGHT (pvrvideosink); - dst.w = pvrvideosink->render_rect.w; - dst.h = pvrvideosink->render_rect.h; - gst_video_sink_center_rect (src, dst, &result, TRUE); - result.x += pvrvideosink->render_rect.x; - result.y += pvrvideosink->render_rect.y; - } else { - memcpy (&result, &pvrvideosink->render_rect, sizeof (GstVideoRectangle)); - } - - p_blt_3d->sDst.pSurfMemInfo = &dcontext->dst_mem; - p_blt_3d->sDst.SurfOffset = 0; - p_blt_3d->sDst.Stride = 4 * pvrvideosink->render_params.ui32Stride; - p_blt_3d->sDst.Format = PVR2D_ARGB8888; - p_blt_3d->sDst.SurfWidth = pvrvideosink->xwindow->width; - p_blt_3d->sDst.SurfHeight = pvrvideosink->xwindow->height; - - p_blt_3d->rcDest.left = result.x; - p_blt_3d->rcDest.top = result.y; - p_blt_3d->rcDest.right = result.w + result.x; - p_blt_3d->rcDest.bottom = result.h + result.y; - - p_blt_3d->sSrc.pSurfMemInfo = src_mem; - p_blt_3d->sSrc.SurfOffset = 0; - p_blt_3d->sSrc.Stride = GST_VIDEO_INFO_COMP_STRIDE (&pvrvideosink->info, 0); - p_blt_3d->sSrc.Format = pvr_format; - p_blt_3d->sSrc.SurfWidth = video_width; - p_blt_3d->sSrc.SurfHeight = video_height; - - /* If buffer has crop information, use that */ - if ((cropmeta = gst_buffer_get_video_crop_meta (buffer))) { - p_blt_3d->rcSource.left = cropmeta->x; - p_blt_3d->rcSource.top = cropmeta->y; - p_blt_3d->rcSource.right = cropmeta->x + cropmeta->width; - p_blt_3d->rcSource.bottom = cropmeta->y + cropmeta->height; - } else { - p_blt_3d->rcSource.left = 0; - p_blt_3d->rcSource.top = 0; - p_blt_3d->rcSource.right = video_width; - p_blt_3d->rcSource.bottom = video_height; - } - - p_blt_3d->hUseCode = NULL; - - if (GST_VIDEO_INFO_FORMAT (&pvrvideosink->info) == GST_VIDEO_FORMAT_NV12) - p_blt_3d->bDisableDestInput = TRUE; - else - /* blit fails for RGB without this... not sure why yet... */ - p_blt_3d->bDisableDestInput = FALSE; - - GST_DEBUG_OBJECT (pvrvideosink, "about to blit"); - - pvr_error = PVR2DBlt3DExt (pvrvideosink->dcontext->pvr_context, - dcontext->p_blt_info); - - if (pvr_error != PVR2D_OK) { - GST_ERROR_OBJECT (pvrvideosink, "Failed to blit. Error : %s", - gst_pvr2d_error_get_string (pvr_error)); - goto done; - } - dcontext->wsegl_table->pfnWSEGL_SwapDrawable (dcontext->drawable_handle, 1); - - if (draw_border) { - gst_pvrvideosink_xwindow_draw_borders (pvrvideosink, pvrvideosink->xwindow, - result); - pvrvideosink->redraw_borders = FALSE; - } - g_mutex_unlock (pvrvideosink->dcontext->x_lock); - -done: - GST_DEBUG_OBJECT (pvrvideosink, "end"); - g_mutex_unlock (pvrvideosink->flow_lock); - return; - - /* Error cases */ - -no_pvr_meta: - { - g_mutex_unlock (pvrvideosink->flow_lock); - GST_ERROR_OBJECT (pvrvideosink, "Got a buffer without GstPVRMeta"); - return; - } -} - -static void -gst_pvrvideosink_destroy_drawable (GstPVRVideoSink * pvrvideosink) -{ - GST_DEBUG_OBJECT (pvrvideosink, "dcontext : %p", pvrvideosink->dcontext); - - if (pvrvideosink->dcontext != NULL) { - if (pvrvideosink->dcontext->drawable_handle) { - GST_DEBUG_OBJECT (pvrvideosink, "Deleting Drawable (drawable_handle:%p)", - pvrvideosink->dcontext->drawable_handle); - pvrvideosink->dcontext->wsegl_table-> - pfnWSEGL_DeleteDrawable (pvrvideosink->dcontext->drawable_handle); - } - - GST_DEBUG_OBJECT (pvrvideosink, "Closing display (display_handle:%p)", - pvrvideosink->dcontext->display_handle); - pvrvideosink->dcontext->wsegl_table-> - pfnWSEGL_CloseDisplay (pvrvideosink->dcontext->display_handle); - } -} - -/* We are called with the x_lock taken */ -static void -gst_pvrvideosink_pvrfill_rectangle (GstPVRVideoSink * pvrvideosink, - GstVideoRectangle rect) -{ - PVR2DERROR pvr_error; - PPVR2DBLTINFO p_blt2d_info = 0; - GstDrawContext *dcontext = pvrvideosink->dcontext; - - GST_DEBUG_OBJECT (pvrvideosink, "begin"); - - p_blt2d_info = dcontext->p_blt2d_info; - - p_blt2d_info->pDstMemInfo = &dcontext->dst_mem; - p_blt2d_info->BlitFlags = PVR2D_BLIT_DISABLE_ALL; - p_blt2d_info->DstOffset = 0; - p_blt2d_info->CopyCode = PVR2DROPclear; - p_blt2d_info->DstStride = 4 * pvrvideosink->render_params.ui32Stride; - p_blt2d_info->DstFormat = PVR2D_ARGB8888; - p_blt2d_info->DstSurfWidth = pvrvideosink->xwindow->width; - p_blt2d_info->DstSurfHeight = pvrvideosink->xwindow->height; - p_blt2d_info->DstX = rect.x; - p_blt2d_info->DstY = rect.y; - p_blt2d_info->DSizeX = rect.w; - p_blt2d_info->DSizeY = rect.h; - - pvr_error = PVR2DBlt (pvrvideosink->dcontext->pvr_context, p_blt2d_info); - - if (pvr_error != PVR2D_OK) { - GST_ERROR_OBJECT (pvrvideosink, "Failed to blit. Error : %s", - gst_pvr2d_error_get_string (pvr_error)); - goto done; - } - dcontext->wsegl_table->pfnWSEGL_SwapDrawable (dcontext->drawable_handle, 1); - -done: - GST_DEBUG_OBJECT (pvrvideosink, "end"); -} - -/* We are called with the x_lock taken */ -static void -gst_pvrvideosink_xwindow_draw_borders (GstPVRVideoSink * pvrvideosink, - GstXWindow * xwindow, GstVideoRectangle rect) -{ - gint t1, t2; - GstVideoRectangle result; - - g_return_if_fail (GST_IS_PVRVIDEOSINK (pvrvideosink)); - g_return_if_fail (xwindow != NULL); - - /* Left border */ - result.x = pvrvideosink->render_rect.x; - result.y = pvrvideosink->render_rect.y; - result.w = rect.x - pvrvideosink->render_rect.x; - result.h = pvrvideosink->render_rect.h; - if (rect.x > pvrvideosink->render_rect.x) - gst_pvrvideosink_pvrfill_rectangle (pvrvideosink, result); - - /* Right border */ - t1 = rect.x + rect.w; - t2 = pvrvideosink->render_rect.x + pvrvideosink->render_rect.w; - result.x = t1; - result.y = pvrvideosink->render_rect.y; - result.w = t2 - t1; - result.h = pvrvideosink->render_rect.h; - if (t1 < t2) - gst_pvrvideosink_pvrfill_rectangle (pvrvideosink, result); - - /* Top border */ - result.x = pvrvideosink->render_rect.x; - result.y = pvrvideosink->render_rect.y; - result.w = pvrvideosink->render_rect.w; - result.h = rect.y - pvrvideosink->render_rect.y; - if (rect.y > pvrvideosink->render_rect.y) - gst_pvrvideosink_pvrfill_rectangle (pvrvideosink, result); - - /* Bottom border */ - t1 = rect.y + rect.h; - t2 = pvrvideosink->render_rect.y + pvrvideosink->render_rect.h; - result.x = pvrvideosink->render_rect.x; - result.y = t1; - result.w = pvrvideosink->render_rect.w; - result.h = t2 - t1; - if (t1 < t2) - gst_pvrvideosink_pvrfill_rectangle (pvrvideosink, result); -} - -/* Element stuff */ - -static gboolean -gst_pvrvideosink_setcaps (GstBaseSink * bsink, GstCaps * caps) -{ - GstPVRVideoSink *pvrvideosink; - GstVideoInfo info; - GstStructure *structure; - GstBufferPool *oldpool, *newpool; - - pvrvideosink = GST_PVRVIDEOSINK (bsink); - - GST_DEBUG_OBJECT (pvrvideosink, - "sinkconnect possible caps with given caps %" GST_PTR_FORMAT, caps); - - if (!gst_video_info_from_caps (&info, caps)) - goto invalid_format; - - GST_VIDEO_SINK_WIDTH (pvrvideosink) = info.width; - GST_VIDEO_SINK_HEIGHT (pvrvideosink) = info.height; - - /* Notify application to set xwindow id now */ - g_mutex_lock (pvrvideosink->flow_lock); - if (!pvrvideosink->xwindow) { - g_mutex_unlock (pvrvideosink->flow_lock); - gst_video_overlay_prepare_window_handle (GST_VIDEO_OVERLAY (pvrvideosink)); - } else { - g_mutex_unlock (pvrvideosink->flow_lock); - } - - g_mutex_lock (pvrvideosink->flow_lock); - if (!pvrvideosink->xwindow) - pvrvideosink->xwindow = gst_pvrvideosink_create_window (pvrvideosink, - GST_VIDEO_SINK_WIDTH (pvrvideosink), - GST_VIDEO_SINK_HEIGHT (pvrvideosink)); - g_mutex_unlock (pvrvideosink->flow_lock); - - pvrvideosink->info = info; - - /* After a resize, we want to redraw the borders in case the new frame size - * doesn't cover the same area */ - pvrvideosink->redraw_borders = TRUE; - - /* create a new pool for the new configuration */ - newpool = gst_pvr_buffer_pool_new (GST_ELEMENT_CAST (pvrvideosink)); - - /* PVR needs at least 3 buffers */ - structure = gst_buffer_pool_get_config (newpool); - gst_buffer_pool_config_set (structure, caps, GST_VIDEO_INFO_SIZE (&info), 3, - 0, 0, 15); - if (!gst_buffer_pool_set_config (newpool, structure)) - goto config_failed; - - oldpool = pvrvideosink->pool; - pvrvideosink->pool = newpool; - g_mutex_unlock (pvrvideosink->flow_lock); - - /* unref the old sink */ - if (oldpool) { - /* we don't deactivate, some elements might still be using it, it will - * be deactivated when the last ref is gone */ - gst_object_unref (oldpool); - } - - return TRUE; - -config_failed: - { - GST_ERROR_OBJECT (pvrvideosink, "failed to set config."); - g_mutex_unlock (pvrvideosink->flow_lock); - return FALSE; - } - -invalid_format: - { - GST_DEBUG_OBJECT (pvrvideosink, - "Could not locate image format from caps %" GST_PTR_FORMAT, caps); - return FALSE; - } -} - -static GstCaps * -gst_pvrvideosink_getcaps (GstBaseSink * bsink, GstCaps * filter) -{ - GstPVRVideoSink *pvrvideosink; - GstCaps *caps; - - GST_DEBUG_OBJECT (bsink, "filter:%" GST_PTR_FORMAT, filter); - - pvrvideosink = GST_PVRVIDEOSINK (bsink); - - /* FIXME : If we have curently configured caps, we should return those - * intersected with the filter*/ - - caps = gst_pad_get_pad_template_caps (GST_BASE_SINK (pvrvideosink)->sinkpad); - if (filter) { - GstCaps *intersection; - - intersection = - gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST); - gst_caps_unref (caps); - caps = intersection; - } - - GST_DEBUG_OBJECT (bsink, "Returning %" GST_PTR_FORMAT, caps); - - return caps; -} - -static GstStateChangeReturn -gst_pvrvideosink_change_state (GstElement * element, GstStateChange transition) -{ - GstPVRVideoSink *pvrvideosink; - GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; - GstDrawContext *dcontext; - - pvrvideosink = GST_PVRVIDEOSINK (element); - - switch (transition) { - case GST_STATE_CHANGE_NULL_TO_READY: - if (pvrvideosink->dcontext == NULL) { - dcontext = gst_pvrvideosink_get_dcontext (pvrvideosink); - if (dcontext == NULL) - return GST_STATE_CHANGE_FAILURE; - GST_OBJECT_LOCK (pvrvideosink); - pvrvideosink->dcontext = dcontext; - GST_OBJECT_UNLOCK (pvrvideosink); - } - gst_pvrvideosink_manage_event_thread (pvrvideosink); - break; - case GST_STATE_CHANGE_READY_TO_PAUSED: - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - break; - case GST_STATE_CHANGE_PAUSED_TO_PLAYING: - break; - default: - break; - } - - ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - - switch (transition) { - case GST_STATE_CHANGE_PLAYING_TO_PAUSED: - break; - case GST_STATE_CHANGE_PAUSED_TO_READY: - GST_VIDEO_SINK_WIDTH (pvrvideosink) = 0; - GST_VIDEO_SINK_HEIGHT (pvrvideosink) = 0; - break; - case GST_STATE_CHANGE_READY_TO_NULL: - gst_pvrvideosink_reset (pvrvideosink); - break; - default: - break; - } - - return ret; -} - -static void -gst_pvrvideosink_get_times (GstBaseSink * bsink, GstBuffer * buf, - GstClockTime * start, GstClockTime * end) -{ - GstPVRVideoSink *pvrvideosink; - - pvrvideosink = GST_PVRVIDEOSINK (bsink); - - if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { - *start = GST_BUFFER_TIMESTAMP (buf); - if (GST_BUFFER_DURATION_IS_VALID (buf)) { - *end = *start + GST_BUFFER_DURATION (buf); - } else { - gint fps_n, fps_d; - fps_n = GST_VIDEO_INFO_FPS_N (&pvrvideosink->info); - fps_d = GST_VIDEO_INFO_FPS_D (&pvrvideosink->info); - if (fps_n > 0) { - *end = *start + gst_util_uint64_scale_int (GST_SECOND, fps_d, fps_n); - } - } - } -} - -static GstFlowReturn -gst_pvrvideosink_show_frame (GstVideoSink * vsink, GstBuffer * buf) -{ - GstPVRVideoSink *pvrvideosink = GST_PVRVIDEOSINK (vsink); - GstPVRMeta *meta; - - GST_DEBUG_OBJECT (pvrvideosink, "render buffer: %p", buf); - - meta = gst_buffer_get_pvr_meta (buf); - - if (G_UNLIKELY (meta == NULL)) { - meta = gst_buffer_add_pvr_meta (buf, GST_ELEMENT_CAST (pvrvideosink)); - if (meta == NULL) - goto meta_failure; - } - - gst_pvrvideosink_blit (pvrvideosink, buf); - - return GST_FLOW_OK; - -meta_failure: - { - GST_WARNING_OBJECT (pvrvideosink, "Failed to map incoming buffer"); - return GST_FLOW_ERROR; - } -} - -static gboolean -gst_pvrvideosink_propose_allocation (GstBaseSink * bsink, GstQuery * query) -{ - GstPVRVideoSink *pvrvideosink = (GstPVRVideoSink *) bsink; - GstBufferPool *pool; - GstStructure *config; - GstCaps *caps; - guint size; - gboolean need_pool; - - gst_query_parse_allocation (query, &caps, &need_pool); - - if (caps == NULL) - goto no_caps; - - g_mutex_lock (pvrvideosink->flow_lock); - if ((pool = pvrvideosink->pool)) - gst_object_ref (pool); - g_mutex_unlock (pvrvideosink->flow_lock); - - if (pool != NULL) { - const GstCaps *pcaps; - - /* we had a pool, check caps */ - GST_DEBUG_OBJECT (pvrvideosink, "check existing pool caps"); - config = gst_buffer_pool_get_config (pool); - gst_buffer_pool_config_get (config, &pcaps, &size, NULL, NULL, NULL, NULL); - gst_structure_free (config); - - if (!gst_caps_is_equal (caps, pcaps)) { - GST_DEBUG_OBJECT (pvrvideosink, "pool has different caps"); - /* different caps, we can't use this pool */ - gst_object_unref (pool); - pool = NULL; - } - } - - if (pool == NULL && need_pool) { - GstVideoInfo info; - - GST_DEBUG_OBJECT (pvrvideosink, "create new pool"); - pool = gst_pvr_buffer_pool_new (GST_ELEMENT_CAST (pvrvideosink)); - - if (!gst_video_info_from_caps (&info, caps)) - goto invalid_caps; - - /* the normal size of a frame */ - size = info.size; - - config = gst_buffer_pool_get_config (pool); - gst_buffer_pool_config_set (config, caps, size, 0, 0, 0, 0); - if (!gst_buffer_pool_set_config (pool, config)) - goto config_failed; - } - /* we need at least 3 buffers */ - gst_query_set_allocation_params (query, size, 3, 0, 0, 0, pool); - - /* we also support various metadata */ - gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API, NULL); - - gst_object_unref (pool); - - return TRUE; - - /* ERRORS */ -no_caps: - { - GST_DEBUG_OBJECT (bsink, "no caps specified"); - return FALSE; - } -invalid_caps: - { - GST_DEBUG_OBJECT (bsink, "invalid caps specified"); - return FALSE; - } -config_failed: - { - GST_DEBUG_OBJECT (bsink, "failed setting config"); - return FALSE; - } -} - -/* Interfaces stuff */ - -/* This function destroys a GstXWindow */ -static void -gst_pvrvideosink_xwindow_destroy (GstPVRVideoSink * pvrvideosink, - GstXWindow * xwindow) -{ - g_return_if_fail (xwindow != NULL); - - g_mutex_lock (pvrvideosink->dcontext->x_lock); - - /* If we did not create that window we just free the GC and let it live */ - if (xwindow->internal) - XDestroyWindow (pvrvideosink->dcontext->x_display, xwindow->window); - else - XSelectInput (pvrvideosink->dcontext->x_display, xwindow->window, 0); - - XFreeGC (pvrvideosink->dcontext->x_display, xwindow->gc); - - XSync (pvrvideosink->dcontext->x_display, FALSE); - - g_mutex_unlock (pvrvideosink->dcontext->x_lock); - - g_free (xwindow); -} - -static void -gst_pvrvideosink_set_window_handle (GstVideoOverlay * overlay, guintptr id) -{ - XID window_handle = id; - GstPVRVideoSink *pvrvideosink = GST_PVRVIDEOSINK (overlay); - GstXWindow *xwindow = NULL; - - g_return_if_fail (GST_IS_PVRVIDEOSINK (pvrvideosink)); - - g_mutex_lock (pvrvideosink->flow_lock); - - /* If we already use that window return */ - if (pvrvideosink->xwindow && (window_handle == pvrvideosink->xwindow->window)) { - g_mutex_unlock (pvrvideosink->flow_lock); - return; - } - - /* If the element has not initialized the X11 context try to do so */ - if (!pvrvideosink->dcontext && !(pvrvideosink->dcontext = - gst_pvrvideosink_get_dcontext (pvrvideosink))) { - g_mutex_unlock (pvrvideosink->flow_lock); - /* we have thrown a GST_ELEMENT_ERROR now */ - return; - } - - /* If a window is there already we destroy it */ - if (pvrvideosink->xwindow) { - gst_pvrvideosink_xwindow_destroy (pvrvideosink, pvrvideosink->xwindow); - pvrvideosink->xwindow = NULL; - } - - /* If the xid is 0 we will create an internal one in buffer_alloc */ - if (window_handle != 0) { - XWindowAttributes attr; - WSEGLError glerror; - WSEGLDrawableParams source_params; - PVRSRV_CLIENT_MEM_INFO *client_mem_info; - - xwindow = g_new0 (GstXWindow, 1); - xwindow->window = window_handle; - - /* Set the event we want to receive and create a GC */ - g_mutex_lock (pvrvideosink->dcontext->x_lock); - - XGetWindowAttributes (pvrvideosink->dcontext->x_display, xwindow->window, - &attr); - - xwindow->width = attr.width; - xwindow->height = attr.height; - xwindow->internal = FALSE; - if (!pvrvideosink->have_render_rect) { - pvrvideosink->render_rect.x = pvrvideosink->render_rect.y = 0; - pvrvideosink->render_rect.w = attr.width; - pvrvideosink->render_rect.h = attr.height; - } - XSelectInput (pvrvideosink->dcontext->x_display, xwindow->window, - ExposureMask | StructureNotifyMask); - - XSetWindowBackgroundPixmap (pvrvideosink->dcontext->x_display, - xwindow->window, None); - - XMapWindow (pvrvideosink->dcontext->x_display, xwindow->window); - xwindow->gc = XCreateGC (pvrvideosink->dcontext->x_display, - xwindow->window, 0, NULL); - g_mutex_unlock (pvrvideosink->dcontext->x_lock); - - glerror = - pvrvideosink->dcontext->wsegl_table-> - pfnWSEGL_CreateWindowDrawable (pvrvideosink->dcontext->display_handle, - pvrvideosink->dcontext->glconfig, - &(pvrvideosink->dcontext->drawable_handle), - (NativeWindowType) xwindow->window, - &(pvrvideosink->dcontext->rotation)); - - if (glerror != WSEGL_SUCCESS) { - GST_ERROR_OBJECT (pvrvideosink, "Error creating drawable"); - return; - } - glerror = - pvrvideosink->dcontext->wsegl_table-> - pfnWSEGL_GetDrawableParameters (pvrvideosink->dcontext->drawable_handle, - &source_params, &pvrvideosink->render_params); - - client_mem_info = - (PVRSRV_CLIENT_MEM_INFO *) pvrvideosink->render_params.hPrivateData; - PVR2DMEMINFO_INITIALISE (&pvrvideosink->dcontext->dst_mem, client_mem_info); - } - - if (xwindow) - pvrvideosink->xwindow = xwindow; - - g_mutex_unlock (pvrvideosink->flow_lock); -} - -static void -gst_pvrvideosink_expose (GstVideoOverlay * overlay) -{ - GstPVRVideoSink *pvrvideosink = GST_PVRVIDEOSINK (overlay); - - gst_pvrvideosink_blit (pvrvideosink, NULL); -} - -static void -gst_pvrvideosink_set_event_handling (GstVideoOverlay * overlay, - gboolean handle_events) -{ - GstPVRVideoSink *pvrvideosink = GST_PVRVIDEOSINK (overlay); - - g_mutex_lock (pvrvideosink->flow_lock); - - if (G_UNLIKELY (!pvrvideosink->xwindow)) { - g_mutex_unlock (pvrvideosink->flow_lock); - return; - } - - g_mutex_lock (pvrvideosink->dcontext->x_lock); - - XSelectInput (pvrvideosink->dcontext->x_display, - pvrvideosink->xwindow->window, ExposureMask | StructureNotifyMask); - - g_mutex_unlock (pvrvideosink->dcontext->x_lock); - - g_mutex_unlock (pvrvideosink->flow_lock); -} - -static void -gst_pvrvideosink_set_render_rectangle (GstVideoOverlay * overlay, gint x, - gint y, gint width, gint height) -{ - GstPVRVideoSink *pvrvideosink = GST_PVRVIDEOSINK (overlay); - - /* FIXME: how about some locking? */ - if (width >= 0 && height >= 0) { - pvrvideosink->render_rect.x = x; - pvrvideosink->render_rect.y = y; - pvrvideosink->render_rect.w = width; - pvrvideosink->render_rect.h = height; - pvrvideosink->have_render_rect = TRUE; - } else { - pvrvideosink->render_rect.x = 0; - pvrvideosink->render_rect.y = 0; - pvrvideosink->render_rect.w = pvrvideosink->xwindow->width; - pvrvideosink->render_rect.h = pvrvideosink->xwindow->height; - pvrvideosink->have_render_rect = FALSE; - } -} - -static void -gst_pvrvideosink_videooverlay_init (GstVideoOverlayInterface * iface) -{ - iface->set_window_handle = gst_pvrvideosink_set_window_handle; - iface->expose = gst_pvrvideosink_expose; - iface->handle_events = gst_pvrvideosink_set_event_handling; - iface->set_render_rectangle = gst_pvrvideosink_set_render_rectangle; -} - -/* =========================================== */ -/* */ -/* Init & Class init */ -/* */ -/* =========================================== */ - -static void -gst_pvrvideosink_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstPVRVideoSink *pvrvideosink; - - g_return_if_fail (GST_IS_PVRVIDEOSINK (object)); - - pvrvideosink = GST_PVRVIDEOSINK (object); - - switch (prop_id) { - case PROP_FORCE_ASPECT_RATIO: - pvrvideosink->keep_aspect = g_value_get_boolean (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_pvrvideosink_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstPVRVideoSink *pvrvideosink; - - g_return_if_fail (GST_IS_PVRVIDEOSINK (object)); - - pvrvideosink = GST_PVRVIDEOSINK (object); - - switch (prop_id) { - case PROP_FORCE_ASPECT_RATIO: - g_value_set_boolean (value, pvrvideosink->keep_aspect); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -void -gst_pvrvideosink_track_buffer (GstPVRVideoSink * pvrsink, GstBuffer * buffer) -{ - GST_DEBUG_OBJECT (pvrsink, "Adding buffer %p to tracked buffers", buffer); - pvrsink->metabuffers = g_list_prepend (pvrsink->metabuffers, buffer); -} - -void -gst_pvrvideosink_untrack_buffer (GstPVRVideoSink * pvrsink, GstBuffer * buffer) -{ - GST_DEBUG_OBJECT (pvrsink, "Removing buffer %p from tracked buffers", buffer); - pvrsink->metabuffers = g_list_remove_all (pvrsink->metabuffers, buffer); -} - -static void -gst_pvrvideosink_release_pvr_metas (GstPVRVideoSink * pvrsink) -{ - GstBuffer *buf; - GstPVRMeta *pvrmeta; - - GST_DEBUG_OBJECT (pvrsink, "Releasing pending PVR metas"); - - while (pvrsink->metabuffers) { - buf = (GstBuffer *) pvrsink->metabuffers->data; - - pvrmeta = gst_buffer_get_pvr_meta (buf); - if (pvrmeta) - gst_buffer_remove_meta (buf, (GstMeta *) pvrmeta); - } - - GST_DEBUG_OBJECT (pvrsink, "Done"); -} - -static void -gst_pvrvideosink_dcontext_free (GstDrawContext * dcontext) -{ - GST_DEBUG ("Freeing dcontext %p", dcontext); - - g_free (dcontext->p_blt_info); - g_free (dcontext->p_blt2d_info); - - if (dcontext->x_lock) - g_mutex_lock (dcontext->x_lock); - if (dcontext->x_display) { - GST_LOG ("Closing display"); - XCloseDisplay (dcontext->x_display); - } - if (dcontext->x_lock) { - g_mutex_unlock (dcontext->x_lock); - g_mutex_free (dcontext->x_lock); - } - - g_free (dcontext); -} - -static void -gst_pvrvideosink_dcontext_clear (GstPVRVideoSink * pvrvideosink) -{ - GstDrawContext *dcontext; - - GST_DEBUG_OBJECT (pvrvideosink, "Clearing dcontext %p", - pvrvideosink->dcontext); - - GST_OBJECT_LOCK (pvrvideosink); - if (!pvrvideosink->dcontext) { - GST_OBJECT_UNLOCK (pvrvideosink); - return; - } - - dcontext = pvrvideosink->dcontext; - pvrvideosink->dcontext = NULL; - GST_OBJECT_UNLOCK (pvrvideosink); - - gst_pvrvideosink_dcontext_free (dcontext); -} - -static void -gst_pvrvideosink_reset (GstPVRVideoSink * pvrvideosink) -{ - GThread *thread; - - GST_DEBUG_OBJECT (pvrvideosink, "Resetting"); - - GST_OBJECT_LOCK (pvrvideosink); - pvrvideosink->running = FALSE; - thread = pvrvideosink->event_thread; - pvrvideosink->event_thread = NULL; - GST_OBJECT_UNLOCK (pvrvideosink); - - if (thread) - g_thread_join (thread); - - if (pvrvideosink->current_buffer) { - GST_LOG_OBJECT (pvrvideosink, "Removing cached buffer"); - gst_buffer_unref (pvrvideosink->current_buffer); - pvrvideosink->current_buffer = NULL; - } - - if (pvrvideosink->pool) { - GST_LOG_OBJECT (pvrvideosink, "Unreffing pool"); - gst_object_unref (pvrvideosink->pool); - pvrvideosink->pool = NULL; - } - memset (&pvrvideosink->render_params, 0, sizeof (WSEGLDrawableParams)); - - pvrvideosink->render_rect.x = pvrvideosink->render_rect.y = 0; - pvrvideosink->render_rect.w = pvrvideosink->render_rect.h = 0; - pvrvideosink->have_render_rect = FALSE; - - gst_pvrvideosink_release_pvr_metas (pvrvideosink); - - gst_pvrvideosink_destroy_drawable (pvrvideosink); - - if (pvrvideosink->xwindow) { - gst_pvrvideosink_xwindow_destroy (pvrvideosink, pvrvideosink->xwindow); - pvrvideosink->xwindow = NULL; - } - - gst_pvrvideosink_dcontext_clear (pvrvideosink); -} - -static void -gst_pvrvideosink_finalize (GObject * object) -{ - GstPVRVideoSink *pvrvideosink; - - pvrvideosink = GST_PVRVIDEOSINK (object); - - gst_pvrvideosink_reset (pvrvideosink); - - if (pvrvideosink->flow_lock) { - g_mutex_free (pvrvideosink->flow_lock); - pvrvideosink->flow_lock = NULL; - } - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gst_pvrvideosink_init (GstPVRVideoSink * pvrvideosink) -{ - pvrvideosink->running = FALSE; - - pvrvideosink->flow_lock = g_mutex_new (); - pvrvideosink->pool = NULL; - - pvrvideosink->keep_aspect = FALSE; - pvrvideosink->current_caps = NULL; - pvrvideosink->dcontext = NULL; - pvrvideosink->xwindow = NULL; - pvrvideosink->redraw_borders = TRUE; - pvrvideosink->current_buffer = NULL; - pvrvideosink->event_thread = NULL; - memset (&pvrvideosink->render_params, 0, sizeof (WSEGLDrawableParams)); -} - -static void -gst_pvrvideosink_class_init (GstPVRVideoSinkClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - GstBaseSinkClass *gstbasesink_class; - GstVideoSinkClass *videosink_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - gstbasesink_class = (GstBaseSinkClass *) klass; - videosink_class = (GstVideoSinkClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - gobject_class->finalize = gst_pvrvideosink_finalize; - gobject_class->set_property = gst_pvrvideosink_set_property; - gobject_class->get_property = gst_pvrvideosink_get_property; - - g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO, - g_param_spec_boolean ("force-aspect-ratio", "Force aspect ratio", - "When enabled, reverse caps negotiation (scaling) will respect " - "original aspect ratio", TRUE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - gst_element_class_set_static_metadata (gstelement_class, - "PVR Video sink", "Sink/Video", - "A PVR videosink", - "Luciana Fujii Pontello <luciana.fujii@collabora.co.uk"); - - gst_element_class_add_static_pad_template (gstelement_class, - &gst_pvrvideosink_sink_template_factory); - - gstelement_class->change_state = gst_pvrvideosink_change_state; - - gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_pvrvideosink_setcaps); - gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_pvrvideosink_getcaps); - gstbasesink_class->propose_allocation = - GST_DEBUG_FUNCPTR (gst_pvrvideosink_propose_allocation); - gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_pvrvideosink_get_times); - - videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_pvrvideosink_show_frame); -} diff --git a/sys/pvr2d/gstpvrvideosink.h b/sys/pvr2d/gstpvrvideosink.h deleted file mode 100644 index c84bb22f5..000000000 --- a/sys/pvr2d/gstpvrvideosink.h +++ /dev/null @@ -1,153 +0,0 @@ -/* GStreamer - * - * Copyright (C) 2011 - Collabora Ltda - * Copyright (C) 2011 - Texas Instruments - * @author: Luciana Fujii Pontello <luciana.fujii@collabora.co.uk> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __GST_PVRVIDEOSINK_H__ -#define __GST_PVRVIDEOSINK_H__ - -#include <gst/video/gstvideosink.h> -#include <gst/video/video.h> - -#include <string.h> -#include <math.h> -#include <pvr2d.h> -#include <EGL/egl.h> -#include <wsegl.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> - -G_BEGIN_DECLS -#define GST_TYPE_PVRVIDEOSINK (gst_pvrvideosink_get_type()) -#define GST_PVRVIDEOSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_PVRVIDEOSINK, GstPVRVideoSink)) -#define GST_PVRVIDEOSINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_PVRVIDEOSINK, GstPVRVideoSinkClass)) -#define GST_IS_PVRVIDEOSINK(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_PVRVIDEOSINK)) -#define GST_IS_PVRVIDEOSINK_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_PVRVIDEOSINK)) -typedef struct _GstDrawContext GstDrawContext; -typedef struct _GstXWindow GstXWindow; - -typedef struct _GstPVRVideoBuffer GstPVRVideoBuffer; -typedef struct _GstPVRVideoBufferClass GstPVRVideoBufferClass; - -typedef struct _GstPVRVideoSink GstPVRVideoSink; -typedef struct _GstPVRVideoSinkClass GstPVRVideoSinkClass; - -struct _GstDrawContext -{ - /* PVR2D */ - PVR2DCONTEXTHANDLE pvr_context; - PVR2DMEMINFO dst_mem; - PPVR2D_3DBLT_EXT p_blt_info; - PPVR2DBLTINFO p_blt2d_info; - - long stride; - PVR2DFORMAT display_format; - long display_width; - long display_height; - - /* WSEGL */ - const WSEGL_FunctionTable *wsegl_table; - - WSEGLDisplayHandle display_handle; - const WSEGLCaps **glcaps; - WSEGLConfig *glconfig; - WSEGLDrawableHandle drawable_handle; - WSEGLRotationAngle rotation; - - GMutex *x_lock; - Display *x_display; - gint screen_num; - gulong black; -}; - -struct _GstXWindow -{ - Window window; - gint width, height; - gboolean internal; - GC gc; -}; - - -/** - * GstPVRVideoSink: - * @running: used to inform @event_thread if it should run/shutdown - * @fps_n: the framerate fraction numerator - * @fps_d: the framerate fraction denominator - * @flow_lock: used to protect data flow routines from external calls such as - * events from @event_thread or methods from the #GstXOverlay interface - * @x_lock: used to protect X calls - * @buffer_pool: a list of #GstPVRVideoBuffer that could be reused at next buffer - * allocation call - * @keep_aspect: used to remember if reverse negotiation scaling should respect - * aspect ratio - * - * The #GstPVRVideoSink data structure. - */ -struct _GstPVRVideoSink -{ - /* Our element stuff */ - GstVideoSink videosink; - - gboolean running; - - /* Framerate numerator and denominator */ - GstVideoInfo info; - - GThread *event_thread; - GMutex *flow_lock; - - GstBufferPool *pool; - - gboolean keep_aspect; - - GstCaps *current_caps; - GstDrawContext *dcontext; - GstXWindow *xwindow; - - GstVideoRectangle render_rect; - gboolean have_render_rect; - - gchar *media_title; - gboolean redraw_borders; - GstBuffer *current_buffer; - - /* List of buffer using GstPVRMeta on ourselves */ - GList *metabuffers; - - WSEGLDrawableParams render_params; -}; - -struct _GstPVRVideoSinkClass -{ - GstVideoSinkClass parent_class; -}; - -GType gst_pvrvideosink_get_type (void); - -void gst_pvrvideosink_track_buffer (GstPVRVideoSink * pvrsink, GstBuffer * buffer); -void gst_pvrvideosink_untrack_buffer (GstPVRVideoSink * pvrsink, GstBuffer * buffer); - -G_END_DECLS -#endif /* __GST_PVRVIDEOSINK_H__ */ diff --git a/sys/pvr2d/pvr_includes/dri2_ws.h b/sys/pvr2d/pvr_includes/dri2_ws.h deleted file mode 100644 index 743d5bb9c..000000000 --- a/sys/pvr2d/pvr_includes/dri2_ws.h +++ /dev/null @@ -1,176 +0,0 @@ -/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
-* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-#if !defined(__DRI2_WS_H__)
-#define __DRI2_WS_H__
-
-#define DRI2WS_DISPFLAG_DEFAULT_DISPLAY 0x00000001
-
-/*
-// Constants (macros) related to back-buffering.
-*/
-
-#define XWS_FLIP_BUFFERS 3
-#define DRI2_FLIP_BUFFERS_NUM XWS_FLIP_BUFFERS
-#define XWS_FLIP_BUFFER_INDEX (XWS_MAX_FLIP_BUFFERS - 1)
-
-#define XWS_BLIT_BUFFERS 2
-#define DRI2_BLIT_BUFFERS_NUM XWS_BLIT_BUFFERS
-#define XWS_BLIT_BUFFER_INDEX (XWS_MAX_BLIT_BUFFERS - 1)
-
-#if 0
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#endif
-
-#define XWS_MAX_BUFFERS MAX(XWS_FLIP_BUFFERS, XWS_BLIT_BUFFERS)
-#define DRI2_MAX_BUFFERS_NUM XWS_MAX_BUFFERS
-
-
-#define __DRI_BUFFER_EMPTY 103
-
-/** Used for ugly ugly ugly swap interval passing to dri2 driver and receiving current frame index */
-#define __DRI_BUFFER_PVR_CTRL 0x80 /* 100000XX <- last 2 bits for swap interval value */
-#define __DRI_BUFFER_PVR_CTRL_RET 0x90 /* 11000000 */
-
-
-
-#define DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS 1
-#define DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN 2
-
-#define UNREFERENCED_PARAMETER(x) (x) = (x)
-
-
-/*
- * Structure used to pass information about back buffers between client application and
- * X.Org. Watch out for equivalent structure in pvr_video lib
- */
-typedef struct _PVRDRI2BackBuffersExport_
-{
- /* Type of export. _BUFFERS mean set of handles, _SWAPCHAIN mean Swap chain ID */
- unsigned int ui32Type;
- PVR2D_HANDLE hBuffers[DRI2_MAX_BUFFERS_NUM];
- unsigned int ui32BuffersCount;
- unsigned int ui32SwapChainID;
-} PVRDRI2BackBuffersExport;
-
-/*
-// Private window system display information
-*/
-typedef struct DRI2WS_Display_TAG
-{
- unsigned int ui32RefCount;
-
- Display *display;
- int screen;
- unsigned int ui32Flags;
-
- unsigned int ui32Width;
- unsigned int ui32Height;
- unsigned int ui32StrideInBytes;
- unsigned int ui32BytesPerPixel;
- WSEGLPixelFormat ePixelFormat;
-
- PVR2DFORMAT ePVR2DPixelFormat;
- PVR2DCONTEXTHANDLE hContext;
- PVR2DMEMINFO *psMemInfo;
-
- int iDRMfd;
-} DRI2WSDisplay;
-
-
-typedef enum DRI2WS_DrawableType_TAG
-{
- DRI2_DRAWABLE_UNKNOWN = 0,
- DRI2_DRAWABLE_WINDOW = 1,
- DRI2_DRAWABLE_PIXMAP = 2,
-} DRI2WS_DrawableType;
-
-
-/*
-// Private window system drawable information
-*/
-typedef struct DRI2WS_Drawable_TAG
-{
- DRI2WS_DrawableType eDrawableType;
-
- Window nativeWin;
-
- /** Index of current render-to back buffer (received from Xserver) */
- unsigned int ui32BackBufferCurrent;
-
- /** Number of buffers */
- unsigned int ui32BackBufferNum;
-
- /** Swap interval (works only in fliping/fullscreen case, values 0-3) */
- unsigned int ui32SwapInterval;
-
- /** PVR2D Handles received from Xserver (back buffers export structure) */
- PVR2D_HANDLE hPVR2DBackBufferExport;
-
- /** Stamp of current back buffer */
- unsigned char ucBackBufferExportStamp;
-
- /** Array of PVR2D Handles received from Xserver (our back buffers) */
- PVR2D_HANDLE hPVR2DBackBuffer[XWS_MAX_BUFFERS];
-
- /** Array of PVR2D mapped back buffers */
- PVR2DMEMINFO *psMemBackBuffer[XWS_MAX_BUFFERS];
-
- /** Stamp of current back buffer */
- unsigned char ucFrontBufferStamp;
-
- /** Array of PVR2D Handles received from Xserver (our back buffers) */
- PVR2D_HANDLE hPVR2DFrontBuffer;
-
- /** Array of PVR2D mapped back buffers */
- PVR2DMEMINFO *psMemFrontBuffer;
-
- /** ID of flip/swap chain received from X.Org */
- unsigned int ui32FlipChainID;
-
- /** PVR2D Handle of flip chain used to get buffers to draw to */
- PVR2DFLIPCHAINHANDLE hFlipChain;
-
- int iWidth;
- int iHeight;
-
- WSEGLPixelFormat ePixelFormat;
- unsigned int ui32BytesPerPixel;
- unsigned int ui32StrideInPixels;
- unsigned int ui32StrideInBytes;
- PVR2DFORMAT ePVR2DPixelFormat;
-
- DRI2WSDisplay *psXWSDisplay;
-
-} DRI2WSDrawable;
-
-#endif /* __DRI2_WS_H__ */
diff --git a/sys/pvr2d/pvr_includes/img_defs.h b/sys/pvr2d/pvr_includes/img_defs.h deleted file mode 100644 index 64db71105..000000000 --- a/sys/pvr2d/pvr_includes/img_defs.h +++ /dev/null @@ -1,123 +0,0 @@ -/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
-* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-#if !defined (__IMG_DEFS_H__)
-#define __IMG_DEFS_H__
-
-#include "img_types.h"
-
-typedef enum img_tag_TriStateSwitch
-{
- IMG_ON = 0x00,
- IMG_OFF,
- IMG_IGNORE
-
-} img_TriStateSwitch, * img_pTriStateSwitch;
-
-#define IMG_SUCCESS 0
-
-#define IMG_NO_REG 1
-
-#if defined (NO_INLINE_FUNCS)
- #define INLINE
- #define FORCE_INLINE
-#else
-#if defined (__cplusplus)
- #define INLINE inline
- #define FORCE_INLINE inline
-#else
-#if !defined(INLINE)
- #define INLINE __inline
-#endif
- #define FORCE_INLINE static __inline
-#endif
-#endif
-
-
-#ifndef PVR_UNREFERENCED_PARAMETER
-#define PVR_UNREFERENCED_PARAMETER(param) (param) = (param)
-#endif
-
-#ifdef __GNUC__
-#define unref__ __attribute__ ((unused))
-#else
-#define unref__
-#endif
-
-#ifndef _TCHAR_DEFINED
-#if defined(UNICODE)
-typedef unsigned short TCHAR, *PTCHAR, *PTSTR;
-#else
-typedef char TCHAR, *PTCHAR, *PTSTR;
-#endif
-#define _TCHAR_DEFINED
-#endif
-
-
- #if defined(__linux__) || defined(__METAG)
-
- #define IMG_CALLCONV
- #define IMG_INTERNAL __attribute__((visibility("hidden")))
- #define IMG_EXPORT __attribute__((visibility("default")))
- #define IMG_IMPORT
- #define IMG_RESTRICT __restrict__
-
- #else
- #error("define an OS")
- #endif
-
-#ifndef IMG_ABORT
- #define IMG_ABORT() abort()
-#endif
-
-#ifndef IMG_MALLOC
- #define IMG_MALLOC(A) malloc (A)
-#endif
-
-#ifndef IMG_FREE
- #define IMG_FREE(A) free (A)
-#endif
-
-#define IMG_CONST const
-
-#if defined(__GNUC__)
-#define IMG_FORMAT_PRINTF(x,y) __attribute__((format(printf,x,y)))
-#else
-#define IMG_FORMAT_PRINTF(x,y)
-#endif
-
-#if defined (_WIN64)
-#define IMG_UNDEF (~0ULL)
-#else
-#define IMG_UNDEF (~0UL)
-#endif
-
-#endif
diff --git a/sys/pvr2d/pvr_includes/img_types.h b/sys/pvr2d/pvr_includes/img_types.h deleted file mode 100644 index c312c8374..000000000 --- a/sys/pvr2d/pvr_includes/img_types.h +++ /dev/null @@ -1,143 +0,0 @@ -/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
-* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-#ifndef __IMG_TYPES_H__
-#define __IMG_TYPES_H__
-
-#if !defined(IMG_ADDRSPACE_CPUVADDR_BITS)
-#define IMG_ADDRSPACE_CPUVADDR_BITS 32
-#endif
-
-#if !defined(IMG_ADDRSPACE_PHYSADDR_BITS)
-#define IMG_ADDRSPACE_PHYSADDR_BITS 32
-#endif
-
-typedef unsigned int IMG_UINT, *IMG_PUINT;
-typedef signed int IMG_INT, *IMG_PINT;
-
-typedef unsigned char IMG_UINT8, *IMG_PUINT8;
-typedef unsigned char IMG_BYTE, *IMG_PBYTE;
-typedef signed char IMG_INT8, *IMG_PINT8;
-typedef char IMG_CHAR, *IMG_PCHAR;
-
-typedef unsigned short IMG_UINT16, *IMG_PUINT16;
-typedef signed short IMG_INT16, *IMG_PINT16;
-#if !defined(IMG_UINT32_IS_ULONG)
-typedef unsigned int IMG_UINT32, *IMG_PUINT32;
-typedef signed int IMG_INT32, *IMG_PINT32;
-#else
-typedef unsigned long IMG_UINT32, *IMG_PUINT32;
-typedef signed long IMG_INT32, *IMG_PINT32;
-#endif
-#if !defined(IMG_UINT32_MAX)
- #define IMG_UINT32_MAX 0xFFFFFFFFUL
-#endif
-
- #if (defined(LINUX) || defined(__METAG))
-#if !defined(USE_CODE)
- typedef unsigned long long IMG_UINT64, *IMG_PUINT64;
- typedef long long IMG_INT64, *IMG_PINT64;
-#endif
- #else
-
- #error("define an OS")
-
- #endif
-
-#if !(defined(LINUX) && defined (__KERNEL__))
-typedef float IMG_FLOAT, *IMG_PFLOAT;
-typedef double IMG_DOUBLE, *IMG_PDOUBLE;
-#endif
-
-typedef enum tag_img_bool
-{
- IMG_FALSE = 0,
- IMG_TRUE = 1,
- IMG_FORCE_ALIGN = 0x7FFFFFFF
-} IMG_BOOL, *IMG_PBOOL;
-
-typedef void IMG_VOID, *IMG_PVOID;
-
-typedef IMG_INT32 IMG_RESULT;
-
-#if defined(_WIN64)
-typedef unsigned __int64 IMG_UINTPTR_T;
-#else
-typedef unsigned int IMG_UINTPTR_T;
-#endif
-
-typedef IMG_PVOID IMG_HANDLE;
-
-typedef void** IMG_HVOID, * IMG_PHVOID;
-
-typedef IMG_UINT32 IMG_SIZE_T;
-
-#define IMG_NULL 0
-
-typedef IMG_UINT32 IMG_SID;
-
-
-typedef IMG_PVOID IMG_CPU_VIRTADDR;
-
-typedef struct _IMG_DEV_VIRTADDR
-{
-
- IMG_UINT32 uiAddr;
-#define IMG_CAST_TO_DEVVADDR_UINT(var) (IMG_UINT32)(var)
-
-} IMG_DEV_VIRTADDR;
-
-typedef struct _IMG_CPU_PHYADDR
-{
-
- IMG_UINTPTR_T uiAddr;
-} IMG_CPU_PHYADDR;
-
-typedef struct _IMG_DEV_PHYADDR
-{
-#if IMG_ADDRSPACE_PHYSADDR_BITS == 32
-
- IMG_UINTPTR_T uiAddr;
-#else
- IMG_UINT32 uiAddr;
- IMG_UINT32 uiHighAddr;
-#endif
-} IMG_DEV_PHYADDR;
-
-typedef struct _IMG_SYS_PHYADDR
-{
-
- IMG_UINTPTR_T uiAddr;
-} IMG_SYS_PHYADDR;
-
-#include "img_defs.h"
-
-#endif
diff --git a/sys/pvr2d/pvr_includes/pvr2d.h b/sys/pvr2d/pvr_includes/pvr2d.h deleted file mode 100644 index 5dce7cf11..000000000 --- a/sys/pvr2d/pvr_includes/pvr2d.h +++ /dev/null @@ -1,669 +0,0 @@ -/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
-* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-/******************************************************************************
-Modifications :-
-$Log: pvr2d.h $
-
- --- Revision Logs Removed ---
-******************************************************************************/
-
-#ifndef _PVR2D_H_
-#define _PVR2D_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* PVR2D Platform-specific definitions */
-#if defined (__linux__)
-#define PVR2D_EXPORT __attribute__((visibility("default")))
-#define PVR2D_IMPORT
-#else
-#define PVR2D_EXPORT
-#define PVR2D_IMPORT
-#endif
-
-/* PVR2D header revision */
-#define PVR2D_REV_MAJOR 3
-#define PVR2D_REV_MINOR 5
-
-/* Basic types */
-typedef enum
-{
- PVR2D_FALSE = 0,
- PVR2D_TRUE
-} PVR2D_BOOL;
-
-typedef void* PVR2D_HANDLE;
-
-typedef char PVR2D_CHAR, *PVR2D_PCHAR;
-typedef unsigned char PVR2D_UCHAR, *PVR2D_PUCHAR;
-typedef int PVR2D_INT, *PVR2D_PINT;
-typedef unsigned int PVR2D_UINT, *PVR2D_PUINT;
-typedef long PVR2D_LONG, *PVR2D_PLONG;
-typedef unsigned long PVR2D_ULONG, *PVR2D_PULONG;
-
-typedef void PVR2D_VOID, *PVR2D_PVOID;
-
-
-/* error codes */
-typedef enum
-{
- PVR2D_OK = 0,
- PVR2DERROR_INVALID_PARAMETER = -1,
- PVR2DERROR_DEVICE_UNAVAILABLE = -2,
- PVR2DERROR_INVALID_CONTEXT = -3,
- PVR2DERROR_MEMORY_UNAVAILABLE = -4,
- PVR2DERROR_DEVICE_NOT_PRESENT = -5,
- PVR2DERROR_IOCTL_ERROR = -6,
- PVR2DERROR_GENERIC_ERROR = -7,
- PVR2DERROR_BLT_NOTCOMPLETE = -8,
- PVR2DERROR_HW_FEATURE_NOT_SUPPORTED = -9,
- PVR2DERROR_NOT_YET_IMPLEMENTED = -10,
- PVR2DERROR_MAPPING_FAILED = -11
-}PVR2DERROR;
-
-/* 32 bit PVR2D pixel format specifier */
-typedef unsigned long PVR2DFORMAT;
-
-/* Standard PVR2D pixel formats */
-#define PVR2D_1BPP 0x00UL // 1bpp mask surface or palletized 1 bit source with 2x32 bit CLUT
-#define PVR2D_RGB565 0x01UL // Common rgb 565 format
-#define PVR2D_ARGB4444 0x02UL // Common argb 4444 format
-#define PVR2D_RGB888 0x03UL // Common rgb 888 format (not supported)
-#define PVR2D_ARGB8888 0x04UL // Common argb 8888 format
-#define PVR2D_ARGB1555 0x05UL // Common argb 1555 format
-#define PVR2D_ALPHA8 0x06UL // Alpha-only 8 bit per pixel (used with a constant fill colour)
-#define PVR2D_ALPHA4 0x07UL // Alpha-only 4 bits per pixel (used with a constant fill colour)
-#define PVR2D_PAL2 0x08UL // Palletized 2 bit format (requires 4x32 bit CLUT)
-#define PVR2D_PAL4 0x09UL // Palletized 4 bit format (requires 16x32 bit CLUT)
-#define PVR2D_PAL8 0x0AUL // Palletized 8 bit format (requires 256x32 bit CLUT)
-#define PVR2D_U8 0x10UL // monochrome unsigned 8 bit
-#define PVR2D_U88 0x11UL // monochrome unsigned 16 bit
-#define PVR2D_S8 0x12UL // signed 8 bit
-#define PVR2D_YUV422_YUYV 0x13UL // YUV 422 low-high byte order Y0UY1V
-#define PVR2D_YUV422_UYVY 0x14UL // YUV 422 low-high byte order UY0VY1
-#define PVR2D_YUV422_YVYU 0x15UL // YUV 422 low-high byte order Y0VY1U
-#define PVR2D_YUV422_VYUY 0x16UL // YUV 422 low-high byte order VY0UY1
-#define PVR2D_YUV420_2PLANE 0x17UL // YUV420 2 Plane
-#define PVR2D_YUV420_3PLANE 0x18UL // YUV420 3 Plane
-#define PVR2D_2101010ARGB 0x19UL // 32 bit 2 10 10 10
-#define PVR2D_888RSGSBS 0x1AUL
-#define PVR2D_16BPP_RAW 0x1BUL // 16 bit raw (no format conversion)
-#define PVR2D_32BPP_RAW 0x1CUL // 32 bit raw
-#define PVR2D_64BPP_RAW 0x1DUL // 64 bit raw
-#define PVR2D_128BPP_RAW 0x1EUL // 128 bit raw
-
-#define PVR2D_NO_OF_FORMATS 0x1FUL
-
-/* Format modifier bit field (DstFormat and SrcFormat bits 16..23) */
-#define PVR2D_FORMAT_MASK 0x0000FFFFUL // PVR2D Format bits
-#define PVR2D_FORMAT_LAYOUT_MASK 0x000F0000UL // Format layout (strided / twiddled / tiled)
-#define PVR2D_FORMAT_FLAGS_MASK 0x0FF00000UL // Surface Flags mask
-
-/* Layout */
-#define PVR2D_FORMAT_LAYOUT_SHIFT 16
-#define PVR2D_FORMAT_LAYOUT_STRIDED 0x00000000UL
-#define PVR2D_FORMAT_LAYOUT_TILED 0x00010000UL
-#define PVR2D_FORMAT_LAYOUT_TWIDDLED 0x00020000UL
-
-/*
- PVR2D_SURFACE_PDUMP
- This flag requests a surface pdump, to capture the pixel state after host writes.
- Not needed if the surface state has resulted from previous SGX 2D/3D core writes.
-*/
-#define PVR2D_SURFACE_PDUMP 0x00100000UL // calls PVRSRVPDumpMem to capture the surface (pdump builds only)
-
-/*
- Low level 3D format extension - for blts via the 3D core only.
- If the top bit of the format field is set then PVR2D reads it as a PVRSRV_PIXEL_FORMAT.
- The outcome is hardware dependant.
- There is no guarantee that any specific PVRSRV format will be supported.
-*/
-#define PVR2D_FORMAT_PVRSRV 0x80000000
-
-/* wrap surface type */
-typedef enum
-{
- PVR2D_WRAPFLAG_NONCONTIGUOUS = 0,
- PVR2D_WRAPFLAG_CONTIGUOUS = 1,
-
-}PVR2DWRAPFLAGS;
-
-#define PVR2D_CONTEXT_FLAGS_PRIORITY_MASK 0x00000003
-
-#define PVR2D_CONTEXT_FLAGS_LOW_PRIORITY_CONTEXT 1
-#define PVR2D_CONTEXT_FLAGS_NORMAL_PRIORITY_CONTEXT 0
-#define PVR2D_CONTEXT_FLAGS_HIGH_PRIORITY_CONTEXT 2
-
-/* flags for control information of additional blits */
-typedef enum
-{
- PVR2D_BLIT_DISABLE_ALL = 0x00000000, /* disable all additional controls */
- PVR2D_BLIT_CK_ENABLE = 0x00000001, /* enable colour key */
- PVR2D_BLIT_GLOBAL_ALPHA_ENABLE = 0x00000002, /* enable standard global alpha */
- PVR2D_BLIT_PERPIXEL_ALPHABLEND_ENABLE = 0x00000004, /* enable per-pixel alpha bleding */
- PVR2D_BLIT_PAT_SURFACE_ENABLE = 0x00000008, /* enable pattern surf (disable fill) */
- PVR2D_BLIT_FULLY_SPECIFIED_ALPHA_ENABLE = 0x00000010, /* enable fully specified alpha */
- PVR2D_BLIT_ROT_90 = 0x00000020, /* apply 90 degree rotation to the blt */
- PVR2D_BLIT_ROT_180 = 0x00000040, /* apply 180 degree rotation to the blt */
- PVR2D_BLIT_ROT_270 = 0x00000080, /* apply 270 degree rotation to the blt */
- PVR2D_BLIT_COPYORDER_TL2BR = 0x00000100, /* copy order overrides */
- PVR2D_BLIT_COPYORDER_BR2TL = 0x00000200,
- PVR2D_BLIT_COPYORDER_TR2BL = 0x00000400,
- PVR2D_BLIT_COPYORDER_BL2TR = 0x00000800,
- PVR2D_BLIT_COLKEY_SOURCE = 0x00001000, /* Key colour is on the source surface */
- PVR2D_BLIT_COLKEY_DEST = 0x00002000, /* Key colour is on the destination surface */
- PVR2D_BLIT_COLKEY_MASKED = 0x00004000, /* Mask enabled for colour key */
- PVR2D_BLIT_COLKEY_OP_PASS = 0x00008000, /* Colour key op = pass */
- PVR2D_BLIT_COLKEY_OP_REJECT = 0x00010000, /* Colour key op = reject */
- PVR2D_BLIT_PATH_2DCORE = 0x00100000, /* Blt via dedicated 2D Core or PTLA */
- PVR2D_BLIT_PATH_3DCORE = 0x00200000, /* Blt via 3D Core */
- PVR2D_BLIT_PATH_SWBLT = 0x00400000, /* Blt via host software */
- PVR2D_BLIT_NO_SRC_SYNC_INFO = 0x00800000, /* Dont send a source sync info*/
- PVR2D_BLIT_ISSUE_STATUS_UPDATES = 0x01000000, /* Issue status updates */
-
-} PVR2DBLITFLAGS;
-
-/* standard alpha-blending functions, AlphaBlendingFunc field of PVR2DBLTINFO */
-typedef enum
-{
- PVR2D_ALPHA_OP_SRC_DSTINV = 1, /* source alpha : Cdst = Csrc*Asrc + Cdst*(1-Asrc) */
- PVR2D_ALPHA_OP_SRCP_DSTINV = 2 /* premultiplied source alpha : Cdst = Csrc + Cdst*(1-Asrc) */
-} PVR2D_ALPHABLENDFUNC;
-
-/* blend ops for fully specified alpha (SGX 2D Core only) */
-typedef enum
-{
- PVR2D_BLEND_OP_ZERO = 0,
- PVR2D_BLEND_OP_ONE = 1,
- PVR2D_BLEND_OP_SRC = 2,
- PVR2D_BLEND_OP_DST = 3,
- PVR2D_BLEND_OP_GLOBAL = 4,
- PVR2D_BLEND_OP_SRC_PLUS_GLOBAL = 5,
- PVR2D_BLEND_OP_DST_PLUS_GLOBAL = 6
-}PVR2D_BLEND_OP;
-
-/* SGX 2D Core Fully specified alpha blend : pAlpha field of PVR2DBLTINFO structure */
-/* a fully specified Alpha Blend operation is defined as */
-/* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (ALPHA_3 * DST (ALPHA)) */
-/* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (ALPHA_4 * DST (RGB)) */
-/* if the pre-multiplication stage is enabled then the equations become the following: */
-/* PRE_MUL = ((SRC(A)) * (Global Alpha Value)) */
-/* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (PRE_MUL * DST (ALPHA)) */
-/* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (PRE_MUL * DST (RGB)) */
-/* if the transparent source alpha stage is enabled then a source alpha of zero forces the */
-/* source to be transparent for that pixel regardless of the blend equation being used. */
-typedef struct _PVR2D_ALPHABLT
-{
- PVR2D_BLEND_OP eAlpha1;
- PVR2D_BOOL bAlpha1Invert;
- PVR2D_BLEND_OP eAlpha2;
- PVR2D_BOOL bAlpha2Invert;
- PVR2D_BLEND_OP eAlpha3;
- PVR2D_BOOL bAlpha3Invert;
- PVR2D_BLEND_OP eAlpha4;
- PVR2D_BOOL bAlpha4Invert;
- PVR2D_BOOL bPremulAlpha; /* enable pre-multiplication stage */
- PVR2D_BOOL bTransAlpha; /* enable transparent source alpha stage */
- PVR2D_BOOL bUpdateAlphaLookup; /* enable and update the 1555-Lookup alpha table */
- PVR2D_UCHAR uAlphaLookup0; /* 8 bit alpha when A=0 in a 1555-Lookup surface */
- PVR2D_UCHAR uAlphaLookup1; /* 8 bit alpha when A=1 in a 1555-Lookup surface */
- PVR2D_UCHAR uGlobalRGB; /* Global Alpha Value for RGB, 0=transparent 255=opaque */
- PVR2D_UCHAR uGlobalA; /* Global Alpha Value for Alpha */
-
-} PVR2D_ALPHABLT, *PPVR2D_ALPHABLT;
-
-
-/* surface memory info structure */
-typedef struct _PVR2DMEMINFO
-{
- PVR2D_VOID *pBase;
- PVR2D_ULONG ui32MemSize;
- PVR2D_ULONG ui32DevAddr;
- PVR2D_ULONG ulFlags;
- PVR2D_VOID *hPrivateData;
- PVR2D_VOID *hPrivateMapData;
-
-}PVR2DMEMINFO, *PPVR2DMEMINFO;
-
-
-#define PVR2D_MAX_DEVICE_NAME 20
-
-typedef struct _PVR2DDEVICEINFO
-{
- PVR2D_ULONG ulDevID;
- PVR2D_CHAR szDeviceName[PVR2D_MAX_DEVICE_NAME];
-}PVR2DDEVICEINFO;
-
-
-typedef struct _PVR2DISPLAYINFO
-{
- PVR2D_ULONG ulMaxFlipChains;
- PVR2D_ULONG ulMaxBuffersInChain;
- PVR2DFORMAT eFormat;
- PVR2D_ULONG ulWidth;
- PVR2D_ULONG ulHeight;
- PVR2D_LONG lStride;
- PVR2D_ULONG ulMinFlipInterval;
- PVR2D_ULONG ulMaxFlipInterval;
-
-}PVR2DDISPLAYINFO;
-
-
-typedef struct _PVR2MISCDISPLAYINFO
-{
- PVR2D_ULONG ulPhysicalWidthmm;
- PVR2D_ULONG ulPhysicalHeightmm;
- PVR2D_ULONG ulUnused[10];
-
-}PVR2DMISCDISPLAYINFO;
-
-
-typedef struct _PVR2DBLTINFO
-{
- PVR2D_ULONG CopyCode; /* rop code */
- PVR2D_ULONG Colour; /* fill colour */
- PVR2D_ULONG ColourKey; /* colour key argb8888 (see CKEY_ defs below) */
- PVR2D_UCHAR GlobalAlphaValue; /* global alpha blending */
- PVR2D_UCHAR AlphaBlendingFunc; /* per-pixel alpha-blending function */
-
- PVR2DBLITFLAGS BlitFlags; /* additional blit control information */
-
- PVR2DMEMINFO *pDstMemInfo; /* destination memory */
- PVR2D_ULONG DstOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */
- PVR2D_LONG DstStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
- PVR2D_LONG DstX, DstY; /* pixel offset from start of dest surface to start of blt rectangle */
- PVR2D_LONG DSizeX,DSizeY; /* blt size */
- PVR2DFORMAT DstFormat; /* dest format */
- PVR2D_ULONG DstSurfWidth; /* size of dest surface in pixels */
- PVR2D_ULONG DstSurfHeight; /* size of dest surface in pixels */
-
- PVR2DMEMINFO *pSrcMemInfo; /* source mem, (source fields are also used for patterns) */
- PVR2D_ULONG SrcOffset; /* byte offset from start of allocation to src/pat surface pixel 0,0 */
- PVR2D_LONG SrcStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
- PVR2D_LONG SrcX, SrcY; /* pixel offset from start of surface to start of source rectangle */
- /* for patterns this is the start offset within the pattern */
- PVR2D_LONG SizeX,SizeY; /* source rectangle size or pattern size in pixels */
- PVR2DFORMAT SrcFormat; /* source/pattern format */
- PVR2DMEMINFO *pPalMemInfo; /* source/pattern palette memory containing argb8888 colour table */
- PVR2D_ULONG PalOffset; /* byte offset from start of allocation to start of palette */
- PVR2D_ULONG SrcSurfWidth; /* size of source surface in pixels */
- PVR2D_ULONG SrcSurfHeight; /* size of source surface in pixels */
-
- PVR2DMEMINFO *pMaskMemInfo; /* mask memory, 1bpp format implied */
- PVR2D_ULONG MaskOffset; /* byte offset from start of allocation to mask surface pixel 0,0 */
- PVR2D_LONG MaskStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
- PVR2D_LONG MaskX, MaskY; /* mask rect top left (mask size = blt size) */
- PVR2D_ULONG MaskSurfWidth; /* size of mask surface in pixels */
- PVR2D_ULONG MaskSurfHeight; /* size of mask surface in pixels */
-
- PPVR2D_ALPHABLT pAlpha; /* fully specified alpha blend (2DCore only) */
-
- PVR2D_ULONG uSrcChromaPlane1; /* mem offset from start of source alloc to chroma plane 1 */
- PVR2D_ULONG uSrcChromaPlane2; /* mem offset from start of source alloc to chroma plane 2 */
- PVR2D_ULONG uDstChromaPlane1; /* mem offset from start of dest alloc to chroma plane 1 */
- PVR2D_ULONG uDstChromaPlane2; /* mem offset from start of dest alloc to chroma plane 2 */
-
- PVR2D_ULONG ColourKeyMask; /* 32 bit colour key mask, only valid when PVR2D_BLIT_COLKEY_MASKED is set */
-
-}PVR2DBLTINFO, *PPVR2DBLTINFO;
-
-typedef struct _PVR2DRECT
-{
- PVR2D_LONG left, top;
- PVR2D_LONG right, bottom;
-} PVR2DRECT;
-
-typedef struct
-{
- PVR2DMEMINFO *pSurfMemInfo; /* surface memory */
- PVR2D_ULONG SurfOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */
- PVR2D_LONG Stride; /* signed stride */
- PVR2DFORMAT Format; /* format */
- PVR2D_ULONG SurfWidth; /* surface width in pixels */
- PVR2D_ULONG SurfHeight; /* surface height in pixels */
-
-} PVR2D_SURFACE, *PPVR2D_SURFACE;
-
-typedef struct
-{
- PVR2D_ULONG uChromaPlane1; /* YUV multiplane - byte offset from start of alloc to chroma plane 1 */
- PVR2D_ULONG uChromaPlane2; /* YUV multiplane - byte offset from start of alloc to chroma plane 2 */
- PVR2D_LONG Reserved[2]; /* Reserved, must be zero */
-
-} PVR2D_SURFACE_EXT, *PPVR2D_SURFACE_EXT;
-
-typedef struct
-{
- PVR2D_ULONG *pUseCode; /* USSE code */
- PVR2D_ULONG UseCodeSize; /* usse code size in bytes */
-
-} PVR2D_USECODE, *PPVR2D_USECODE;
-
-typedef struct
-{
- PVR2D_SURFACE sDst; /* destination surface */
- PVR2D_SURFACE sSrc; /* source surface */
- PVR2DRECT rcDest; /* destination rectangle */
- PVR2DRECT rcSource; /* source rectangle */
- PVR2D_HANDLE hUseCode; /* custom USE code (NULL implies source copy) */
- PVR2D_ULONG UseParams[2]; /* per-blt params for use code */
-
-} PVR2D_3DBLT, *PPVR2D_3DBLT;
-
-typedef struct
-{
- PVR2D_SURFACE sDst; /* destination surface */
- PVR2DRECT rcDest; /* destination rectangle; scaling is supported */
- PVR2D_SURFACE sSrc; /* source surface */
- PVR2DRECT rcSource; /* source rectangle; scaling is supported */
- PPVR2D_SURFACE pSrc2; /* optional second source surface (NULL if not required) */
- PVR2DRECT* prcSource2; /* optional pSrc2 rectangle */
- PVR2D_HANDLE hUseCode; /* custom USSE shader code (NULL implies default source copy) */
- PVR2D_ULONG UseParams[2]; /* per-blt params for usse code */
- PVR2D_ULONG uiNumTemporaryRegisters; /* no. of temporary registers used in custom shader code */
- PVR2D_BOOL bDisableDestInput; /* set true if the destination is output only */
- PPVR2D_SURFACE_EXT pDstExt; /* Extended format params for dest */
- PPVR2D_SURFACE_EXT pSrcExt[2]; /* Extended format params for source 1 and 2 */
- PVR2D_LONG Reserved[4]; /* Reserved, must be zero */
-
-} PVR2D_3DBLT_EXT, *PPVR2D_3DBLT_EXT;
-
-
-#define MAKE_COPY_BLIT(src,soff,dest,doff,sx,sy,dx,dy,sz)
-
-typedef void* PVR2DCONTEXTHANDLE;
-typedef void* PVR2DFLIPCHAINHANDLE;
-
-
-// CopyCode field of PVR2DBLTINFO structure:
-// the CopyCode field of the PVR2DBLTINFO structure should contain a rop3 or rop4 code.
-// a rop3 is an 8 bit code that describes a blt with three inputs : source dest and pattern
-// rop4 is a 16 bit code that describes a blt with four inputs : source dest pattern and mask
-// common rop3 codes are defined below
-// a colour fill blt is processed in the pattern channel as a constant colour with a rop code of 0xF0
-// PVR2D_BLIT_PAT_SURFACE_ENABLE defines whether the pattern channel is a surface or a fill colour.
-// a rop4 is defined by two rop3 codes, and the 1 bit-per-pixel mask surface defines which is used.
-// a common rop4 is 0xAAF0 which is the mask copy blt used for text glyphs.
-// CopyCode is taken to be a rop4 when pMaskMemInfo is non zero, otherwise it is assumed to be a rop3
-// use the PVR2DMASKROP4 macro below to construct a rop4 from two rop3's
-// rop3a is the rop used when mask pixel = 1, and rop3b when mask = 0
-#define PVR2DROP4(rop3b, rop3a) ((rop3b<<8)|rop3a)
-
-/* common rop codes */
-#define PVR2DROPclear 0x00 /* 0 (whiteness) */
-#define PVR2DROPset 0xFF /* 1 (blackness) */
-#define PVR2DROPnoop 0xAA /* dst (used for masked blts) */
-
-/* source and dest rop codes */
-#define PVR2DROPand 0x88 /* src AND dst */
-#define PVR2DROPandReverse 0x44 /* src AND NOT dst */
-#define PVR2DROPcopy 0xCC /* src (used for source copy and alpha blts) */
-#define PVR2DROPandInverted 0x22 /* NOT src AND dst */
-#define PVR2DROPxor 0x66 /* src XOR dst */
-#define PVR2DROPor 0xEE /* src OR dst */
-#define PVR2DROPnor 0x11 /* NOT src AND NOT dst */
-#define PVR2DROPequiv 0x99 /* NOT src XOR dst */
-#define PVR2DROPinvert 0x55 /* NOT dst */
-#define PVR2DROPorReverse 0xDD /* src OR NOT dst */
-#define PVR2DROPcopyInverted 0x33 /* NOT src */
-#define PVR2DROPorInverted 0xBB /* NOT src OR dst */
-#define PVR2DROPnand 0x77 /* NOT src OR NOT dst */
-
-/* pattern rop codes */
-#define PVR2DPATROPand 0xA0 /* pat AND dst */
-#define PVR2DPATROPandReverse 0x50 /* pat AND NOT dst */
-#define PVR2DPATROPcopy 0xF0 /* pat (used for solid color fills and pattern blts) */
-#define PVR2DPATROPandInverted 0x0A /* NOT pat AND dst */
-#define PVR2DPATROPxor 0x5A /* pat XOR dst */
-#define PVR2DPATROPor 0xFA /* pat OR dst */
-#define PVR2DPATROPnor 0x05 /* NOT pat AND NOT dst */
-#define PVR2DPATROPequiv 0xA5 /* NOT pat XOR dst */
-#define PVR2DPATROPinvert 0x55 /* NOT dst */
-#define PVR2DPATROPorReverse 0xF5 /* pat OR NOT dst */
-#define PVR2DPATROPcopyInverted 0x0F /* NOT pat */
-#define PVR2DPATROPorInverted 0xAF /* NOT pat OR dst */
-#define PVR2DPATROPnand 0x5F /* NOT pat OR NOT dst */
-
-/* common rop4 codes */
-#define PVR2DROP4MaskedCopy PVR2DROP4(PVR2DROPnoop,PVR2DROPcopy) /* masked source copy blt (used for rounded window corners etc) */
-#define PVR2DROP4MaskedFill PVR2DROP4(PVR2DROPnoop,PVR2DPATROPcopy) /* masked colour fill blt (used for text) */
-
-/* Legacy support */
-#define PVR2DROP3_PATMASK PVR2DPATROPcopy
-#define PVR2DROP3_SRCMASK PVR2DROPcopy
-
-/* pixmap memory alignment */
-#define PVR2D_ALIGNMENT_4 4 /* DWORD alignment */
-#define PVR2D_ALIGNMENT_ANY 0 /* no alignment */
-#define PVR2D_ALIGNMENT_PALETTE 16 /* 16 byte alignment is required for palettes */
-
-/* Heap number for PVR2DGetFrameBuffer */
-#define PVR2D_FB_PRIMARY_SURFACE 0
-
-#define PVR2D_PRESENT_PROPERTY_SRCSTRIDE (1UL << 0)
-#define PVR2D_PRESENT_PROPERTY_DSTSIZE (1UL << 1)
-#define PVR2D_PRESENT_PROPERTY_DSTPOS (1UL << 2)
-#define PVR2D_PRESENT_PROPERTY_CLIPRECTS (1UL << 3)
-#define PVR2D_PRESENT_PROPERTY_INTERVAL (1UL << 4)
-
-#define PVR2D_CREATE_FLIPCHAIN_SHARED (1UL << 0)
-#define PVR2D_CREATE_FLIPCHAIN_QUERY (1UL << 1)
-#define PVR2D_CREATE_FLIPCHAIN_OEMOVERLAY (1UL << 2)
-#define PVR2D_CREATE_FLIPCHAIN_AS_BLITCHAIN (1UL << 3)
-
-/* Colour-key colour must be translated into argb8888 format */
-#define CKEY_8888(P) (P)
-#define CKEY_4444(P) (((P&0xF000UL)<<16) | ((P&0x0F00UL)<<12) | ((P&0x00F0UL)<<8) | ((P&0x000FUL)<<4))
-#define CKEY_1555(P) (((P&0x8000UL)<<16) | ((P&0x7C00UL)<<9) | ((P&0x3E0UL)<<6) | ((P&0x1FUL)<<3))
-#define CKEY_565(P) (((P&0xF800UL)<<8) | ((P&0x7E0UL)<<5) | ((P&0x1FUL)<<3))
-#define CKEY_MASK_8888 0x00FFFFFFUL
-#define CKEY_MASK_4444 0x00F0F0F0UL
-#define CKEY_MASK_1555 0x00F8F8F8UL /* Alpha is not normally included in the key test */
-#define CKEY_MASK_565 0x00F8FCF8UL
-
-/* Fill colours must be translated into argb8888 format */
-#define CFILL_4444(P) (((P&0xF000UL)<<16) | ((P&0x0F00UL)<<12) | ((P&0x00F0UL)<<8) | ((P&0x000FUL)<<4))
-#define CFILL_1555(P) (((P&0x8000UL)<<16) | ((P&0x7C00UL)<<9) | ((P&0x3E0UL)<<6) | ((P&0x1FUL)<<3))
-#define CFILL_565(P) (((P&0xF800UL)<<8) | ((P&0x7E0UL)<<5) | ((P&0x1FUL)<<3))
-
-/* PVR2DCreateDeviceContext flags */
-#define PVR2D_XSERVER_PROC 0x00000001UL /*!< Set for the Xserver connection */
-
-/* PVR2DMemAlloc flags */
-#define PVR2D_MEM_UNCACHED 0x00000000UL /* Default */
-#define PVR2D_MEM_CACHED 0x00000001UL /* Caller must flush and sync when necessary */
-#define PVR2D_MEM_WRITECOMBINE 0x00000002UL
-
-/* Functions that the library exports */
-
-PVR2D_IMPORT
-int PVR2DEnumerateDevices(PVR2DDEVICEINFO *pDevInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DCreateDeviceContext(PVR2D_ULONG ulDevID,
- PVR2DCONTEXTHANDLE* phContext,
- PVR2D_ULONG ulFlags);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DDestroyDeviceContext(PVR2DCONTEXTHANDLE hContext);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetDeviceInfo(PVR2DCONTEXTHANDLE hContext,
- PVR2DDISPLAYINFO *pDisplayInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetMiscDisplayInfo(PVR2DCONTEXTHANDLE hContext,
- PVR2DMISCDISPLAYINFO *pMiscDisplayInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetScreenMode(PVR2DCONTEXTHANDLE hContext,
- PVR2DFORMAT *pFormat,
- PVR2D_LONG *plWidth,
- PVR2D_LONG *plHeight,
- PVR2D_LONG *plStride,
- PVR2D_INT *piRefreshRate);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetFrameBuffer(PVR2DCONTEXTHANDLE hContext,
- PVR2D_INT nHeap,
- PVR2DMEMINFO **ppsMemInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DMemAlloc(PVR2DCONTEXTHANDLE hContext,
- PVR2D_ULONG ulBytes,
- PVR2D_ULONG ulAlign,
- PVR2D_ULONG ulFlags,
- PVR2DMEMINFO **ppsMemInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DMemExport(PVR2DCONTEXTHANDLE hContext,
- PVR2D_ULONG ulFlags,
- PVR2DMEMINFO *psMemInfo,
- PVR2D_HANDLE *phMemHandle);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DMemWrap(PVR2DCONTEXTHANDLE hContext,
- PVR2D_VOID *pMem,
- PVR2D_ULONG ulFlags,
- PVR2D_ULONG ulBytes,
- PVR2D_ULONG alPageAddress[],
- PVR2DMEMINFO **ppsMemInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DMemMap(PVR2DCONTEXTHANDLE hContext,
- PVR2D_ULONG ulFlags,
- PVR2D_HANDLE hMemHandle,
- PVR2DMEMINFO **ppsDstMem);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DMemFree(PVR2DCONTEXTHANDLE hContext,
- PVR2DMEMINFO *psMemInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DBlt(PVR2DCONTEXTHANDLE hContext,
- PVR2DBLTINFO *pBltInfo);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DBltClipped(PVR2DCONTEXTHANDLE hContext,
- PVR2DBLTINFO *pBltInfo,
- PVR2D_ULONG ulNumClipRects,
- PVR2DRECT *pClipRects);
-
-PVR2D_EXPORT
-PVR2DERROR PVR2DSet1555Alpha (PVR2DCONTEXTHANDLE hContext,
- PVR2D_UCHAR Alpha0, PVR2D_UCHAR Alpha1);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DQueryBlitsComplete(PVR2DCONTEXTHANDLE hContext,
- const PVR2DMEMINFO *pMemInfo,
- PVR2D_UINT uiWaitForComplete);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DSetPresentBltProperties(PVR2DCONTEXTHANDLE hContext,
- PVR2D_ULONG ulPropertyMask,
- PVR2D_LONG lSrcStride,
- PVR2D_ULONG ulDstWidth,
- PVR2D_ULONG ulDstHeight,
- PVR2D_LONG lDstXPos,
- PVR2D_LONG lDstYPos,
- PVR2D_ULONG ulNumClipRects,
- PVR2DRECT *pClipRects,
- PVR2D_ULONG ulSwapInterval);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DPresentBlt(PVR2DCONTEXTHANDLE hContext,
- PVR2DMEMINFO *pMemInfo,
- PVR2D_LONG lRenderID);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DCreateFlipChain(PVR2DCONTEXTHANDLE hContext,
- PVR2D_ULONG ulFlags,
- PVR2D_ULONG ulNumBuffers,
- PVR2D_ULONG ulWidth,
- PVR2D_ULONG ulHeight,
- PVR2DFORMAT eFormat,
- PVR2D_LONG *plStride,
- PVR2D_ULONG *pulFlipChainID,
- PVR2DFLIPCHAINHANDLE *phFlipChain);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DDestroyFlipChain(PVR2DCONTEXTHANDLE hContext,
- PVR2DFLIPCHAINHANDLE hFlipChain);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetFlipChainBuffers(PVR2DCONTEXTHANDLE hContext,
- PVR2DFLIPCHAINHANDLE hFlipChain,
- PVR2D_ULONG *pulNumBuffers,
- PVR2DMEMINFO *psMemInfo[]);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DSetPresentFlipProperties(PVR2DCONTEXTHANDLE hContext,
- PVR2DFLIPCHAINHANDLE hFlipChain,
- PVR2D_ULONG ulPropertyMask,
- PVR2D_LONG lDstXPos,
- PVR2D_LONG lDstYPos,
- PVR2D_ULONG ulNumClipRects,
- PVR2DRECT *pClipRects,
- PVR2D_ULONG ulSwapInterval);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DPresentFlip(PVR2DCONTEXTHANDLE hContext,
- PVR2DFLIPCHAINHANDLE hFlipChain,
- PVR2DMEMINFO *psMemInfo,
- PVR2D_LONG lRenderID);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DGetAPIRev(PVR2D_LONG *lRevMajor, PVR2D_LONG *lRevMinor);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DLoadUseCode (const PVR2DCONTEXTHANDLE hContext, const PVR2D_UCHAR *pUseCode,
- const PVR2D_ULONG UseCodeSize, PVR2D_HANDLE *pUseCodeHandle);
-PVR2D_IMPORT
-PVR2DERROR PVR2DFreeUseCode (const PVR2DCONTEXTHANDLE hContext, const PVR2D_HANDLE hUseCodeHandle);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DBlt3D (const PVR2DCONTEXTHANDLE hContext, const PPVR2D_3DBLT pBlt3D);
-
-PVR2D_IMPORT
-PVR2DERROR PVR2DBlt3DExt (const PVR2DCONTEXTHANDLE hContext, const PPVR2D_3DBLT_EXT pBlt3D);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _PVR2D_H_ */
-
-/******************************************************************************
- End of file (pvr2d.h)
-******************************************************************************/
diff --git a/sys/pvr2d/pvr_includes/services.h b/sys/pvr2d/pvr_includes/services.h deleted file mode 100644 index 93263a874..000000000 --- a/sys/pvr2d/pvr_includes/services.h +++ /dev/null @@ -1,1211 +0,0 @@ -/********************************************************************** - * - * Copyright (C) Imagination Technologies Ltd. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful but, except - * as otherwise stated in writing, without any warranty; without even the - * implied warranty of merchantability or fitness for a particular purpose. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * - * The full GNU General Public License is included in this distribution in - * the file called "COPYING". - * - * Contact Information: - * Imagination Technologies Ltd. <gpl-support@imgtec.com> - * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK - * - ******************************************************************************/ - -#ifndef __SERVICES_H__ -#define __SERVICES_H__ - -#if defined (__cplusplus) -extern "C" { -#endif - -#include "img_defs.h" -#include "servicesext.h" - -#define PVRSRV_4K_PAGE_SIZE 4096UL - -#define PVRSRV_MAX_CMD_SIZE 1024 - -#define PVRSRV_MAX_DEVICES 16 - -#define EVENTOBJNAME_MAXLENGTH (50) - -#define PVRSRV_MEM_READ (1U<<0) -#define PVRSRV_MEM_WRITE (1U<<1) -#define PVRSRV_MEM_CACHE_CONSISTENT (1U<<2) -#define PVRSRV_MEM_NO_SYNCOBJ (1U<<3) -#define PVRSRV_MEM_INTERLEAVED (1U<<4) -#define PVRSRV_MEM_DUMMY (1U<<5) -#define PVRSRV_MEM_EDM_PROTECT (1U<<6) -#define PVRSRV_MEM_ZERO (1U<<7) -#define PVRSRV_MEM_USER_SUPPLIED_DEVVADDR (1U<<8) -#define PVRSRV_MEM_RAM_BACKED_ALLOCATION (1U<<9) -#define PVRSRV_MEM_NO_RESMAN (1U<<10) -#define PVRSRV_MEM_EXPORTED (1U<<11) - - -#define PVRSRV_HAP_CACHED (1U<<12) -#define PVRSRV_HAP_UNCACHED (1U<<13) -#define PVRSRV_HAP_SMART (1U<<20) /* XXX could we use CACHED|UNCACHED? */ -#define PVRSRV_HAP_WRITECOMBINE (1U<<14) -#define PVRSRV_HAP_CACHETYPE_MASK (PVRSRV_HAP_CACHED|PVRSRV_HAP_UNCACHED|PVRSRV_HAP_SMART|PVRSRV_HAP_WRITECOMBINE) -#define PVRSRV_HAP_KERNEL_ONLY (1U<<15) -#define PVRSRV_HAP_SINGLE_PROCESS (1U<<16) -#define PVRSRV_HAP_MULTI_PROCESS (1U<<17) -#define PVRSRV_HAP_FROM_EXISTING_PROCESS (1U<<18) -#define PVRSRV_HAP_NO_CPU_VIRTUAL (1U<<19) -#define PVRSRV_HAP_GPU_PAGEABLE (1U<<21) -#define PVRSRV_HAP_MAPTYPE_MASK (PVRSRV_HAP_KERNEL_ONLY \ - |PVRSRV_HAP_SINGLE_PROCESS \ - |PVRSRV_HAP_MULTI_PROCESS \ - |PVRSRV_HAP_FROM_EXISTING_PROCESS \ - |PVRSRV_HAP_NO_CPU_VIRTUAL\ - |PVRSRV_HAP_GPU_PAGEABLE) - -#define PVRSRV_MEM_CACHED PVRSRV_HAP_CACHED -#define PVRSRV_MEM_UNCACHED PVRSRV_HAP_UNCACHED -#define PVRSRV_MEM_SMART PVRSRV_HAP_SMART -#define PVRSRV_MEM_WRITECOMBINE PVRSRV_HAP_WRITECOMBINE - -#define PVRSRV_MEM_BACKINGSTORE_FIELD_SHIFT (24) - -#define PVRSRV_MAP_NOUSERVIRTUAL (1UL<<27) -#define PVRSRV_MEM_XPROC (1U<<28) - -#define PVRSRV_NO_CONTEXT_LOSS 0 -#define PVRSRV_SEVERE_LOSS_OF_CONTEXT 1 -#define PVRSRV_PRE_STATE_CHANGE_MASK 0x80 - - -#define PVRSRV_DEFAULT_DEV_COOKIE (1) - - -#define PVRSRV_MISC_INFO_TIMER_PRESENT (1U<<0) -#define PVRSRV_MISC_INFO_CLOCKGATE_PRESENT (1U<<1) -#define PVRSRV_MISC_INFO_MEMSTATS_PRESENT (1U<<2) -#define PVRSRV_MISC_INFO_GLOBALEVENTOBJECT_PRESENT (1U<<3) -#define PVRSRV_MISC_INFO_DDKVERSION_PRESENT (1U<<4) -#define PVRSRV_MISC_INFO_CPUCACHEOP_PRESENT (1U<<5) -#define PVRSRV_MISC_INFO_FREEMEM_PRESENT (1U<<6) - -#define PVRSRV_MISC_INFO_RESET_PRESENT (1U<<31) - -#define PVRSRV_PDUMP_MAX_FILENAME_SIZE 20 -#define PVRSRV_PDUMP_MAX_COMMENT_SIZE 200 - - -#define PVRSRV_CHANGEDEVMEM_ATTRIBS_CACHECOHERENT 0x00000001 - -#define PVRSRV_MAPEXTMEMORY_FLAGS_ALTERNATEVA 0x00000001 -#define PVRSRV_MAPEXTMEMORY_FLAGS_PHYSCONTIG 0x00000002 - -#define PVRSRV_MODIFYSYNCOPS_FLAGS_WO_INC 0x00000001 -#define PVRSRV_MODIFYSYNCOPS_FLAGS_RO_INC 0x00000002 - -#define SRV_FLAGS_PERSIST 0x1 -#define SRV_FLAGS_PDUMP_ACTIVE 0x2 - -#define PVRSRV_PDUMP_FLAGS_CONTINUOUS 0x1 - -#define PVR_FULL_CACHE_OP_THRESHOLD (0x7D000) - -typedef enum _PVRSRV_DEVICE_TYPE_ -{ - PVRSRV_DEVICE_TYPE_UNKNOWN = 0 , - PVRSRV_DEVICE_TYPE_MBX1 = 1 , - PVRSRV_DEVICE_TYPE_MBX1_LITE = 2 , - - PVRSRV_DEVICE_TYPE_M24VA = 3, - PVRSRV_DEVICE_TYPE_MVDA2 = 4, - PVRSRV_DEVICE_TYPE_MVED1 = 5, - PVRSRV_DEVICE_TYPE_MSVDX = 6, - - PVRSRV_DEVICE_TYPE_SGX = 7, - - PVRSRV_DEVICE_TYPE_VGX = 8, - - - PVRSRV_DEVICE_TYPE_EXT = 9, - - PVRSRV_DEVICE_TYPE_LAST = 9, - - PVRSRV_DEVICE_TYPE_FORCE_I32 = 0x7fffffff - -} PVRSRV_DEVICE_TYPE; - -#define HEAP_ID( _dev_ , _dev_heap_idx_ ) ( ((_dev_)<<24) | ((_dev_heap_idx_)&((1<<24)-1)) ) -#define HEAP_IDX( _heap_id_ ) ( (_heap_id_)&((1<<24) - 1 ) ) -#define HEAP_DEV( _heap_id_ ) ( (_heap_id_)>>24 ) - -#define PVRSRV_UNDEFINED_HEAP_ID (~0LU) - -typedef enum -{ - IMG_EGL = 0x00000001, - IMG_OPENGLES1 = 0x00000002, - IMG_OPENGLES2 = 0x00000003, - IMG_D3DM = 0x00000004, - IMG_SRV_UM = 0x00000005, - IMG_OPENVG = 0x00000006, - IMG_SRVCLIENT = 0x00000007, - IMG_VISTAKMD = 0x00000008, - IMG_VISTA3DNODE = 0x00000009, - IMG_VISTAMVIDEONODE = 0x0000000A, - IMG_VISTAVPBNODE = 0x0000000B, - IMG_OPENGL = 0x0000000C, - IMG_D3D = 0x0000000D, -#if defined(SUPPORT_GRAPHICS_HAL) || defined(SUPPORT_COMPOSER_HAL) - IMG_ANDROID_HAL = 0x0000000E, -#endif -#if defined(SUPPORT_OPENCL) - IMG_OPENCL = 0x0000000F, -#endif - -} IMG_MODULE_ID; - - -#define APPHINT_MAX_STRING_SIZE 256 - -typedef enum -{ - IMG_STRING_TYPE = 1, - IMG_FLOAT_TYPE , - IMG_UINT_TYPE , - IMG_INT_TYPE , - IMG_FLAG_TYPE -}IMG_DATA_TYPE; - - -typedef struct _PVRSRV_DEV_DATA_ *PPVRSRV_DEV_DATA; - -typedef struct _PVRSRV_DEVICE_IDENTIFIER_ -{ - PVRSRV_DEVICE_TYPE eDeviceType; - PVRSRV_DEVICE_CLASS eDeviceClass; - IMG_UINT32 ui32DeviceIndex; - IMG_CHAR *pszPDumpDevName; - IMG_CHAR *pszPDumpRegName; - -} PVRSRV_DEVICE_IDENTIFIER; - - -typedef struct _PVRSRV_CLIENT_DEV_DATA_ -{ - IMG_UINT32 ui32NumDevices; - PVRSRV_DEVICE_IDENTIFIER asDevID[PVRSRV_MAX_DEVICES]; - PVRSRV_ERROR (*apfnDevConnect[PVRSRV_MAX_DEVICES])(PPVRSRV_DEV_DATA); - PVRSRV_ERROR (*apfnDumpTrace[PVRSRV_MAX_DEVICES])(PPVRSRV_DEV_DATA); - -} PVRSRV_CLIENT_DEV_DATA; - - -typedef struct _PVRSRV_CONNECTION_ -{ - IMG_HANDLE hServices; - IMG_UINT32 ui32ProcessID; - PVRSRV_CLIENT_DEV_DATA sClientDevData; - IMG_UINT32 ui32SrvFlags; -}PVRSRV_CONNECTION; - - -typedef struct _PVRSRV_DEV_DATA_ -{ - IMG_CONST PVRSRV_CONNECTION *psConnection; -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hDevCookie; -#else - IMG_HANDLE hDevCookie; -#endif - -} PVRSRV_DEV_DATA; - -typedef struct _PVRSRV_MEMUPDATE_ -{ - IMG_UINT32 ui32UpdateAddr; - IMG_UINT32 ui32UpdateVal; -} PVRSRV_MEMUPDATE; - -typedef struct _PVRSRV_HWREG_ -{ - IMG_UINT32 ui32RegAddr; - IMG_UINT32 ui32RegVal; -} PVRSRV_HWREG; - -typedef struct _PVRSRV_MEMBLK_ -{ - IMG_DEV_VIRTADDR sDevVirtAddr; - IMG_HANDLE hOSMemHandle; - IMG_HANDLE hOSWrapMem; - IMG_HANDLE hBuffer; - IMG_HANDLE hResItem; - IMG_SYS_PHYADDR *psIntSysPAddr; - -} PVRSRV_MEMBLK; - -typedef struct _PVRSRV_KERNEL_MEM_INFO_ *PPVRSRV_KERNEL_MEM_INFO; - -typedef struct _PVRSRV_CLIENT_MEM_INFO_ -{ - - IMG_PVOID pvLinAddr; - - - IMG_PVOID pvLinAddrKM; - - - IMG_DEV_VIRTADDR sDevVAddr; - - - - - - - IMG_CPU_PHYADDR sCpuPAddr; - - - IMG_UINT32 ui32Flags; - - - - - IMG_UINT32 ui32ClientFlags; - - - IMG_SIZE_T uAllocSize; - - - - struct _PVRSRV_CLIENT_SYNC_INFO_ *psClientSyncInfo; - -#if defined (SUPPORT_SID_INTERFACE) - - IMG_SID hMappingInfo; - - - IMG_SID hKernelMemInfo; - - - IMG_SID hResItem; -#else - - IMG_HANDLE hMappingInfo; - - - IMG_HANDLE hKernelMemInfo; - - - IMG_HANDLE hResItem; -#endif - -#if defined(SUPPORT_MEMINFO_IDS) - #if !defined(USE_CODE) - - IMG_UINT64 ui64Stamp; - #else - IMG_UINT32 dummy1; - IMG_UINT32 dummy2; - #endif -#endif - - - - - struct _PVRSRV_CLIENT_MEM_INFO_ *psNext; - -} PVRSRV_CLIENT_MEM_INFO, *PPVRSRV_CLIENT_MEM_INFO; - - -#define PVRSRV_MAX_CLIENT_HEAPS (32) -typedef struct _PVRSRV_HEAP_INFO_ -{ - IMG_UINT32 ui32HeapID; -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hDevMemHeap; -#else - IMG_HANDLE hDevMemHeap; -#endif - IMG_DEV_VIRTADDR sDevVAddrBase; - IMG_UINT32 ui32HeapByteSize; - IMG_UINT32 ui32Attribs; - IMG_UINT32 ui32XTileStride; -}PVRSRV_HEAP_INFO; - - - - -typedef struct _PVRSRV_EVENTOBJECT_ -{ - - IMG_CHAR szName[EVENTOBJNAME_MAXLENGTH]; - -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hOSEventKM; -#else - IMG_HANDLE hOSEventKM; -#endif - -} PVRSRV_EVENTOBJECT; - -typedef enum -{ - PVRSRV_MISC_INFO_CPUCACHEOP_NONE = 0, - PVRSRV_MISC_INFO_CPUCACHEOP_CLEAN, - PVRSRV_MISC_INFO_CPUCACHEOP_FLUSH, - PVRSRV_MISC_INFO_CPUCACHEOP_CUSTOM_FLUSH, - PVRSRV_MISC_INFO_CPUCACHEOP_CUSTOM_INV -} PVRSRV_MISC_INFO_CPUCACHEOP_TYPE; - -typedef struct _PVRSRV_MISC_INFO_ -{ - IMG_UINT32 ui32StateRequest; - IMG_UINT32 ui32StatePresent; - - - IMG_VOID *pvSOCTimerRegisterKM; - IMG_VOID *pvSOCTimerRegisterUM; -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hSOCTimerRegisterOSMemHandle; - IMG_SID hSOCTimerRegisterMappingInfo; -#else - IMG_HANDLE hSOCTimerRegisterOSMemHandle; - IMG_HANDLE hSOCTimerRegisterMappingInfo; -#endif - - - IMG_VOID *pvSOCClockGateRegs; - IMG_UINT32 ui32SOCClockGateRegsSize; - - - IMG_CHAR *pszMemoryStr; - IMG_UINT32 ui32MemoryStrLen; - - - PVRSRV_EVENTOBJECT sGlobalEventObject; -#if defined (SUPPORT_SID_INTERFACE) - IMG_EVENTSID hOSGlobalEvent; -#else - IMG_HANDLE hOSGlobalEvent; -#endif - - - IMG_UINT32 aui32DDKVersion[4]; - - - struct - { - - IMG_BOOL bDeferOp; - - - PVRSRV_MISC_INFO_CPUCACHEOP_TYPE eCacheOpType; - - -#if !defined (SUPPORT_SID_INTERFACE) - union - { - - PVRSRV_CLIENT_MEM_INFO *psClientMemInfo; - - - struct _PVRSRV_KERNEL_MEM_INFO_ *psKernelMemInfo; - } u; -#endif - - - IMG_VOID *pvBaseVAddr; - - - IMG_UINT32 ui32Length; - } sCacheOpCtl; -} PVRSRV_MISC_INFO; - -typedef struct _PVRSRV_SYNC_TOKEN_ -{ - - - struct - { -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelSyncInfo; -#else - IMG_HANDLE hKernelSyncInfo; -#endif - IMG_UINT32 ui32ReadOpsPendingSnapshot; - IMG_UINT32 ui32WriteOpsPendingSnapshot; - } sPrivate; -} PVRSRV_SYNC_TOKEN; - - -typedef enum _PVRSRV_CLIENT_EVENT_ -{ - PVRSRV_CLIENT_EVENT_HWTIMEOUT = 0, -} PVRSRV_CLIENT_EVENT; - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVClientEvent(IMG_CONST PVRSRV_CLIENT_EVENT eEvent, - PVRSRV_DEV_DATA *psDevData, - IMG_PVOID pvData); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVConnect(PVRSRV_CONNECTION **ppsConnection, IMG_UINT32 ui32SrvFlags); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVDisconnect(IMG_CONST PVRSRV_CONNECTION *psConnection); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumerateDevices(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_UINT32 *puiNumDevices, - PVRSRV_DEVICE_IDENTIFIER *puiDevIDs); -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVAcquireDeviceData(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_UINT32 uiDevIndex, - PVRSRV_DEV_DATA *psDevData, - PVRSRV_DEVICE_TYPE eDeviceType); -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVGetMiscInfo (IMG_CONST PVRSRV_CONNECTION *psConnection, PVRSRV_MISC_INFO *psMiscInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVReleaseMiscInfo (IMG_CONST PVRSRV_CONNECTION *psConnection, PVRSRV_MISC_INFO *psMiscInfo); - -#if 1 -IMG_IMPORT -IMG_UINT32 ReadHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset); - -IMG_IMPORT -IMG_VOID WriteHWReg(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Offset, IMG_UINT32 ui32Value); - -IMG_IMPORT IMG_VOID WriteHWRegs(IMG_PVOID pvLinRegBaseAddr, IMG_UINT32 ui32Count, PVRSRV_HWREG *psHWRegs); -#endif - -IMG_IMPORT -PVRSRV_ERROR PVRSRVPollForValue ( const PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hOSEvent, -#else - IMG_HANDLE hOSEvent, -#endif - volatile IMG_UINT32 *pui32LinMemAddr, - IMG_UINT32 ui32Value, - IMG_UINT32 ui32Mask, - IMG_UINT32 ui32Waitus, - IMG_UINT32 ui32Tries); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateDeviceMemContext(IMG_CONST PVRSRV_DEV_DATA *psDevData, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID *phDevMemContext, -#else - IMG_HANDLE *phDevMemContext, -#endif - IMG_UINT32 *pui32SharedHeapCount, - PVRSRV_HEAP_INFO *psHeapInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyDeviceMemContext(IMG_CONST PVRSRV_DEV_DATA *psDevData, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hDevMemContext); -#else - IMG_HANDLE hDevMemContext); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDeviceMemHeapInfo(IMG_CONST PVRSRV_DEV_DATA *psDevData, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hDevMemContext, -#else - IMG_HANDLE hDevMemContext, -#endif - IMG_UINT32 *pui32SharedHeapCount, - PVRSRV_HEAP_INFO *psHeapInfo); - -#if defined(PVRSRV_LOG_MEMORY_ALLOCS) - #define PVRSRVAllocDeviceMem_log(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo, logStr) \ - (PVR_TRACE(("PVRSRVAllocDeviceMem(" #psDevData "," #hDevMemHeap "," #ui32Attribs "," #ui32Size "," #ui32Alignment "," #ppsMemInfo ")" \ - ": " logStr " (size = 0x%lx)", ui32Size)), \ - PVRSRVAllocDeviceMem(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo)) -#else - #define PVRSRVAllocDeviceMem_log(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo, logStr) \ - PVRSRVAllocDeviceMem(psDevData, hDevMemHeap, ui32Attribs, ui32Size, ui32Alignment, ppsMemInfo) -#endif - - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocDeviceMem(IMG_CONST PVRSRV_DEV_DATA *psDevData, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hDevMemHeap, -#else - IMG_HANDLE hDevMemHeap, -#endif - IMG_UINT32 ui32Attribs, - IMG_SIZE_T ui32Size, - IMG_SIZE_T ui32Alignment, - PVRSRV_CLIENT_MEM_INFO **ppsMemInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeDeviceMem(IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVRemapToDev(IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapFromDev(IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVExportDeviceMem(IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID *phMemInfo); -#else - IMG_HANDLE *phMemInfo); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVReserveDeviceVirtualMem(IMG_CONST PVRSRV_DEV_DATA *psDevData, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hDevMemHeap, -#else - IMG_HANDLE hDevMemHeap, -#endif - IMG_DEV_VIRTADDR *psDevVAddr, - IMG_SIZE_T ui32Size, - IMG_SIZE_T ui32Alignment, - PVRSRV_CLIENT_MEM_INFO **ppsMemInfo); -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeDeviceVirtualMem(IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelMemInfo, - IMG_SID hDstDevMemHeap, -#else - IMG_HANDLE hKernelMemInfo, - IMG_HANDLE hDstDevMemHeap, -#endif - PVRSRV_CLIENT_MEM_INFO **ppsDstMemInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapDeviceMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVMapExtMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo, - IMG_SYS_PHYADDR *psSysPAddr, - IMG_UINT32 ui32Flags); -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapExtMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo, - IMG_UINT32 ui32Flags); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVWrapExtMemory(IMG_CONST PVRSRV_DEV_DATA *psDevData, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hDevMemContext, -#else - IMG_HANDLE hDevMemContext, -#endif - IMG_SIZE_T ui32ByteSize, - IMG_SIZE_T ui32PageOffset, - IMG_BOOL bPhysContig, - IMG_SYS_PHYADDR *psSysPAddr, - IMG_VOID *pvLinAddr, - IMG_UINT32 ui32Flags, - PVRSRV_CLIENT_MEM_INFO **ppsMemInfo); -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVUnwrapExtMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo); - -PVRSRV_ERROR PVRSRVChangeDeviceMemoryAttributes(IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psClientMemInfo, - IMG_UINT32 ui32Attribs); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceClassMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hDevMemContext, - IMG_SID hDeviceClassBuffer, -#else - IMG_HANDLE hDevMemContext, - IMG_HANDLE hDeviceClassBuffer, -#endif - PVRSRV_CLIENT_MEM_INFO **ppsMemInfo); -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapDeviceClassMemory (IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVMapPhysToUserSpace(IMG_CONST PVRSRV_DEV_DATA *psDevData, - IMG_SYS_PHYADDR sSysPhysAddr, - IMG_UINT32 uiSizeInBytes, - IMG_PVOID *ppvUserAddr, - IMG_UINT32 *puiActualSize, - IMG_PVOID *ppvProcess); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVUnmapPhysToUserSpace(IMG_CONST PVRSRV_DEV_DATA *psDevData, - IMG_PVOID pvUserAddr, - IMG_PVOID pvProcess); - -#if defined(LINUX) -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVExportDeviceMem2(IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_MEM_INFO *psMemInfo, - IMG_INT *iFd); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVMapDeviceMemory2(IMG_CONST PVRSRV_DEV_DATA *psDevData, - IMG_INT iFd, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hDstDevMemHeap, -#else - IMG_HANDLE hDstDevMemHeap, -#endif - PVRSRV_CLIENT_MEM_INFO **ppsDstMemInfo); -#endif - -typedef enum _PVRSRV_SYNCVAL_MODE_ -{ - PVRSRV_SYNCVAL_READ = IMG_TRUE, - PVRSRV_SYNCVAL_WRITE = IMG_FALSE, - -} PVRSRV_SYNCVAL_MODE, *PPVRSRV_SYNCVAL_MODE; - -typedef IMG_UINT32 PVRSRV_SYNCVAL; - -IMG_IMPORT PVRSRV_ERROR PVRSRVWaitForOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo, - PVRSRV_SYNCVAL_MODE eMode, PVRSRV_SYNCVAL OpRequired); - -IMG_IMPORT PVRSRV_ERROR PVRSRVWaitForAllOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo, - PVRSRV_SYNCVAL_MODE eMode); - -IMG_IMPORT IMG_BOOL PVRSRVTestOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo, - PVRSRV_SYNCVAL_MODE eMode, PVRSRV_SYNCVAL OpRequired); - -IMG_IMPORT IMG_BOOL PVRSRVTestAllOpsComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo, - PVRSRV_SYNCVAL_MODE eMode); - -IMG_IMPORT IMG_BOOL PVRSRVTestOpsNotComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo, - PVRSRV_SYNCVAL_MODE eMode, PVRSRV_SYNCVAL OpRequired); - -IMG_IMPORT IMG_BOOL PVRSRVTestAllOpsNotComplete(PPVRSRV_CLIENT_MEM_INFO psMemInfo, - PVRSRV_SYNCVAL_MODE eMode); - -IMG_IMPORT PVRSRV_SYNCVAL PVRSRVGetPendingOpSyncVal(PPVRSRV_CLIENT_MEM_INFO psMemInfo, - PVRSRV_SYNCVAL_MODE eMode); - - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumerateDeviceClass(IMG_CONST PVRSRV_CONNECTION *psConnection, - PVRSRV_DEVICE_CLASS DeviceClass, - IMG_UINT32 *pui32DevCount, - IMG_UINT32 *pui32DevID); - -IMG_IMPORT -IMG_HANDLE IMG_CALLCONV PVRSRVOpenDCDevice(IMG_CONST PVRSRV_DEV_DATA *psDevData, - IMG_UINT32 ui32DeviceID); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVCloseDCDevice(IMG_CONST PVRSRV_CONNECTION *psConnection, IMG_HANDLE hDevice); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumDCFormats (IMG_HANDLE hDevice, - IMG_UINT32 *pui32Count, - DISPLAY_FORMAT *psFormat); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVEnumDCDims (IMG_HANDLE hDevice, - IMG_UINT32 *pui32Count, - DISPLAY_FORMAT *psFormat, - DISPLAY_DIMS *psDims); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDCSystemBuffer(IMG_HANDLE hDevice, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID *phBuffer); -#else - IMG_HANDLE *phBuffer); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDCInfo(IMG_HANDLE hDevice, - DISPLAY_INFO* psDisplayInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateDCSwapChain (IMG_HANDLE hDevice, - IMG_UINT32 ui32Flags, - DISPLAY_SURF_ATTRIBUTES *psDstSurfAttrib, - DISPLAY_SURF_ATTRIBUTES *psSrcSurfAttrib, - IMG_UINT32 ui32BufferCount, - IMG_UINT32 ui32OEMFlags, - IMG_UINT32 *pui32SwapChainID, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID *phSwapChain); -#else - IMG_HANDLE *phSwapChain); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyDCSwapChain (IMG_HANDLE hDevice, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hSwapChain); -#else - IMG_HANDLE hSwapChain); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCDstRect (IMG_HANDLE hDevice, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hSwapChain, -#else - IMG_HANDLE hSwapChain, -#endif - IMG_RECT *psDstRect); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCSrcRect (IMG_HANDLE hDevice, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hSwapChain, -#else - IMG_HANDLE hSwapChain, -#endif - IMG_RECT *psSrcRect); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCDstColourKey (IMG_HANDLE hDevice, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hSwapChain, -#else - IMG_HANDLE hSwapChain, -#endif - IMG_UINT32 ui32CKColour); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVSetDCSrcColourKey (IMG_HANDLE hDevice, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hSwapChain, -#else - IMG_HANDLE hSwapChain, -#endif - IMG_UINT32 ui32CKColour); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVGetDCBuffers(IMG_HANDLE hDevice, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hSwapChain, - IMG_SID *phBuffer); -#else - IMG_HANDLE hSwapChain, - IMG_HANDLE *phBuffer); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVSwapToDCBuffer (IMG_HANDLE hDevice, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hBuffer, -#else - IMG_HANDLE hBuffer, -#endif - IMG_UINT32 ui32ClipRectCount, - IMG_RECT *psClipRect, - IMG_UINT32 ui32SwapInterval, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hPrivateTag); -#else - IMG_HANDLE hPrivateTag); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVSwapToDCSystem (IMG_HANDLE hDevice, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hSwapChain); -#else - IMG_HANDLE hSwapChain); -#endif - - -IMG_IMPORT -IMG_HANDLE IMG_CALLCONV PVRSRVOpenBCDevice(IMG_CONST PVRSRV_DEV_DATA *psDevData, - IMG_UINT32 ui32DeviceID); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVCloseBCDevice(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_HANDLE hDevice); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVGetBCBufferInfo(IMG_HANDLE hDevice, - BUFFER_INFO *psBuffer); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVGetBCBuffer(IMG_HANDLE hDevice, - IMG_UINT32 ui32BufferIndex, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID *phBuffer); -#else - IMG_HANDLE *phBuffer); -#endif - - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpInit(IMG_CONST PVRSRV_CONNECTION *psConnection); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpStartInitPhase(IMG_CONST PVRSRV_CONNECTION *psConnection); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpStopInitPhase(IMG_CONST PVRSRV_CONNECTION *psConnection); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSyncPol(IMG_CONST PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelSyncInfo, -#else - PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo, -#endif - IMG_BOOL bIsRead, - IMG_UINT32 ui32Value, - IMG_UINT32 ui32Mask); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSyncPol2(IMG_CONST PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelSyncInfo, -#else - PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo, -#endif - IMG_BOOL bIsRead); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpMem(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_PVOID pvAltLinAddr, - PVRSRV_CLIENT_MEM_INFO *psMemInfo, - IMG_UINT32 ui32Offset, - IMG_UINT32 ui32Bytes, - IMG_UINT32 ui32Flags); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSync(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_PVOID pvAltLinAddr, - PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo, - IMG_UINT32 ui32Offset, - IMG_UINT32 ui32Bytes); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpReg(IMG_CONST PVRSRV_DEV_DATA *psDevData, - IMG_CHAR *pszRegRegion, - IMG_UINT32 ui32RegAddr, - IMG_UINT32 ui32RegValue, - IMG_UINT32 ui32Flags); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpRegPolWithFlags(const PVRSRV_DEV_DATA *psDevData, - IMG_CHAR *pszRegRegion, - IMG_UINT32 ui32RegAddr, - IMG_UINT32 ui32RegValue, - IMG_UINT32 ui32Mask, - IMG_UINT32 ui32Flags); -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpRegPol(const PVRSRV_DEV_DATA *psDevData, - IMG_CHAR *pszRegRegion, - IMG_UINT32 ui32RegAddr, - IMG_UINT32 ui32RegValue, - IMG_UINT32 ui32Mask); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpPDReg(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_UINT32 ui32RegAddr, - IMG_UINT32 ui32RegValue); -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpPDDevPAddr(IMG_CONST PVRSRV_CONNECTION *psConnection, - PVRSRV_CLIENT_MEM_INFO *psMemInfo, - IMG_UINT32 ui32Offset, - IMG_DEV_PHYADDR sPDDevPAddr); - -#if !defined(USE_CODE) -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpMemPages(IMG_CONST PVRSRV_DEV_DATA *psDevData, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelMemInfo, -#else - IMG_HANDLE hKernelMemInfo, -#endif - IMG_DEV_PHYADDR *pPages, - IMG_UINT32 ui32NumPages, - IMG_DEV_VIRTADDR sDevVAddr, - IMG_UINT32 ui32Start, - IMG_UINT32 ui32Length, - IMG_UINT32 ui32Flags); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpSetFrame(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_UINT32 ui32Frame); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpComment(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_CONST IMG_CHAR *pszComment, - IMG_BOOL bContinuous); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpCommentf(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_BOOL bContinuous, - IMG_CONST IMG_CHAR *pszFormat, ...) -#if !defined(USE_CODE) - IMG_FORMAT_PRINTF(3, 4) -#endif -; - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpCommentWithFlagsf(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_UINT32 ui32Flags, - IMG_CONST IMG_CHAR *pszFormat, ...) -#if !defined(USE_CODE) - IMG_FORMAT_PRINTF(3, 4) -#endif -; - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpDriverInfo(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_CHAR *pszString, - IMG_BOOL bContinuous); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpIsCapturing(IMG_CONST PVRSRV_CONNECTION *psConnection, - IMG_BOOL *pbIsCapturing); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpRegRead(IMG_CONST PVRSRV_DEV_DATA *psDevData, - IMG_CONST IMG_CHAR *pszRegRegion, - IMG_CONST IMG_CHAR *pszFileName, - IMG_UINT32 ui32FileOffset, - IMG_UINT32 ui32Address, - IMG_UINT32 ui32Size, - IMG_UINT32 ui32PDumpFlags); - - -IMG_IMPORT -IMG_BOOL IMG_CALLCONV PVRSRVPDumpIsCapturingTest(IMG_CONST PVRSRV_CONNECTION *psConnection); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpCycleCountRegRead(IMG_CONST PVRSRV_DEV_DATA *psDevData, - IMG_UINT32 ui32RegOffset, - IMG_BOOL bLastFrame); - -IMG_IMPORT IMG_HANDLE PVRSRVLoadLibrary(const IMG_CHAR *pszLibraryName); -IMG_IMPORT PVRSRV_ERROR PVRSRVUnloadLibrary(IMG_HANDLE hExtDrv); -IMG_IMPORT PVRSRV_ERROR PVRSRVGetLibFuncAddr(IMG_HANDLE hExtDrv, const IMG_CHAR *pszFunctionName, IMG_VOID **ppvFuncAddr); - -IMG_IMPORT IMG_UINT32 PVRSRVClockus (void); -IMG_IMPORT IMG_VOID PVRSRVWaitus (IMG_UINT32 ui32Timeus); -IMG_IMPORT IMG_VOID PVRSRVReleaseThreadQuanta (void); -IMG_IMPORT IMG_UINT32 IMG_CALLCONV PVRSRVGetCurrentProcessID(void); -IMG_IMPORT IMG_CHAR * IMG_CALLCONV PVRSRVSetLocale(const IMG_CHAR *pszLocale); - - - - - -IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVCreateAppHintState(IMG_MODULE_ID eModuleID, - const IMG_CHAR *pszAppName, - IMG_VOID **ppvState); -IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVFreeAppHintState(IMG_MODULE_ID eModuleID, - IMG_VOID *pvHintState); - -IMG_IMPORT IMG_BOOL IMG_CALLCONV PVRSRVGetAppHint(IMG_VOID *pvHintState, - const IMG_CHAR *pszHintName, - IMG_DATA_TYPE eDataType, - const IMG_VOID *pvDefault, - IMG_VOID *pvReturn); - -IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVAllocUserModeMem (IMG_SIZE_T ui32Size); -IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVCallocUserModeMem (IMG_SIZE_T ui32Size); -IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVReallocUserModeMem (IMG_PVOID pvBase, IMG_SIZE_T uNewSize); -IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVFreeUserModeMem (IMG_PVOID pvMem); -IMG_IMPORT IMG_VOID PVRSRVMemCopy(IMG_VOID *pvDst, const IMG_VOID *pvSrc, IMG_SIZE_T ui32Size); -IMG_IMPORT IMG_VOID PVRSRVMemSet(IMG_VOID *pvDest, IMG_UINT8 ui8Value, IMG_SIZE_T ui32Size); - -struct _PVRSRV_MUTEX_OPAQUE_STRUCT_; -typedef struct _PVRSRV_MUTEX_OPAQUE_STRUCT_ *PVRSRV_MUTEX_HANDLE; - -IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateMutex(PVRSRV_MUTEX_HANDLE *phMutex); -IMG_IMPORT PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyMutex(PVRSRV_MUTEX_HANDLE hMutex); -IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVLockMutex(PVRSRV_MUTEX_HANDLE hMutex); -IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVUnlockMutex(PVRSRV_MUTEX_HANDLE hMutex); - -IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVLockProcessGlobalMutex(void); -IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVUnlockProcessGlobalMutex(void); - - -struct _PVRSRV_SEMAPHORE_OPAQUE_STRUCT_; -typedef struct _PVRSRV_SEMAPHORE_OPAQUE_STRUCT_ *PVRSRV_SEMAPHORE_HANDLE; - - - #define IMG_SEMAPHORE_WAIT_INFINITE ((IMG_UINT64)0xFFFFFFFFFFFFFFFFull) - - -#if !defined(USE_CODE) - -#ifdef INLINE_IS_PRAGMA -#pragma inline(PVRSRVCreateSemaphore) -#endif -static INLINE PVRSRV_ERROR PVRSRVCreateSemaphore(PVRSRV_SEMAPHORE_HANDLE *phSemaphore, IMG_INT iInitialCount) -{ - PVR_UNREFERENCED_PARAMETER(iInitialCount); - *phSemaphore = 0; - return PVRSRV_OK; -} - -#ifdef INLINE_IS_PRAGMA -#pragma inline(PVRSRVDestroySemaphore) -#endif -static INLINE PVRSRV_ERROR PVRSRVDestroySemaphore(PVRSRV_SEMAPHORE_HANDLE hSemaphore) -{ - PVR_UNREFERENCED_PARAMETER(hSemaphore); - return PVRSRV_OK; -} - -#ifdef INLINE_IS_PRAGMA -#pragma inline(PVRSRVWaitSemaphore) -#endif -static INLINE PVRSRV_ERROR PVRSRVWaitSemaphore(PVRSRV_SEMAPHORE_HANDLE hSemaphore, IMG_UINT64 ui64TimeoutMicroSeconds) -{ - PVR_UNREFERENCED_PARAMETER(hSemaphore); - PVR_UNREFERENCED_PARAMETER(ui64TimeoutMicroSeconds); - return PVRSRV_ERROR_INVALID_PARAMS; -} - -#ifdef INLINE_IS_PRAGMA -#pragma inline(PVRSRVPostSemaphore) -#endif -static INLINE IMG_VOID PVRSRVPostSemaphore(PVRSRV_SEMAPHORE_HANDLE hSemaphore, IMG_INT iPostCount) -{ - PVR_UNREFERENCED_PARAMETER(hSemaphore); - PVR_UNREFERENCED_PARAMETER(iPostCount); -} - -#endif - - -#if (defined(DEBUG) && defined(__linux__)) -IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVAllocUserModeMemTracking(IMG_SIZE_T ui32Size, IMG_CHAR *pszFileName, IMG_UINT32 ui32LineNumber); - -IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVCallocUserModeMemTracking(IMG_SIZE_T ui32Size, IMG_CHAR *pszFileName, IMG_UINT32 ui32LineNumber); - -IMG_IMPORT IMG_VOID IMG_CALLCONV PVRSRVFreeUserModeMemTracking(IMG_VOID *pvMem); - -IMG_IMPORT IMG_PVOID IMG_CALLCONV PVRSRVReallocUserModeMemTracking(IMG_VOID *pvMem, IMG_SIZE_T ui32NewSize, - IMG_CHAR *pszFileName, IMG_UINT32 ui32LineNumber); -#endif - -IMG_IMPORT PVRSRV_ERROR PVRSRVEventObjectWait(const PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - IMG_EVENTSID hOSEvent); -#else - IMG_HANDLE hOSEvent); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateSyncInfoModObj(const PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID *phKernelSyncInfoModObj); -#else - IMG_HANDLE *phKernelSyncInfoModObj); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroySyncInfoModObj(const PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelSyncInfoModObj); -#else - IMG_HANDLE hKernelSyncInfoModObj); -#endif - - - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVModifyPendingSyncOps(const PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelSyncInfoModObj, -#else - IMG_HANDLE hKernelSyncInfoModObj, -#endif - PVRSRV_CLIENT_SYNC_INFO *psSyncInfo, - IMG_UINT32 ui32ModifyFlags, - IMG_UINT32 *pui32ReadOpsPending, - IMG_UINT32 *pui32WriteOpsPending); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVModifyCompleteSyncOps(const PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelSyncInfoModObj); -#else - IMG_HANDLE hKernelSyncInfoModObj); -#endif - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsTakeToken(const PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - const IMG_SID hKernelSyncInfo, -#else - const PVRSRV_CLIENT_SYNC_INFO *psSyncInfo, -#endif - PVRSRV_SYNC_TOKEN *psSyncToken); -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsFlushToToken(const PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - const IMG_SID hKernelSyncInfo, -#else - const PVRSRV_CLIENT_SYNC_INFO *psSyncInfo, -#endif - const PVRSRV_SYNC_TOKEN *psSyncToken, - IMG_BOOL bWait); -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsFlushToModObj(const PVRSRV_CONNECTION *psConnection, -#if defined (SUPPORT_SID_INTERFACE) - IMG_SID hKernelSyncInfoModObj, -#else - IMG_HANDLE hKernelSyncInfoModObj, -#endif - IMG_BOOL bWait); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVSyncOpsFlushToDelta(const PVRSRV_CONNECTION *psConnection, - PVRSRV_CLIENT_SYNC_INFO *psClientSyncInfo, - IMG_UINT32 ui32Delta, - IMG_BOOL bWait); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVAllocSyncInfo(IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_SYNC_INFO **ppsSyncInfo); - -IMG_IMPORT -PVRSRV_ERROR IMG_CALLCONV PVRSRVFreeSyncInfo(IMG_CONST PVRSRV_DEV_DATA *psDevData, - PVRSRV_CLIENT_SYNC_INFO *psSyncInfo); - -IMG_IMPORT -const IMG_CHAR *PVRSRVGetErrorString(PVRSRV_ERROR eError); - - -#define TIME_NOT_PASSED_UINT32(a,b,c) (((a) - (b)) < (c)) - -#if defined (__cplusplus) -} -#endif -#endif - diff --git a/sys/pvr2d/pvr_includes/servicesext.h b/sys/pvr2d/pvr_includes/servicesext.h deleted file mode 100644 index d32624511..000000000 --- a/sys/pvr2d/pvr_includes/servicesext.h +++ /dev/null @@ -1,855 +0,0 @@ -/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
-* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-#if !defined (__SERVICESEXT_H__)
-#define __SERVICESEXT_H__
-
-#define PVRSRV_LOCKFLG_READONLY (1)
-
-typedef enum _PVRSRV_ERROR_
-{
- PVRSRV_OK = 0,
- PVRSRV_ERROR_OUT_OF_MEMORY,
- PVRSRV_ERROR_TOO_FEW_BUFFERS,
- PVRSRV_ERROR_INVALID_PARAMS,
- PVRSRV_ERROR_INIT_FAILURE,
- PVRSRV_ERROR_CANT_REGISTER_CALLBACK,
- PVRSRV_ERROR_INVALID_DEVICE,
- PVRSRV_ERROR_NOT_OWNER,
- PVRSRV_ERROR_BAD_MAPPING,
- PVRSRV_ERROR_TIMEOUT,
- PVRSRV_ERROR_FLIP_CHAIN_EXISTS,
- PVRSRV_ERROR_INVALID_SWAPINTERVAL,
- PVRSRV_ERROR_SCENE_INVALID,
- PVRSRV_ERROR_STREAM_ERROR,
- PVRSRV_ERROR_FAILED_DEPENDENCIES,
- PVRSRV_ERROR_CMD_NOT_PROCESSED,
- PVRSRV_ERROR_CMD_TOO_BIG,
- PVRSRV_ERROR_DEVICE_REGISTER_FAILED,
- PVRSRV_ERROR_TOOMANYBUFFERS,
- PVRSRV_ERROR_NOT_SUPPORTED,
- PVRSRV_ERROR_PROCESSING_BLOCKED,
-
- PVRSRV_ERROR_CANNOT_FLUSH_QUEUE,
- PVRSRV_ERROR_CANNOT_GET_QUEUE_SPACE,
- PVRSRV_ERROR_CANNOT_GET_RENDERDETAILS,
- PVRSRV_ERROR_RETRY,
-
- PVRSRV_ERROR_DDK_VERSION_MISMATCH,
- PVRSRV_ERROR_BUILD_MISMATCH,
- PVRSRV_ERROR_CORE_REVISION_MISMATCH,
-
- PVRSRV_ERROR_UPLOAD_TOO_BIG,
-
- PVRSRV_ERROR_INVALID_FLAGS,
- PVRSRV_ERROR_FAILED_TO_REGISTER_PROCESS,
-
- PVRSRV_ERROR_UNABLE_TO_LOAD_LIBRARY,
- PVRSRV_ERROR_UNABLE_GET_FUNC_ADDR,
- PVRSRV_ERROR_UNLOAD_LIBRARY_FAILED,
-
- PVRSRV_ERROR_BRIDGE_CALL_FAILED,
- PVRSRV_ERROR_IOCTL_CALL_FAILED,
-
- PVRSRV_ERROR_MMU_CONTEXT_NOT_FOUND,
- PVRSRV_ERROR_BUFFER_DEVICE_NOT_FOUND,
- PVRSRV_ERROR_BUFFER_DEVICE_ALREADY_PRESENT,
-
- PVRSRV_ERROR_PCI_DEVICE_NOT_FOUND,
- PVRSRV_ERROR_PCI_CALL_FAILED,
- PVRSRV_ERROR_PCI_REGION_TOO_SMALL,
- PVRSRV_ERROR_PCI_REGION_UNAVAILABLE,
- PVRSRV_ERROR_BAD_REGION_SIZE_MISMATCH,
-
- PVRSRV_ERROR_REGISTER_BASE_NOT_SET,
-
- PVRSRV_ERROR_FAILED_TO_ALLOC_USER_MEM,
- PVRSRV_ERROR_FAILED_TO_ALLOC_VP_MEMORY,
- PVRSRV_ERROR_FAILED_TO_MAP_SHARED_PBDESC,
- PVRSRV_ERROR_FAILED_TO_GET_PHYS_ADDR,
-
- PVRSRV_ERROR_FAILED_TO_ALLOC_VIRT_MEMORY,
- PVRSRV_ERROR_FAILED_TO_COPY_VIRT_MEMORY,
-
- PVRSRV_ERROR_FAILED_TO_ALLOC_PAGES,
- PVRSRV_ERROR_FAILED_TO_FREE_PAGES,
- PVRSRV_ERROR_FAILED_TO_COPY_PAGES,
- PVRSRV_ERROR_UNABLE_TO_LOCK_PAGES,
- PVRSRV_ERROR_UNABLE_TO_UNLOCK_PAGES,
- PVRSRV_ERROR_STILL_MAPPED,
- PVRSRV_ERROR_MAPPING_NOT_FOUND,
- PVRSRV_ERROR_PHYS_ADDRESS_EXCEEDS_32BIT,
- PVRSRV_ERROR_FAILED_TO_MAP_PAGE_TABLE,
-
- PVRSRV_ERROR_INVALID_SEGMENT_BLOCK,
- PVRSRV_ERROR_INVALID_SGXDEVDATA,
- PVRSRV_ERROR_INVALID_DEVINFO,
- PVRSRV_ERROR_INVALID_MEMINFO,
- PVRSRV_ERROR_INVALID_MISCINFO,
- PVRSRV_ERROR_UNKNOWN_IOCTL,
- PVRSRV_ERROR_INVALID_CONTEXT,
- PVRSRV_ERROR_UNABLE_TO_DESTROY_CONTEXT,
- PVRSRV_ERROR_INVALID_HEAP,
- PVRSRV_ERROR_INVALID_KERNELINFO,
- PVRSRV_ERROR_UNKNOWN_POWER_STATE,
- PVRSRV_ERROR_INVALID_HANDLE_TYPE,
- PVRSRV_ERROR_INVALID_WRAP_TYPE,
- PVRSRV_ERROR_INVALID_PHYS_ADDR,
- PVRSRV_ERROR_INVALID_CPU_ADDR,
- PVRSRV_ERROR_INVALID_HEAPINFO,
- PVRSRV_ERROR_INVALID_PERPROC,
- PVRSRV_ERROR_FAILED_TO_RETRIEVE_HEAPINFO,
- PVRSRV_ERROR_INVALID_MAP_REQUEST,
- PVRSRV_ERROR_INVALID_UNMAP_REQUEST,
- PVRSRV_ERROR_UNABLE_TO_FIND_MAPPING_HEAP,
- PVRSRV_ERROR_MAPPING_STILL_IN_USE,
-
- PVRSRV_ERROR_EXCEEDED_HW_LIMITS,
- PVRSRV_ERROR_NO_STAGING_BUFFER_ALLOCATED,
-
- PVRSRV_ERROR_UNABLE_TO_CREATE_PERPROC_AREA,
- PVRSRV_ERROR_UNABLE_TO_CREATE_EVENT,
- PVRSRV_ERROR_UNABLE_TO_ENABLE_EVENT,
- PVRSRV_ERROR_UNABLE_TO_REGISTER_EVENT,
- PVRSRV_ERROR_UNABLE_TO_DESTROY_EVENT,
- PVRSRV_ERROR_UNABLE_TO_CREATE_THREAD,
- PVRSRV_ERROR_UNABLE_TO_CLOSE_THREAD,
- PVRSRV_ERROR_THREAD_READ_ERROR,
- PVRSRV_ERROR_UNABLE_TO_REGISTER_ISR_HANDLER,
- PVRSRV_ERROR_UNABLE_TO_INSTALL_ISR,
- PVRSRV_ERROR_UNABLE_TO_UNINSTALL_ISR,
- PVRSRV_ERROR_ISR_ALREADY_INSTALLED,
- PVRSRV_ERROR_ISR_NOT_INSTALLED,
- PVRSRV_ERROR_UNABLE_TO_INITIALISE_INTERRUPT,
- PVRSRV_ERROR_UNABLE_TO_RETRIEVE_INFO,
- PVRSRV_ERROR_UNABLE_TO_DO_BACKWARDS_BLIT,
- PVRSRV_ERROR_UNABLE_TO_CLOSE_SERVICES,
- PVRSRV_ERROR_UNABLE_TO_REGISTER_CONTEXT,
- PVRSRV_ERROR_UNABLE_TO_REGISTER_RESOURCE,
-
- PVRSRV_ERROR_INVALID_CCB_COMMAND,
-
- PVRSRV_ERROR_UNABLE_TO_LOCK_RESOURCE,
- PVRSRV_ERROR_INVALID_LOCK_ID,
- PVRSRV_ERROR_RESOURCE_NOT_LOCKED,
-
- PVRSRV_ERROR_FLIP_FAILED,
- PVRSRV_ERROR_UNBLANK_DISPLAY_FAILED,
-
- PVRSRV_ERROR_TIMEOUT_POLLING_FOR_VALUE,
-
- PVRSRV_ERROR_CREATE_RENDER_CONTEXT_FAILED,
- PVRSRV_ERROR_UNKNOWN_PRIMARY_FRAG,
- PVRSRV_ERROR_UNEXPECTED_SECONDARY_FRAG,
- PVRSRV_ERROR_UNEXPECTED_PRIMARY_FRAG,
-
- PVRSRV_ERROR_UNABLE_TO_INSERT_FENCE_ID,
-
- PVRSRV_ERROR_BLIT_SETUP_FAILED,
-
- PVRSRV_ERROR_PDUMP_NOT_AVAILABLE,
- PVRSRV_ERROR_PDUMP_BUFFER_FULL,
- PVRSRV_ERROR_PDUMP_BUF_OVERFLOW,
- PVRSRV_ERROR_PDUMP_NOT_ACTIVE,
- PVRSRV_ERROR_INCOMPLETE_LINE_OVERLAPS_PAGES,
-
- PVRSRV_ERROR_MUTEX_DESTROY_FAILED,
- PVRSRV_ERROR_MUTEX_INTERRUPTIBLE_ERROR,
-
- PVRSRV_ERROR_INSUFFICIENT_SCRIPT_SPACE,
- PVRSRV_ERROR_INSUFFICIENT_SPACE_FOR_COMMAND,
-
- PVRSRV_ERROR_PROCESS_NOT_INITIALISED,
- PVRSRV_ERROR_PROCESS_NOT_FOUND,
- PVRSRV_ERROR_SRV_CONNECT_FAILED,
- PVRSRV_ERROR_SRV_DISCONNECT_FAILED,
- PVRSRV_ERROR_DEINT_PHASE_FAILED,
- PVRSRV_ERROR_INIT2_PHASE_FAILED,
-
- PVRSRV_ERROR_UNABLE_TO_FIND_RESOURCE,
-
- PVRSRV_ERROR_NO_DC_DEVICES_FOUND,
- PVRSRV_ERROR_UNABLE_TO_OPEN_DC_DEVICE,
- PVRSRV_ERROR_UNABLE_TO_REMOVE_DEVICE,
- PVRSRV_ERROR_NO_DEVICEDATA_FOUND,
- PVRSRV_ERROR_NO_DEVICENODE_FOUND,
- PVRSRV_ERROR_NO_CLIENTNODE_FOUND,
- PVRSRV_ERROR_FAILED_TO_PROCESS_QUEUE,
-
- PVRSRV_ERROR_UNABLE_TO_INIT_TASK,
- PVRSRV_ERROR_UNABLE_TO_SCHEDULE_TASK,
- PVRSRV_ERROR_UNABLE_TO_KILL_TASK,
-
- PVRSRV_ERROR_UNABLE_TO_ENABLE_TIMER,
- PVRSRV_ERROR_UNABLE_TO_DISABLE_TIMER,
- PVRSRV_ERROR_UNABLE_TO_REMOVE_TIMER,
-
- PVRSRV_ERROR_UNKNOWN_PIXEL_FORMAT,
- PVRSRV_ERROR_UNKNOWN_SCRIPT_OPERATION,
-
- PVRSRV_ERROR_HANDLE_INDEX_OUT_OF_RANGE,
- PVRSRV_ERROR_HANDLE_NOT_ALLOCATED,
- PVRSRV_ERROR_HANDLE_TYPE_MISMATCH,
- PVRSRV_ERROR_UNABLE_TO_ADD_HANDLE,
- PVRSRV_ERROR_HANDLE_NOT_SHAREABLE,
- PVRSRV_ERROR_HANDLE_NOT_FOUND,
- PVRSRV_ERROR_INVALID_SUBHANDLE,
- PVRSRV_ERROR_HANDLE_BATCH_IN_USE,
- PVRSRV_ERROR_HANDLE_BATCH_COMMIT_FAILURE,
-
- PVRSRV_ERROR_UNABLE_TO_CREATE_HASH_TABLE,
- PVRSRV_ERROR_INSERT_HASH_TABLE_DATA_FAILED,
-
- PVRSRV_ERROR_UNSUPPORTED_BACKING_STORE,
- PVRSRV_ERROR_UNABLE_TO_DESTROY_BM_HEAP,
-
- PVRSRV_ERROR_UNKNOWN_INIT_SERVER_STATE,
-
- PVRSRV_ERROR_NO_FREE_DEVICEIDS_AVALIABLE,
- PVRSRV_ERROR_INVALID_DEVICEID,
- PVRSRV_ERROR_DEVICEID_NOT_FOUND,
-
- PVRSRV_ERROR_MEMORY_TEST_FAILED,
- PVRSRV_ERROR_CPUPADDR_TEST_FAILED,
- PVRSRV_ERROR_COPY_TEST_FAILED,
-
- PVRSRV_ERROR_SEMAPHORE_NOT_INITIALISED,
-
- PVRSRV_ERROR_UNABLE_TO_RELEASE_CLOCK,
- PVRSRV_ERROR_CLOCK_REQUEST_FAILED,
- PVRSRV_ERROR_DISABLE_CLOCK_FAILURE,
- PVRSRV_ERROR_UNABLE_TO_SET_CLOCK_RATE,
- PVRSRV_ERROR_UNABLE_TO_ROUND_CLOCK_RATE,
- PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK,
- PVRSRV_ERROR_UNABLE_TO_GET_CLOCK,
- PVRSRV_ERROR_UNABLE_TO_GET_PARENT_CLOCK,
- PVRSRV_ERROR_UNABLE_TO_GET_SYSTEM_CLOCK,
-
- PVRSRV_ERROR_UNKNOWN_SGL_ERROR,
-
- PVRSRV_ERROR_SYSTEM_POWER_CHANGE_FAILURE,
- PVRSRV_ERROR_DEVICE_POWER_CHANGE_FAILURE,
-
- PVRSRV_ERROR_BAD_SYNC_STATE,
-
- PVRSRV_ERROR_CACHEOP_FAILED,
-
- PVRSRV_ERROR_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_ERROR;
-
-
-typedef enum _PVRSRV_DEVICE_CLASS_
-{
- PVRSRV_DEVICE_CLASS_3D = 0 ,
- PVRSRV_DEVICE_CLASS_DISPLAY = 1 ,
- PVRSRV_DEVICE_CLASS_BUFFER = 2 ,
- PVRSRV_DEVICE_CLASS_VIDEO = 3 ,
-
- PVRSRV_DEVICE_CLASS_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_DEVICE_CLASS;
-
-
-typedef enum _PVRSRV_SYS_POWER_STATE_
-{
- PVRSRV_SYS_POWER_STATE_Unspecified = -1,
- PVRSRV_SYS_POWER_STATE_D0 = 0,
- PVRSRV_SYS_POWER_STATE_D1 = 1,
- PVRSRV_SYS_POWER_STATE_D2 = 2,
- PVRSRV_SYS_POWER_STATE_D3 = 3,
- PVRSRV_SYS_POWER_STATE_D4 = 4,
-
- PVRSRV_SYS_POWER_STATE_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_SYS_POWER_STATE, *PPVRSRV_SYS_POWER_STATE;
-
-
-typedef enum _PVRSRV_DEV_POWER_STATE_
-{
- PVRSRV_DEV_POWER_STATE_DEFAULT = -1,
- PVRSRV_DEV_POWER_STATE_ON = 0,
- PVRSRV_DEV_POWER_STATE_IDLE = 1,
- PVRSRV_DEV_POWER_STATE_OFF = 2,
-
- PVRSRV_DEV_POWER_STATE_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_DEV_POWER_STATE, *PPVRSRV_DEV_POWER_STATE;
-
-
-typedef PVRSRV_ERROR (*PFN_PRE_POWER) (IMG_HANDLE hDevHandle,
- PVRSRV_DEV_POWER_STATE eNewPowerState,
- PVRSRV_DEV_POWER_STATE eCurrentPowerState);
-typedef PVRSRV_ERROR (*PFN_POST_POWER) (IMG_HANDLE hDevHandle,
- PVRSRV_DEV_POWER_STATE eNewPowerState,
- PVRSRV_DEV_POWER_STATE eCurrentPowerState);
-
-typedef PVRSRV_ERROR (*PFN_PRE_CLOCKSPEED_CHANGE) (IMG_HANDLE hDevHandle,
- IMG_BOOL bIdleDevice,
- PVRSRV_DEV_POWER_STATE eCurrentPowerState);
-typedef PVRSRV_ERROR (*PFN_POST_CLOCKSPEED_CHANGE) (IMG_HANDLE hDevHandle,
- IMG_BOOL bIdleDevice,
- PVRSRV_DEV_POWER_STATE eCurrentPowerState);
-
-
-typedef enum _PVRSRV_PIXEL_FORMAT_ {
-
- PVRSRV_PIXEL_FORMAT_UNKNOWN = 0,
- PVRSRV_PIXEL_FORMAT_RGB565 = 1,
- PVRSRV_PIXEL_FORMAT_RGB555 = 2,
- PVRSRV_PIXEL_FORMAT_RGB888 = 3,
- PVRSRV_PIXEL_FORMAT_BGR888 = 4,
- PVRSRV_PIXEL_FORMAT_GREY_SCALE = 8,
- PVRSRV_PIXEL_FORMAT_PAL12 = 13,
- PVRSRV_PIXEL_FORMAT_PAL8 = 14,
- PVRSRV_PIXEL_FORMAT_PAL4 = 15,
- PVRSRV_PIXEL_FORMAT_PAL2 = 16,
- PVRSRV_PIXEL_FORMAT_PAL1 = 17,
- PVRSRV_PIXEL_FORMAT_ARGB1555 = 18,
- PVRSRV_PIXEL_FORMAT_ARGB4444 = 19,
- PVRSRV_PIXEL_FORMAT_ARGB8888 = 20,
- PVRSRV_PIXEL_FORMAT_ABGR8888 = 21,
- PVRSRV_PIXEL_FORMAT_YV12 = 22,
- PVRSRV_PIXEL_FORMAT_I420 = 23,
- PVRSRV_PIXEL_FORMAT_IMC2 = 25,
- PVRSRV_PIXEL_FORMAT_XRGB8888 = 26,
- PVRSRV_PIXEL_FORMAT_XBGR8888 = 27,
- PVRSRV_PIXEL_FORMAT_BGRA8888 = 28,
- PVRSRV_PIXEL_FORMAT_XRGB4444 = 29,
- PVRSRV_PIXEL_FORMAT_ARGB8332 = 30,
- PVRSRV_PIXEL_FORMAT_A2RGB10 = 31,
- PVRSRV_PIXEL_FORMAT_A2BGR10 = 32,
- PVRSRV_PIXEL_FORMAT_P8 = 33,
- PVRSRV_PIXEL_FORMAT_L8 = 34,
- PVRSRV_PIXEL_FORMAT_A8L8 = 35,
- PVRSRV_PIXEL_FORMAT_A4L4 = 36,
- PVRSRV_PIXEL_FORMAT_L16 = 37,
- PVRSRV_PIXEL_FORMAT_L6V5U5 = 38,
- PVRSRV_PIXEL_FORMAT_V8U8 = 39,
- PVRSRV_PIXEL_FORMAT_V16U16 = 40,
- PVRSRV_PIXEL_FORMAT_QWVU8888 = 41,
- PVRSRV_PIXEL_FORMAT_XLVU8888 = 42,
- PVRSRV_PIXEL_FORMAT_QWVU16 = 43,
- PVRSRV_PIXEL_FORMAT_D16 = 44,
- PVRSRV_PIXEL_FORMAT_D24S8 = 45,
- PVRSRV_PIXEL_FORMAT_D24X8 = 46,
-
-
- PVRSRV_PIXEL_FORMAT_ABGR16 = 47,
- PVRSRV_PIXEL_FORMAT_ABGR16F = 48,
- PVRSRV_PIXEL_FORMAT_ABGR32 = 49,
- PVRSRV_PIXEL_FORMAT_ABGR32F = 50,
- PVRSRV_PIXEL_FORMAT_B10GR11 = 51,
- PVRSRV_PIXEL_FORMAT_GR88 = 52,
- PVRSRV_PIXEL_FORMAT_BGR32 = 53,
- PVRSRV_PIXEL_FORMAT_GR32 = 54,
- PVRSRV_PIXEL_FORMAT_E5BGR9 = 55,
-
-
- PVRSRV_PIXEL_FORMAT_RESERVED1 = 56,
- PVRSRV_PIXEL_FORMAT_RESERVED2 = 57,
- PVRSRV_PIXEL_FORMAT_RESERVED3 = 58,
- PVRSRV_PIXEL_FORMAT_RESERVED4 = 59,
- PVRSRV_PIXEL_FORMAT_RESERVED5 = 60,
-
-
- PVRSRV_PIXEL_FORMAT_R8G8_B8G8 = 61,
- PVRSRV_PIXEL_FORMAT_G8R8_G8B8 = 62,
-
-
- PVRSRV_PIXEL_FORMAT_NV11 = 63,
- PVRSRV_PIXEL_FORMAT_NV12 = 64,
-
-
- PVRSRV_PIXEL_FORMAT_YUY2 = 65,
- PVRSRV_PIXEL_FORMAT_YUV420 = 66,
- PVRSRV_PIXEL_FORMAT_YUV444 = 67,
- PVRSRV_PIXEL_FORMAT_VUY444 = 68,
- PVRSRV_PIXEL_FORMAT_YUYV = 69,
- PVRSRV_PIXEL_FORMAT_YVYU = 70,
- PVRSRV_PIXEL_FORMAT_UYVY = 71,
- PVRSRV_PIXEL_FORMAT_VYUY = 72,
-
- PVRSRV_PIXEL_FORMAT_FOURCC_ORG_UYVY = 73,
- PVRSRV_PIXEL_FORMAT_FOURCC_ORG_YUYV = 74,
- PVRSRV_PIXEL_FORMAT_FOURCC_ORG_YVYU = 75,
- PVRSRV_PIXEL_FORMAT_FOURCC_ORG_VYUY = 76,
- PVRSRV_PIXEL_FORMAT_FOURCC_ORG_AYUV = 77,
-
-
- PVRSRV_PIXEL_FORMAT_A32B32G32R32 = 78,
- PVRSRV_PIXEL_FORMAT_A32B32G32R32F = 79,
- PVRSRV_PIXEL_FORMAT_A32B32G32R32_UINT = 80,
- PVRSRV_PIXEL_FORMAT_A32B32G32R32_SINT = 81,
-
-
- PVRSRV_PIXEL_FORMAT_B32G32R32 = 82,
- PVRSRV_PIXEL_FORMAT_B32G32R32F = 83,
- PVRSRV_PIXEL_FORMAT_B32G32R32_UINT = 84,
- PVRSRV_PIXEL_FORMAT_B32G32R32_SINT = 85,
-
-
- PVRSRV_PIXEL_FORMAT_G32R32 = 86,
- PVRSRV_PIXEL_FORMAT_G32R32F = 87,
- PVRSRV_PIXEL_FORMAT_G32R32_UINT = 88,
- PVRSRV_PIXEL_FORMAT_G32R32_SINT = 89,
-
-
- PVRSRV_PIXEL_FORMAT_D32F = 90,
- PVRSRV_PIXEL_FORMAT_R32 = 91,
- PVRSRV_PIXEL_FORMAT_R32F = 92,
- PVRSRV_PIXEL_FORMAT_R32_UINT = 93,
- PVRSRV_PIXEL_FORMAT_R32_SINT = 94,
-
-
- PVRSRV_PIXEL_FORMAT_A16B16G16R16 = 95,
- PVRSRV_PIXEL_FORMAT_A16B16G16R16F = 96,
- PVRSRV_PIXEL_FORMAT_A16B16G16R16_SINT = 97,
- PVRSRV_PIXEL_FORMAT_A16B16G16R16_SNORM = 98,
- PVRSRV_PIXEL_FORMAT_A16B16G16R16_UINT = 99,
- PVRSRV_PIXEL_FORMAT_A16B16G16R16_UNORM = 100,
-
-
- PVRSRV_PIXEL_FORMAT_G16R16 = 101,
- PVRSRV_PIXEL_FORMAT_G16R16F = 102,
- PVRSRV_PIXEL_FORMAT_G16R16_UINT = 103,
- PVRSRV_PIXEL_FORMAT_G16R16_UNORM = 104,
- PVRSRV_PIXEL_FORMAT_G16R16_SINT = 105,
- PVRSRV_PIXEL_FORMAT_G16R16_SNORM = 106,
-
-
- PVRSRV_PIXEL_FORMAT_R16 = 107,
- PVRSRV_PIXEL_FORMAT_R16F = 108,
- PVRSRV_PIXEL_FORMAT_R16_UINT = 109,
- PVRSRV_PIXEL_FORMAT_R16_UNORM = 110,
- PVRSRV_PIXEL_FORMAT_R16_SINT = 111,
- PVRSRV_PIXEL_FORMAT_R16_SNORM = 112,
-
-
- PVRSRV_PIXEL_FORMAT_X8R8G8B8 = 113,
- PVRSRV_PIXEL_FORMAT_X8R8G8B8_UNORM = 114,
- PVRSRV_PIXEL_FORMAT_X8R8G8B8_UNORM_SRGB = 115,
-
- PVRSRV_PIXEL_FORMAT_A8R8G8B8 = 116,
- PVRSRV_PIXEL_FORMAT_A8R8G8B8_UNORM = 117,
- PVRSRV_PIXEL_FORMAT_A8R8G8B8_UNORM_SRGB = 118,
-
- PVRSRV_PIXEL_FORMAT_A8B8G8R8 = 119,
- PVRSRV_PIXEL_FORMAT_A8B8G8R8_UINT = 120,
- PVRSRV_PIXEL_FORMAT_A8B8G8R8_UNORM = 121,
- PVRSRV_PIXEL_FORMAT_A8B8G8R8_UNORM_SRGB = 122,
- PVRSRV_PIXEL_FORMAT_A8B8G8R8_SINT = 123,
- PVRSRV_PIXEL_FORMAT_A8B8G8R8_SNORM = 124,
-
-
- PVRSRV_PIXEL_FORMAT_G8R8 = 125,
- PVRSRV_PIXEL_FORMAT_G8R8_UINT = 126,
- PVRSRV_PIXEL_FORMAT_G8R8_UNORM = 127,
- PVRSRV_PIXEL_FORMAT_G8R8_SINT = 128,
- PVRSRV_PIXEL_FORMAT_G8R8_SNORM = 129,
-
-
- PVRSRV_PIXEL_FORMAT_A8 = 130,
- PVRSRV_PIXEL_FORMAT_R8 = 131,
- PVRSRV_PIXEL_FORMAT_R8_UINT = 132,
- PVRSRV_PIXEL_FORMAT_R8_UNORM = 133,
- PVRSRV_PIXEL_FORMAT_R8_SINT = 134,
- PVRSRV_PIXEL_FORMAT_R8_SNORM = 135,
-
-
- PVRSRV_PIXEL_FORMAT_A2B10G10R10 = 136,
- PVRSRV_PIXEL_FORMAT_A2B10G10R10_UNORM = 137,
- PVRSRV_PIXEL_FORMAT_A2B10G10R10_UINT = 138,
-
-
- PVRSRV_PIXEL_FORMAT_B10G11R11 = 139,
- PVRSRV_PIXEL_FORMAT_B10G11R11F = 140,
-
-
- PVRSRV_PIXEL_FORMAT_X24G8R32 = 141,
- PVRSRV_PIXEL_FORMAT_G8R24 = 142,
- PVRSRV_PIXEL_FORMAT_X8R24 = 143,
- PVRSRV_PIXEL_FORMAT_E5B9G9R9 = 144,
- PVRSRV_PIXEL_FORMAT_R1 = 145,
-
- PVRSRV_PIXEL_FORMAT_RESERVED6 = 146,
- PVRSRV_PIXEL_FORMAT_RESERVED7 = 147,
- PVRSRV_PIXEL_FORMAT_RESERVED8 = 148,
- PVRSRV_PIXEL_FORMAT_RESERVED9 = 149,
- PVRSRV_PIXEL_FORMAT_RESERVED10 = 150,
- PVRSRV_PIXEL_FORMAT_RESERVED11 = 151,
- PVRSRV_PIXEL_FORMAT_RESERVED12 = 152,
- PVRSRV_PIXEL_FORMAT_RESERVED13 = 153,
- PVRSRV_PIXEL_FORMAT_RESERVED14 = 154,
- PVRSRV_PIXEL_FORMAT_RESERVED15 = 155,
- PVRSRV_PIXEL_FORMAT_RESERVED16 = 156,
- PVRSRV_PIXEL_FORMAT_RESERVED17 = 157,
- PVRSRV_PIXEL_FORMAT_RESERVED18 = 158,
- PVRSRV_PIXEL_FORMAT_RESERVED19 = 159,
- PVRSRV_PIXEL_FORMAT_RESERVED20 = 160,
-
-
- PVRSRV_PIXEL_FORMAT_UBYTE4 = 161,
- PVRSRV_PIXEL_FORMAT_SHORT4 = 162,
- PVRSRV_PIXEL_FORMAT_SHORT4N = 163,
- PVRSRV_PIXEL_FORMAT_USHORT4N = 164,
- PVRSRV_PIXEL_FORMAT_SHORT2N = 165,
- PVRSRV_PIXEL_FORMAT_SHORT2 = 166,
- PVRSRV_PIXEL_FORMAT_USHORT2N = 167,
- PVRSRV_PIXEL_FORMAT_UDEC3 = 168,
- PVRSRV_PIXEL_FORMAT_DEC3N = 169,
- PVRSRV_PIXEL_FORMAT_F16_2 = 170,
- PVRSRV_PIXEL_FORMAT_F16_4 = 171,
-
-
- PVRSRV_PIXEL_FORMAT_L_F16 = 172,
- PVRSRV_PIXEL_FORMAT_L_F16_REP = 173,
- PVRSRV_PIXEL_FORMAT_L_F16_A_F16 = 174,
- PVRSRV_PIXEL_FORMAT_A_F16 = 175,
- PVRSRV_PIXEL_FORMAT_B16G16R16F = 176,
-
- PVRSRV_PIXEL_FORMAT_L_F32 = 177,
- PVRSRV_PIXEL_FORMAT_A_F32 = 178,
- PVRSRV_PIXEL_FORMAT_L_F32_A_F32 = 179,
-
-
- PVRSRV_PIXEL_FORMAT_PVRTC2 = 180,
- PVRSRV_PIXEL_FORMAT_PVRTC4 = 181,
- PVRSRV_PIXEL_FORMAT_PVRTCII2 = 182,
- PVRSRV_PIXEL_FORMAT_PVRTCII4 = 183,
- PVRSRV_PIXEL_FORMAT_PVRTCIII = 184,
- PVRSRV_PIXEL_FORMAT_PVRO8 = 185,
- PVRSRV_PIXEL_FORMAT_PVRO88 = 186,
- PVRSRV_PIXEL_FORMAT_PT1 = 187,
- PVRSRV_PIXEL_FORMAT_PT2 = 188,
- PVRSRV_PIXEL_FORMAT_PT4 = 189,
- PVRSRV_PIXEL_FORMAT_PT8 = 190,
- PVRSRV_PIXEL_FORMAT_PTW = 191,
- PVRSRV_PIXEL_FORMAT_PTB = 192,
- PVRSRV_PIXEL_FORMAT_MONO8 = 193,
- PVRSRV_PIXEL_FORMAT_MONO16 = 194,
-
-
- PVRSRV_PIXEL_FORMAT_C0_YUYV = 195,
- PVRSRV_PIXEL_FORMAT_C0_UYVY = 196,
- PVRSRV_PIXEL_FORMAT_C0_YVYU = 197,
- PVRSRV_PIXEL_FORMAT_C0_VYUY = 198,
- PVRSRV_PIXEL_FORMAT_C1_YUYV = 199,
- PVRSRV_PIXEL_FORMAT_C1_UYVY = 200,
- PVRSRV_PIXEL_FORMAT_C1_YVYU = 201,
- PVRSRV_PIXEL_FORMAT_C1_VYUY = 202,
-
-
- PVRSRV_PIXEL_FORMAT_C0_YUV420_2P_UV = 203,
- PVRSRV_PIXEL_FORMAT_C0_YUV420_2P_VU = 204,
- PVRSRV_PIXEL_FORMAT_C0_YUV420_3P = 205,
- PVRSRV_PIXEL_FORMAT_C1_YUV420_2P_UV = 206,
- PVRSRV_PIXEL_FORMAT_C1_YUV420_2P_VU = 207,
- PVRSRV_PIXEL_FORMAT_C1_YUV420_3P = 208,
-
- PVRSRV_PIXEL_FORMAT_A2B10G10R10F = 209,
- PVRSRV_PIXEL_FORMAT_B8G8R8_SINT = 210,
- PVRSRV_PIXEL_FORMAT_PVRF32SIGNMASK = 211,
-
- PVRSRV_PIXEL_FORMAT_ABGR4444 = 212,
- PVRSRV_PIXEL_FORMAT_ABGR1555 = 213,
- PVRSRV_PIXEL_FORMAT_BGR565 = 214,
-
- PVRSRV_PIXEL_FORMAT_FORCE_I32 = 0x7fffffff
-
-} PVRSRV_PIXEL_FORMAT;
-
-typedef enum _PVRSRV_ALPHA_FORMAT_ {
- PVRSRV_ALPHA_FORMAT_UNKNOWN = 0x00000000,
- PVRSRV_ALPHA_FORMAT_PRE = 0x00000001,
- PVRSRV_ALPHA_FORMAT_NONPRE = 0x00000002,
- PVRSRV_ALPHA_FORMAT_MASK = 0x0000000F,
-} PVRSRV_ALPHA_FORMAT;
-
-typedef enum _PVRSRV_COLOURSPACE_FORMAT_ {
- PVRSRV_COLOURSPACE_FORMAT_UNKNOWN = 0x00000000,
- PVRSRV_COLOURSPACE_FORMAT_LINEAR = 0x00010000,
- PVRSRV_COLOURSPACE_FORMAT_NONLINEAR = 0x00020000,
- PVRSRV_COLOURSPACE_FORMAT_MASK = 0x000F0000,
-} PVRSRV_COLOURSPACE_FORMAT;
-
-
-typedef enum _PVRSRV_ROTATION_ {
- PVRSRV_ROTATE_0 = 0,
- PVRSRV_ROTATE_90 = 1,
- PVRSRV_ROTATE_180 = 2,
- PVRSRV_ROTATE_270 = 3,
- PVRSRV_FLIP_Y
-
-} PVRSRV_ROTATION;
-
-#define PVRSRV_CREATE_SWAPCHAIN_SHARED (1<<0)
-#define PVRSRV_CREATE_SWAPCHAIN_QUERY (1<<1)
-#define PVRSRV_CREATE_SWAPCHAIN_OEMOVERLAY (1<<2)
-
-typedef struct _PVRSRV_SYNC_DATA_
-{
-
- IMG_UINT32 ui32WriteOpsPending;
- volatile IMG_UINT32 ui32WriteOpsComplete;
-
-
- IMG_UINT32 ui32ReadOpsPending;
- volatile IMG_UINT32 ui32ReadOpsComplete;
-
-
- IMG_UINT32 ui32LastOpDumpVal;
- IMG_UINT32 ui32LastReadOpDumpVal;
-
-} PVRSRV_SYNC_DATA;
-
-typedef struct _PVRSRV_CLIENT_SYNC_INFO_
-{
-
- PVRSRV_SYNC_DATA *psSyncData;
-
-
-
-
-
- IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr;
-
-
- IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr;
-
-
- IMG_HANDLE hMappingInfo;
-
-
- IMG_HANDLE hKernelSyncInfo;
-
-} PVRSRV_CLIENT_SYNC_INFO, *PPVRSRV_CLIENT_SYNC_INFO;
-
-typedef struct PVRSRV_RESOURCE_TAG
-{
- volatile IMG_UINT32 ui32Lock;
- IMG_UINT32 ui32ID;
-}PVRSRV_RESOURCE;
-typedef PVRSRV_RESOURCE PVRSRV_RES_HANDLE;
-
-
-typedef IMG_VOID (*PFN_CMD_COMPLETE) (IMG_HANDLE);
-typedef IMG_VOID (**PPFN_CMD_COMPLETE) (IMG_HANDLE);
-
-typedef IMG_BOOL (*PFN_CMD_PROC) (IMG_HANDLE, IMG_UINT32, IMG_VOID*);
-typedef IMG_BOOL (**PPFN_CMD_PROC) (IMG_HANDLE, IMG_UINT32, IMG_VOID*);
-
-
-typedef struct _IMG_RECT_
-{
- IMG_INT32 x0;
- IMG_INT32 y0;
- IMG_INT32 x1;
- IMG_INT32 y1;
-}IMG_RECT;
-
-typedef struct _IMG_RECT_16_
-{
- IMG_INT16 x0;
- IMG_INT16 y0;
- IMG_INT16 x1;
- IMG_INT16 y1;
-}IMG_RECT_16;
-
-
-typedef PVRSRV_ERROR (*PFN_GET_BUFFER_ADDR)(IMG_HANDLE,
- IMG_HANDLE,
- IMG_SYS_PHYADDR**,
- IMG_SIZE_T*,
- IMG_VOID**,
- IMG_HANDLE*,
- IMG_BOOL*,
- IMG_UINT32*);
-
-
-typedef struct DISPLAY_DIMS_TAG
-{
- IMG_UINT32 ui32ByteStride;
- IMG_UINT32 ui32Width;
- IMG_UINT32 ui32Height;
-} DISPLAY_DIMS;
-
-
-typedef struct DISPLAY_FORMAT_TAG
-{
-
- PVRSRV_PIXEL_FORMAT pixelformat;
-} DISPLAY_FORMAT;
-
-typedef struct DISPLAY_SURF_ATTRIBUTES_TAG
-{
-
- PVRSRV_PIXEL_FORMAT pixelformat;
-
- DISPLAY_DIMS sDims;
-} DISPLAY_SURF_ATTRIBUTES;
-
-
-typedef struct DISPLAY_MODE_INFO_TAG
-{
-
- PVRSRV_PIXEL_FORMAT pixelformat;
-
- DISPLAY_DIMS sDims;
-
- IMG_UINT32 ui32RefreshHZ;
-
- IMG_UINT32 ui32OEMFlags;
-} DISPLAY_MODE_INFO;
-
-
-
-#define MAX_DISPLAY_NAME_SIZE (50)
-
-typedef struct DISPLAY_INFO_TAG
-{
-
- IMG_UINT32 ui32MaxSwapChains;
-
- IMG_UINT32 ui32MaxSwapChainBuffers;
-
- IMG_UINT32 ui32MinSwapInterval;
-
- IMG_UINT32 ui32MaxSwapInterval;
-
- IMG_UINT32 ui32PhysicalWidthmm;
- IMG_UINT32 ui32PhysicalHeightmm;
-
- IMG_CHAR szDisplayName[MAX_DISPLAY_NAME_SIZE];
-#if defined(SUPPORT_HW_CURSOR)
-
- IMG_UINT16 ui32CursorWidth;
- IMG_UINT16 ui32CursorHeight;
-#endif
-} DISPLAY_INFO;
-
-typedef struct ACCESS_INFO_TAG
-{
- IMG_UINT32 ui32Size;
- IMG_UINT32 ui32FBPhysBaseAddress;
- IMG_UINT32 ui32FBMemAvailable;
- IMG_UINT32 ui32SysPhysBaseAddress;
- IMG_UINT32 ui32SysSize;
- IMG_UINT32 ui32DevIRQ;
-}ACCESS_INFO;
-
-
-typedef struct PVRSRV_CURSOR_SHAPE_TAG
-{
- IMG_UINT16 ui16Width;
- IMG_UINT16 ui16Height;
- IMG_INT16 i16XHot;
- IMG_INT16 i16YHot;
-
-
- IMG_VOID* pvMask;
- IMG_INT16 i16MaskByteStride;
-
-
- IMG_VOID* pvColour;
- IMG_INT16 i16ColourByteStride;
- PVRSRV_PIXEL_FORMAT eColourPixelFormat;
-} PVRSRV_CURSOR_SHAPE;
-
-#define PVRSRV_SET_CURSOR_VISIBILITY (1<<0)
-#define PVRSRV_SET_CURSOR_POSITION (1<<1)
-#define PVRSRV_SET_CURSOR_SHAPE (1<<2)
-#define PVRSRV_SET_CURSOR_ROTATION (1<<3)
-
-typedef struct PVRSRV_CURSOR_INFO_TAG
-{
-
- IMG_UINT32 ui32Flags;
-
-
- IMG_BOOL bVisible;
-
-
- IMG_INT16 i16XPos;
- IMG_INT16 i16YPos;
-
-
- PVRSRV_CURSOR_SHAPE sCursorShape;
-
-
- IMG_UINT32 ui32Rotation;
-
-} PVRSRV_CURSOR_INFO;
-
-
-typedef struct _PVRSRV_REGISTRY_INFO_
-{
- IMG_UINT32 ui32DevCookie;
- IMG_PCHAR pszKey;
- IMG_PCHAR pszValue;
- IMG_PCHAR pszBuf;
- IMG_UINT32 ui32BufSize;
-} PVRSRV_REGISTRY_INFO, *PPVRSRV_REGISTRY_INFO;
-
-
-PVRSRV_ERROR IMG_CALLCONV PVRSRVReadRegistryString (PPVRSRV_REGISTRY_INFO psRegInfo);
-PVRSRV_ERROR IMG_CALLCONV PVRSRVWriteRegistryString (PPVRSRV_REGISTRY_INFO psRegInfo);
-
-
-#define PVRSRV_BC_FLAGS_YUVCSC_CONFORMANT_RANGE (0 << 0)
-#define PVRSRV_BC_FLAGS_YUVCSC_FULL_RANGE (1 << 0)
-
-#define PVRSRV_BC_FLAGS_YUVCSC_BT601 (0 << 1)
-#define PVRSRV_BC_FLAGS_YUVCSC_BT709 (1 << 1)
-
-#define MAX_BUFFER_DEVICE_NAME_SIZE (50)
-
-typedef struct BUFFER_INFO_TAG
-{
- IMG_UINT32 ui32BufferCount;
- IMG_UINT32 ui32BufferDeviceID;
- PVRSRV_PIXEL_FORMAT pixelformat;
- IMG_UINT32 ui32ByteStride;
- IMG_UINT32 ui32Width;
- IMG_UINT32 ui32Height;
- IMG_UINT32 ui32Flags;
- IMG_CHAR szDeviceName[MAX_BUFFER_DEVICE_NAME_SIZE];
-} BUFFER_INFO;
-
-typedef enum _OVERLAY_DEINTERLACE_MODE_
-{
- WEAVE=0x0,
- BOB_ODD,
- BOB_EVEN,
- BOB_EVEN_NONINTERLEAVED
-} OVERLAY_DEINTERLACE_MODE;
-
-#endif
diff --git a/sys/pvr2d/pvr_includes/wsegl.h b/sys/pvr2d/pvr_includes/wsegl.h deleted file mode 100644 index e5191ec4d..000000000 --- a/sys/pvr2d/pvr_includes/wsegl.h +++ /dev/null @@ -1,285 +0,0 @@ -/**********************************************************************
-*
-* Copyright(c) Imagination Technologies Ltd.
-*
-* The contents of this file are subject to the MIT license as set out below.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
-* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
-* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*
-* This License is also included in this distribution in the file called
-* "COPYING".
-*
-******************************************************************************/
-
-
-
-#if !defined(__WSEGL_H__)
-#define __WSEGL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-// WSEGL Platform-specific definitions
-*/
-#if defined(__linux__)
-#define WSEGL_EXPORT __attribute__((visibility("default")))
-#define WSEGL_IMPORT
-#else
-#define WSEGL_EXPORT
-#define WSEGL_IMPORT
-#endif
-
-/*
-// WSEGL API Version Number
-*/
-
-#define WSEGL_VERSION 2
-#define WSEGL_DEFAULT_DISPLAY 0
-#define WSEGL_DEFAULT_NATIVE_ENGINE 0
-
-#define WSEGL_FALSE 0
-#define WSEGL_TRUE 1
-#define WSEGL_NULL 0
-
-#define WSEGL_UNREFERENCED_PARAMETER(param) (param) = (param)
-
-/*
-// WSEGL handles
-*/
-typedef void *WSEGLDisplayHandle;
-typedef void *WSEGLDrawableHandle;
-
-/*
-// Display capability type
-*/
-typedef enum WSEGLCapsType_TAG
-{
- WSEGL_NO_CAPS = 0,
- WSEGL_CAP_MIN_SWAP_INTERVAL = 1, /* System default value = 1 */
- WSEGL_CAP_MAX_SWAP_INTERVAL = 2, /* System default value = 1 */
- WSEGL_CAP_WINDOWS_USE_HW_SYNC = 3, /* System default value = 0 (FALSE) */
- WSEGL_CAP_PIXMAPS_USE_HW_SYNC = 4, /* System default value = 0 (FALSE) */
-
-} WSEGLCapsType;
-
-/*
-// Display capability
-*/
-typedef struct WSEGLCaps_TAG
-{
- WSEGLCapsType eCapsType;
- unsigned long ui32CapsValue;
-
-} WSEGLCaps;
-
-/*
-// Drawable type
-*/
-#define WSEGL_NO_DRAWABLE 0x0
-#define WSEGL_DRAWABLE_WINDOW 0x1
-#define WSEGL_DRAWABLE_PIXMAP 0x2
-
-
-/*
-// Pixel format of display/drawable
-*/
-typedef enum WSEGLPixelFormat_TAG
-{
- /* These must not be re-ordered */
- WSEGL_PIXELFORMAT_RGB565 = 0,
- WSEGL_PIXELFORMAT_ARGB4444 = 1,
- WSEGL_PIXELFORMAT_ARGB8888 = 2,
- WSEGL_PIXELFORMAT_ARGB1555 = 3,
- WSEGL_PIXELFORMAT_ABGR8888 = 4,
- WSEGL_PIXELFORMAT_XBGR8888 = 5,
-
- /* These are compatibility names only; new WSEGL
- * modules should not use them.
- */
- WSEGL_PIXELFORMAT_565 = WSEGL_PIXELFORMAT_RGB565,
- WSEGL_PIXELFORMAT_4444 = WSEGL_PIXELFORMAT_ARGB4444,
- WSEGL_PIXELFORMAT_8888 = WSEGL_PIXELFORMAT_ARGB8888,
- WSEGL_PIXELFORMAT_1555 = WSEGL_PIXELFORMAT_ARGB1555,
-
-} WSEGLPixelFormat;
-
-/*
-// Transparent of display/drawable
-*/
-typedef enum WSEGLTransparentType_TAG
-{
- WSEGL_OPAQUE = 0,
- WSEGL_COLOR_KEY = 1,
-
-} WSEGLTransparentType;
-
-/*
-// Display/drawable configuration
-*/
-typedef struct WSEGLConfig_TAG
-{
- /*
- // Type of drawables this configuration applies to -
- // OR'd values of drawable types.
- */
- unsigned long ui32DrawableType;
-
- /* Pixel format */
- WSEGLPixelFormat ePixelFormat;
-
- /* Native Renderable - set to WSEGL_TRUE if native renderable */
- unsigned long ulNativeRenderable;
-
- /* FrameBuffer Level Parameter */
- unsigned long ulFrameBufferLevel;
-
- /* Native Visual ID */
- unsigned long ulNativeVisualID;
-
- /* Native Visual */
- void *hNativeVisual;
-
- /* Transparent Type */
- WSEGLTransparentType eTransparentType;
-
- /* Transparent Color - only used if transparent type is COLOR_KEY */
- unsigned long ulTransparentColor; /* packed as 0x00RRGGBB */
-
-
-} WSEGLConfig;
-
-/*
-// WSEGL errors
-*/
-typedef enum WSEGLError_TAG
-{
- WSEGL_SUCCESS = 0,
- WSEGL_CANNOT_INITIALISE = 1,
- WSEGL_BAD_NATIVE_DISPLAY = 2,
- WSEGL_BAD_NATIVE_WINDOW = 3,
- WSEGL_BAD_NATIVE_PIXMAP = 4,
- WSEGL_BAD_NATIVE_ENGINE = 5,
- WSEGL_BAD_DRAWABLE = 6,
- WSEGL_BAD_MATCH = 7,
- WSEGL_OUT_OF_MEMORY = 8,
-
- /* These are compatibility names only; new WSEGL
- * modules should not use them.
- */
- WSEGL_BAD_CONFIG = WSEGL_BAD_MATCH,
-
-} WSEGLError;
-
-/*
-// Drawable orientation (in degrees anti-clockwise)
-*/
-typedef enum WSEGLRotationAngle_TAG
-{
- WSEGL_ROTATE_0 = 0,
- WSEGL_ROTATE_90 = 1,
- WSEGL_ROTATE_180 = 2,
- WSEGL_ROTATE_270 = 3
-
-} WSEGLRotationAngle;
-
-/*
-// Drawable information required by OpenGL-ES driver
-*/
-typedef struct WSEGLDrawableParams_TAG
-{
- /* Width in pixels of the drawable */
- unsigned long ui32Width;
-
- /* Height in pixels of the drawable */
- unsigned long ui32Height;
-
- /* Stride in pixels of the drawable */
- unsigned long ui32Stride;
-
- /* Pixel format of the drawable */
- WSEGLPixelFormat ePixelFormat;
-
- /* User space cpu virtual address of the drawable */
- void *pvLinearAddress;
-
- /* HW address of the drawable */
- unsigned long ui32HWAddress;
-
- /* Private data for the drawable */
- void *hPrivateData;
-
-
-} WSEGLDrawableParams;
-
-
-/*
-// Table of function pointers that is returned by WSEGL_GetFunctionTablePointer()
-//
-// The first entry in the table is the version number of the wsegl.h header file that
-// the module has been written against, and should therefore be set to WSEGL_VERSION
-*/
-typedef struct WSEGL_FunctionTable_TAG
-{
- unsigned long ui32WSEGLVersion;
-
- WSEGLError (*pfnWSEGL_IsDisplayValid)(NativeDisplayType);
-
- WSEGLError (*pfnWSEGL_InitialiseDisplay)(NativeDisplayType, WSEGLDisplayHandle *, const WSEGLCaps **, WSEGLConfig **);
-
- WSEGLError (*pfnWSEGL_CloseDisplay)(WSEGLDisplayHandle);
-
- WSEGLError (*pfnWSEGL_CreateWindowDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativeWindowType, WSEGLRotationAngle *);
-
- WSEGLError (*pfnWSEGL_CreatePixmapDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativePixmapType, WSEGLRotationAngle *);
-
- WSEGLError (*pfnWSEGL_DeleteDrawable)(WSEGLDrawableHandle);
-
- WSEGLError (*pfnWSEGL_SwapDrawable)(WSEGLDrawableHandle, unsigned long);
-
- WSEGLError (*pfnWSEGL_SwapControlInterval)(WSEGLDrawableHandle, unsigned long);
-
- WSEGLError (*pfnWSEGL_WaitNative)(WSEGLDrawableHandle, unsigned long);
-
- WSEGLError (*pfnWSEGL_CopyFromDrawable)(WSEGLDrawableHandle, NativePixmapType);
-
- WSEGLError (*pfnWSEGL_CopyFromPBuffer)(void *, unsigned long, unsigned long, unsigned long, WSEGLPixelFormat, NativePixmapType);
-
- WSEGLError (*pfnWSEGL_GetDrawableParameters)(WSEGLDrawableHandle, WSEGLDrawableParams *, WSEGLDrawableParams *);
-
- WSEGLError (*pfnWSEGL_ConnectDrawable)(WSEGLDrawableHandle);
-
- WSEGLError (*pfnWSEGL_DisconnectDrawable)(WSEGLDrawableHandle);
-
-
-} WSEGL_FunctionTable;
-
-
-WSEGL_IMPORT const WSEGL_FunctionTable *WSEGL_GetFunctionTablePointer(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __WSEGL_H__ */
-
-/******************************************************************************
- End of file (wsegl.h)
-******************************************************************************/
diff --git a/sys/qcam/Makefile.am b/sys/qcam/Makefile.am deleted file mode 100644 index 3843ae8bc..000000000 --- a/sys/qcam/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ - -plugin_LTLIBRARIES = libgstqcam.la - -EXTRA_DIST = qcam-os.c qcam-Linux.c - -libgstqcam_la_SOURCES = gstqcamsrc.c qcam-lib.c exposure.c -libgstqcam_la_CFLAGS = -O2 $(GST_CFLAGS) -libgstqcam_la_LIBADD = -libgstqcam_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstqcam_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) - -noinst_HEADERS = gstqcamsrc.h qcam-os.h qcam.h qcamip.h qcam-Linux.h diff --git a/sys/qcam/dark.c b/sys/qcam/dark.c deleted file mode 100644 index cdfa2ab8d..000000000 --- a/sys/qcam/dark.c +++ /dev/null @@ -1,258 +0,0 @@ -/****************************************************************** - -Copyright (C) 1996 by Brian Scearce - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -and/or distribute copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following conditions: - -1. The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - -2. Redistribution for profit requires the express, written permission of - the author. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL BRIAN SCEARCE BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -******************************************************************/ - -/* Fixdark - Routine to repair dark current artifacts in qcam output. - Basic idea: the Qcam CCD suffers from "dark current"; - that is, some of the CCD pixels will leak current under - long exposures, even if they're in the dark, and this - shows up as ugly speckling on images taken in low light. - - Fortunately, the leaky pixels are the same from shot to - shot. So, we can figure out which pixels are leaky by - taking some establishing shots in the dark, and try to - fix those pixels on subsequent shots. The dark - establishing shots need only be done once per camera. -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <string.h> -#include <assert.h> -#include "qcam.h" -#define MAX_LOOPS 10 -#define FNAME "qcam.darkfile" - -static unsigned char master_darkmask1[MAX_HEIGHT][MAX_WIDTH]; -static unsigned char master_darkmask2[MAX_HEIGHT / 2 + 1][MAX_WIDTH / 2 + 1]; -static unsigned char master_darkmask4[MAX_HEIGHT / 4 + 1][MAX_WIDTH / 4 + 1]; - -/* -int -read_darkmask() -{ - int x, y; - int min_bright; - char darkfile[BUFSIZ], *p; - FILE *fp; - - strcpy(darkfile, CONFIG_FILE); - if ( (p = strrchr(darkfile, '/'))) { - strcpy(p+1, FNAME); - } else { - strcpy(darkfile, FNAME); - } - - if (!(fp = fopen(darkfile, "r"))) { -#ifdef DEBUG - fprintf(stderr, "Can't open darkfile %s\n", darkfile); -#endif - return 0; - } - - if (fread(master_darkmask1, sizeof(unsigned char), MAX_WIDTH*MAX_HEIGHT, fp) != - MAX_WIDTH*MAX_HEIGHT) { -#ifdef DEBUG - fprintf(stderr, "Error reading darkfile\n"); -#endif - return 0; - } - - for (y = 0; y < MAX_HEIGHT; y += 2) { - for (x = 0; x < MAX_WIDTH; x += 2) { - min_bright = master_darkmask1[y][x]; - if (y < MAX_HEIGHT-1 && master_darkmask1[y+1][x] < min_bright) - min_bright = master_darkmask1[y+1][x]; - if (x < MAX_WIDTH-1 && master_darkmask1[y][x+1] < min_bright) - min_bright = master_darkmask1[y][x+1]; - if (y < MAX_HEIGHT-1 && x < MAX_WIDTH-1 && master_darkmask1[y+1][x+1] < min_bright) - min_bright = master_darkmask1[y+1][x+1]; - master_darkmask2[y/2][x/2] = min_bright; - assert(y/2 < MAX_HEIGHT/2+1); - assert(x/2 < MAX_WIDTH/2+1); - } - } - - for (y = 0; y < MAX_HEIGHT/2; y += 2) { - for (x = 0; x < MAX_WIDTH/2; x += 2) { - min_bright = master_darkmask2[y][x]; - if (y < MAX_HEIGHT/2-1 && master_darkmask2[y+1][x] < min_bright) - min_bright = master_darkmask2[y+1][x]; - if (x < MAX_WIDTH/2-1 && master_darkmask2[y][x+1] < min_bright) - min_bright = master_darkmask2[y][x+1]; - if (y < MAX_HEIGHT/2-1 && x < MAX_WIDTH-1 && master_darkmask2[y+1][x+1] < min_bright) - min_bright = master_darkmask2[y+1][x+1]; - master_darkmask4[y/2][x/2] = min_bright; - assert(y/2 < MAX_HEIGHT/4+1); - assert(x/2 < MAX_WIDTH/4+1); - } - } - - fclose(fp); - return 1; -} -*/ - - -/* fixdark - We first record a list of bad leaky pixels, by making a - number of exposures in the dark. master_darkmask holds - this information. It's a map of the CCD. - master_darkmask[y][x] == val means that the pixel is - unreliable for brightnesses of "val" and above. - - We go over the image. If a pixel is bad, look at the - adjacent four pixels, average the ones that have good - values, and use that instead. -*/ - -int -fixdark (const struct qcam *q, scanbuf * scan) -{ - static int init = 0; - static int smallest_dm = 255; - unsigned char darkmask[MAX_HEIGHT][MAX_WIDTH]; - unsigned char new_image[MAX_HEIGHT][MAX_WIDTH]; - int width, height; - int max_width, max_height; - int x, y; - int ccd_x, ccd_y; - int pixelcount, pixeltotal; - int again, loopcount = 0; - int val; - int brightness = q->brightness; - int scale = q->transfer_scale; - - if (!init) { - if (!read_darkmask ()) - return 0; - for (y = 0; y < MAX_HEIGHT; y++) - for (x = 0; x < MAX_HEIGHT; x++) - if (master_darkmask1[y][x] < smallest_dm) { - smallest_dm = master_darkmask1[y][x]; -#ifdef DEBUG - fprintf (stderr, "Smallest mask is %d at (%d, %d)\n", - smallest_dm, x, y); -#endif - } - init = 1; - } - - if (brightness < smallest_dm) { -#ifdef DEBUG - fprintf (stderr, - "Brightness %d (dark current starts at %d), no fixup needed\n", - brightness, smallest_dm); -#endif - return 1; - } - - width = q->width / scale; - height = q->height / scale; - - max_height = MAX_HEIGHT / scale; - max_width = MAX_WIDTH / scale; - for (y = 0; y < max_height; y++) - for (x = 0; x < max_width; x++) - if (scale == 1) { - darkmask[y][x] = master_darkmask1[y][x]; - } else if (scale == 2) { - darkmask[y][x] = master_darkmask2[y][x]; - } else if (scale == 4) { - darkmask[y][x] = master_darkmask4[y][x]; - } else { -#ifdef DEBUG - fprintf (stderr, "Bad transfer_scale in darkmask assignment!\n"); -#endif - return 0; - } - - do { - again = 0; - ccd_y = (q->top - 1) / scale; - for (y = 0; y < height; y++, ccd_y++) { - ccd_x = q->left - 1; - ccd_x /= 2; - ccd_x *= 2; - ccd_x /= scale; - for (x = 0; x < width; x++, ccd_x++) { - val = scan[y * width + x]; - if (brightness < darkmask[ccd_y][ccd_x]) { /* good pixel */ - new_image[y][x] = val; - } else { /* bad pixel */ - /* look at nearby pixels, average the good values */ - pixelcount = 0; - pixeltotal = 0; - if (x > 0) { /* left */ - if (brightness < darkmask[ccd_y][ccd_x - 1]) { - pixelcount++; - pixeltotal += scan[y * width + x - 1]; - } - } - if (x < width - 1) { /* right */ - if (brightness < darkmask[ccd_y][ccd_x + 1]) { - pixelcount++; - pixeltotal += scan[y * width + x + 1]; - } - } - if (y > 0) { /* above */ - if (brightness < darkmask[ccd_y - 1][ccd_x]) { - pixelcount++; - pixeltotal += scan[(y - 1) * width + x]; - } - } - if (y < height - 1) { /* below */ - if (brightness < darkmask[ccd_y + 1][ccd_x]) { - pixelcount++; - pixeltotal += scan[(y + 1) * width + x]; - } - } - - if (pixelcount == 0) { /* no valid neighbors! */ - again = 1; - } else { - new_image[y][x] = pixeltotal / pixelcount; - /* mark this pixel as valid, so we don't loop forever */ - darkmask[ccd_y][ccd_x] = 255; - } - } - } - } - - for (y = 0; y < height; y++) - for (x = 0; x < width; x++) - scan[y * width + x] = new_image[y][x]; - - } while (loopcount++ < MAX_LOOPS && again); -#ifdef DEBUG - fprintf (stderr, "Darkmask fix took %d loop%s\n", - loopcount, (loopcount == 1) ? "" : "s"); -#endif - return 1; -} diff --git a/sys/qcam/exposure.c b/sys/qcam/exposure.c deleted file mode 100644 index 8f18e488a..000000000 --- a/sys/qcam/exposure.c +++ /dev/null @@ -1,287 +0,0 @@ -/* exposure.c - * - * Time-stamp: <02 Sep 96 11:52:21 HST edo@eosys.com> - * - * Version 0.2 - */ - - -/****************************************************************** - -Copyright (C) 1996 by Ed Orcutt Systems - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, and/or distribute copies of the -Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -1. The above copyright notice and this permission notice shall - be included in all copies or substantial portions of the - Software. - -2. Redistribution for profit requires the express, written - permission of the author. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL ED ORCUTT SYSTEMS BE LIABLE -FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include "qcam.h" -#include "qcamip.h" - -/* Prototypes for private (static) functions used by the routines - * within this file. Externally visible functions should be - * prototyped in qcamip.h - */ - -static int qcip_pixel_average (struct qcam *q, scanbuf * scan); -static int qcip_luminance_std (struct qcam *q, scanbuf * scan, int avg); - -/* Private data used by the auto exposure routine */ - -static int luminance_target = -1; -static int luminance_tolerance = 0; -static int luminance_std_target = -1; -static int luminance_std_tolerance = 0; -static int ae_mode = AE_ALL_AVG; - -/* Calculate average pixel value for entire image */ - -static int -qcip_pixel_average (struct qcam *q, scanbuf * scan) -{ - int count = 0; - int sum = 0; - int pixels; - int i; - - pixels = q->height / q->transfer_scale; - pixels *= q->width / q->transfer_scale; - - for (i = 0; i < pixels; i++) { - sum += scan[i]; - count++; - } - return (sum / count); -} - -/* Calculate average pixel value for center of image */ - -static int -qcip_pixel_average_center (struct qcam *q, scanbuf * scan) -{ - int count = 0; - int sum = 0; - int height, width; - int maxrow, maxcol; - int i, j; - - /* actual image width & height after scaling */ - width = q->width / q->transfer_scale; - height = q->height / q->transfer_scale; - - maxcol = width * 2 / 3; - maxrow = height * 2 / 3; - - for (i = width / 3; i < maxcol; i++) { - for (j = height / 3; j < maxrow; j++) { - sum += scan[j * width + i]; - count++; - } - } - return (sum / count); -} - -int -qcip_set_luminance_target (struct qcam *q, int val) -{ - const int max_pixel_val = q->bpp == 6 ? 63 : 15; - - if ((val - luminance_tolerance) >= 0 && - (val + luminance_tolerance) <= max_pixel_val) { - luminance_target = val; - return QCIP_XPSR_OK; - } - return QCIP_XPSR_LUM_INVLD; -} - -int -qcip_set_luminance_tolerance (struct qcam *q, int val) -{ - const int max_pixel_val = q->bpp == 6 ? 63 : 15; - - /* set target if it has not been explicitly set */ - if (luminance_target == -1) { - luminance_target = q->bpp == 6 ? 32 : 8; - } - - if ((luminance_target - val) >= 0 && - (luminance_target + val) <= max_pixel_val) { - luminance_tolerance = val; - return QCIP_XPSR_OK; - } - return QCIP_XPSR_LUM_INVLD; -} - -int -qcip_set_luminance_std_target (struct qcam *q, int val) -{ - luminance_std_target = val; - return QCIP_XPSR_OK; -} - -int -qcip_set_luminance_std_tolerance (struct qcam *q, int val) -{ - luminance_std_tolerance = val; - return QCIP_XPSR_OK; -} - -int -qcip_set_autoexposure_mode (int val) -{ - ae_mode = val; - return 0; -} - -/* Calculate standard deviation of pixel value for entire image */ - -static int -qcip_luminance_std (struct qcam *q, scanbuf * scan, int avg) -{ - int count = 0; - int sum = 0; - int pixels; - int i; - - pixels = q->height / q->transfer_scale; - pixels *= q->width / q->transfer_scale; - - for (i = 0; i < pixels; i++) { - if (scan[i] < avg) { - sum += avg - scan[i]; - } else { - sum += scan[i] - avg; - } - count++; - } - return (sum / count); -} - - -/* If necessary adjust the brightness in an attempt to achieve - * a target average pixel value: 32 for 6 bpp, 8 for 4bpp. - * This routine *will* modify the brightness value in preparation - * for another scan unless the target average pixel values has - * been reached. If the exposure is correct (yes, I realize that - * this is subjective) QCIP_XPSR_OK will be returned, otherwise - * return QCIP_XPSR_RSCN after adjusting the exposure. - * - * Caveat: If the new calculated brightness value is invalid, - * QCIP_XPSR_ERR will be returned. - */ - -int -qcip_autoexposure (struct qcam *q, scanbuf * scan) -{ - int luminance_dif; - int luminance_avg; - int brightness_adj; - int lum_min, lum_max; - int lum_std, lum_std_min, lum_std_max; - int ret = QCIP_XPSR_OK; - -#ifdef DEBUG - fprintf (stderr, "Brightness: %d Contrast: %d\n", - qc_getbrightness (q), qc_getcontrast (q)); -#endif - - switch (ae_mode) { - case AE_CTR_AVG: - luminance_avg = qcip_pixel_average_center (q, scan); - break; - case AE_STD_AVG: - luminance_avg = qcip_pixel_average (q, scan); - lum_std = qcip_luminance_std (q, scan, luminance_avg); - - /* ==>> Contrast adjustment <<== */ - - /* set target if it has not been explicitly set */ - if (luminance_std_target == -1) { - luminance_std_target = q->bpp == 6 ? 10 : 2; - } - - /* Adjust contrast to reach target luminance standard deviation */ - lum_std_min = luminance_std_target - luminance_std_tolerance; - lum_std_max = luminance_std_target + luminance_std_tolerance; - - if (lum_std < lum_std_min || lum_std > lum_std_max) { - ret = QCIP_XPSR_RSCN; - if (qc_setcontrast (q, - luminance_std_target - lum_std + qc_getcontrast (q))) { - return QCIP_XPSR_ERR; - } - } -#ifdef DEBUG - fprintf (stderr, "Luminance std/target/tolerance: %d/%d/%d\n", - lum_std, luminance_std_target, luminance_std_tolerance); -#endif - - break; - case AE_ALL_AVG: - default: - luminance_avg = qcip_pixel_average (q, scan); - break; - } - - /* ==>> Brightness adjustment <<== */ - - /* set target if it has not been explicitly set */ - if (luminance_target == -1) { - luminance_target = q->bpp == 6 ? 32 : 8; - } - - lum_min = luminance_target - luminance_tolerance; - lum_max = luminance_target + luminance_tolerance; - -#ifdef DEBUG - fprintf (stderr, "Luminance avg/target/tolerance: %d/%d/%d\n", - luminance_avg, luminance_target, luminance_tolerance); -#endif - - /* check for luminance within target range */ - if (luminance_avg < lum_min || luminance_avg > lum_max) { - ret = QCIP_XPSR_RSCN; - /* we need to adjust the brighness, which way? */ - luminance_dif = luminance_target - luminance_avg; - if (luminance_dif > 0) { - brightness_adj = luminance_dif / 2 + 1; - } else { - brightness_adj = luminance_dif / 2 - 1; - } - - /* Adjusted brightness is out of range .. - * throw in the towel ... auto-exposure has failed! - */ - if (qc_setbrightness (q, brightness_adj + qc_getbrightness (q))) { - return QCIP_XPSR_ERR; - } - } - - return ret; -} diff --git a/sys/qcam/gstqcamsrc.c b/sys/qcam/gstqcamsrc.c deleted file mode 100644 index dbe774090..000000000 --- a/sys/qcam/gstqcamsrc.c +++ /dev/null @@ -1,445 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <sys/mman.h> -#include <string.h> - -/*#define DEBUG_ENABLED */ -#include <gstqcamsrc.h> -#include <gst/video/video.h> - -#include "qcamip.h" - -#define AE_NONE 3 - -#define DEF_WIDTH 320 -#define DEF_HEIGHT 224 -#define DEF_BRIGHTNESS 226 -#define DEF_WHITEBAL 128 -#define DEF_CONTRAST 72 -#define DEF_TOP 1 -#define DEF_LEFT 14 -#define DEF_TRANSFER_SCALE 2 -#define DEF_DEPTH 6 -#define DEF_PORT 0x378 -#define DEF_AUTOEXP AE_NONE - -static GstStaticPadTemplate gst_qcamsrc_src_factory = -GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")) - ); - -#define GST_TYPE_AUTOEXP_MODE (gst_autoexp_mode_get_type()) -static GType -gst_autoexp_mode_get_type (void) -{ - static GType autoexp_mode_type = 0; - static const GEnumValue autoexp_modes[] = { - {AE_ALL_AVG, "0", "Average Picture"}, - {AE_CTR_AVG, "1", "Average Center"}, - {AE_STD_AVG, "2", "Standard Deviation"}, - {AE_NONE, "3", "None"}, - {0, NULL, NULL}, - }; - - if (!autoexp_mode_type) { - autoexp_mode_type = - g_enum_register_static ("GstAutoExposureMode", autoexp_modes); - } - return autoexp_mode_type; -} - -/* QCamSrc signals and args */ -enum -{ - /* FILL ME */ - LAST_SIGNAL -}; - -enum -{ - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_BRIGHTNESS, - ARG_WHITEBAL, - ARG_CONTRAST, - ARG_TOP, - ARG_LEFT, - ARG_TRANSFER_SCALE, - ARG_DEPTH, - ARG_PORT, - ARG_AUTOEXP -}; - -static void gst_qcamsrc_base_init (gpointer g_class); -static void gst_qcamsrc_class_init (GstQCamSrcClass * klass); -static void gst_qcamsrc_init (GstQCamSrc * qcamsrc); - -static void gst_qcamsrc_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); -static void gst_qcamsrc_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); - -static GstStateChangeReturn gst_qcamsrc_change_state (GstElement * element, - GstStateChange transition); -static void gst_qcamsrc_close (GstQCamSrc * src); -static gboolean gst_qcamsrc_open (GstQCamSrc * src); - -static GstData *gst_qcamsrc_get (GstPad * pad); - -static GstElementClass *parent_class = NULL; - -/*//static guint gst_qcamsrc_signals[LAST_SIGNAL] = { 0 }; */ - -GType -gst_qcamsrc_get_type (void) -{ - static GType qcamsrc_type = 0; - - if (!qcamsrc_type) { - static const GTypeInfo qcamsrc_info = { - sizeof (GstQCamSrcClass), - gst_qcamsrc_base_init, - NULL, - (GClassInitFunc) gst_qcamsrc_class_init, - NULL, - NULL, - sizeof (GstQCamSrc), - 0, - (GInstanceInitFunc) gst_qcamsrc_init, - NULL - }; - - qcamsrc_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstQCamSrc", &qcamsrc_info, - 0); - } - return qcamsrc_type; -} - -static void -gst_qcamsrc_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_static_pad_template (element_class, - &gst_qcamsrc_src_factory); - gst_element_class_set_static_metadata (element_class, "QCam Source", - "Source/Video", "Read from a QuickCam device", - "Wim Taymans <wim.taymans@chello.be>"); -} - -static void -gst_qcamsrc_class_init (GstQCamSrcClass * klass) -{ - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, - g_param_spec_int ("width", "width", "width", - 0, 320, DEF_WIDTH, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, - g_param_spec_int ("height", "height", "height", - 0, 240, DEF_HEIGHT, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BRIGHTNESS, - g_param_spec_int ("brightness", "brightness", "brightness", - 0, 255, DEF_BRIGHTNESS, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WHITEBAL, - g_param_spec_int ("whitebal", "whitebal", "whitebal", - 0, 255, DEF_WHITEBAL, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONTRAST, - g_param_spec_int ("contrast", "contrast", "contrast", - 0, 255, DEF_CONTRAST, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOP, - g_param_spec_int ("top", "top", "top", - 0, 240, DEF_TOP, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEFT, - g_param_spec_int ("left", "left", "left", - 0, 320, DEF_LEFT, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TRANSFER_SCALE, - g_param_spec_int ("transfer_scale", "transfer_scale", "transfer_scale", - 1, 4, DEF_TRANSFER_SCALE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEPTH, - g_param_spec_int ("depth", "depth", "depth", - 4, 6, DEF_DEPTH, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT, - g_param_spec_int ("port", "port", "port", - 0, G_MAXINT, DEF_PORT, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_AUTOEXP, - g_param_spec_enum ("autoexposure", "autoexposure", "autoexposure", - GST_TYPE_AUTOEXP_MODE, DEF_AUTOEXP, G_PARAM_READWRITE)); - - gobject_class->set_property = gst_qcamsrc_set_property; - gobject_class->get_property = gst_qcamsrc_get_property; - - gstelement_class->change_state = gst_qcamsrc_change_state; -} - -static void -gst_qcamsrc_init (GstQCamSrc * qcamsrc) -{ - qcamsrc->srcpad = - gst_pad_new_from_static_template (&gst_qcamsrc_src_factory, "src"); - gst_element_add_pad (GST_ELEMENT (qcamsrc), qcamsrc->srcpad); - gst_pad_set_get_function (qcamsrc->srcpad, gst_qcamsrc_get); - - /* if the destination cannot say what it wants, we give this */ - qcamsrc->qcam = qc_init (); - qcamsrc->qcam->port = DEF_PORT; - qc_setwidth (qcamsrc->qcam, DEF_WIDTH); - qc_setheight (qcamsrc->qcam, DEF_HEIGHT); - qc_setbrightness (qcamsrc->qcam, DEF_BRIGHTNESS); - qc_setwhitebal (qcamsrc->qcam, DEF_WHITEBAL); - qc_setcontrast (qcamsrc->qcam, DEF_CONTRAST); - qc_settop (qcamsrc->qcam, DEF_TOP); - qc_setleft (qcamsrc->qcam, DEF_LEFT); - qc_settransfer_scale (qcamsrc->qcam, DEF_TRANSFER_SCALE); - qc_setbitdepth (qcamsrc->qcam, DEF_DEPTH); - qcamsrc->autoexposure = DEF_AUTOEXP; - if (qcamsrc->autoexposure != AE_NONE) - qcip_set_autoexposure_mode (qcamsrc->autoexposure); -} - -static GstData * -gst_qcamsrc_get (GstPad * pad) -{ - GstQCamSrc *qcamsrc; - GstBuffer *buf; - scanbuf *scan; - guchar *outdata; - gint i, frame, scale, convert; - - g_return_val_if_fail (pad != NULL, NULL); - - qcamsrc = GST_QCAMSRC (gst_pad_get_parent (pad)); - - scale = qc_gettransfer_scale (qcamsrc->qcam); - - frame = qcamsrc->qcam->width * qcamsrc->qcam->height / (scale * scale); - - buf = gst_buffer_new (); - outdata = GST_BUFFER_DATA (buf) = g_malloc0 ((frame * 3) / 2); - GST_BUFFER_SIZE (buf) = (frame * 3) / 2; - - qc_set (qcamsrc->qcam); - if (!GST_PAD_CAPS (pad)) { - gst_pad_try_set_caps (pad, gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, "I420", - "width", G_TYPE_INT, qcamsrc->qcam->width / scale, - "height", G_TYPE_INT, qcamsrc->qcam->height / scale, - "framerate", G_TYPE_DOUBLE, 10., NULL)); - } - scan = qc_scan (qcamsrc->qcam); - - /* FIXME, this doesn't seem to work... */ - /*fixdark(qcamsrc->qcam, scan); */ - - if (qcamsrc->autoexposure != AE_NONE) - qcip_autoexposure (qcamsrc->qcam, scan); - - convert = (qcamsrc->qcam->bpp == 4 ? 4 : 2); - - for (i = frame; i; i--) { - outdata[i] = scan[i] << convert; - } - memset (outdata + frame, 128, frame >> 1); - g_free (scan); - - return GST_DATA (buf); -} - -static void -gst_qcamsrc_set_property (GObject * object, guint prop_id, const GValue * value, - GParamSpec * pspec) -{ - GstQCamSrc *src; - - g_return_if_fail (GST_IS_QCAMSRC (object)); - src = GST_QCAMSRC (object); - - switch (prop_id) { - case ARG_WIDTH: - qc_setwidth (src->qcam, g_value_get_int (value)); - break; - case ARG_HEIGHT: - qc_setheight (src->qcam, g_value_get_int (value)); - break; - case ARG_BRIGHTNESS: - qc_setbrightness (src->qcam, g_value_get_int (value)); - break; - case ARG_WHITEBAL: - qc_setwhitebal (src->qcam, g_value_get_int (value)); - break; - case ARG_CONTRAST: - qc_setcontrast (src->qcam, g_value_get_int (value)); - break; - case ARG_TOP: - qc_settop (src->qcam, g_value_get_int (value)); - break; - case ARG_LEFT: - qc_setleft (src->qcam, g_value_get_int (value)); - break; - case ARG_TRANSFER_SCALE: - qc_settransfer_scale (src->qcam, g_value_get_int (value)); - break; - case ARG_DEPTH: - qc_setbitdepth (src->qcam, g_value_get_int (value)); - break; - case ARG_PORT: - src->qcam->port = g_value_get_int (value); - break; - case ARG_AUTOEXP: - src->autoexposure = g_value_get_enum (value); - if (src->autoexposure != AE_NONE) - qcip_set_autoexposure_mode (src->autoexposure); - break; - default: - break; - } -} - -static void -gst_qcamsrc_get_property (GObject * object, guint prop_id, GValue * value, - GParamSpec * pspec) -{ - GstQCamSrc *src; - - g_return_if_fail (GST_IS_QCAMSRC (object)); - src = GST_QCAMSRC (object); - - switch (prop_id) { - case ARG_WIDTH: - g_value_set_int (value, qc_getwidth (src->qcam)); - break; - case ARG_HEIGHT: - g_value_set_int (value, qc_getheight (src->qcam)); - break; - case ARG_BRIGHTNESS: - g_value_set_int (value, qc_getbrightness (src->qcam)); - break; - case ARG_WHITEBAL: - g_value_set_int (value, qc_getwhitebal (src->qcam)); - break; - case ARG_CONTRAST: - g_value_set_int (value, qc_getcontrast (src->qcam)); - break; - case ARG_TOP: - g_value_set_int (value, qc_gettop (src->qcam)); - break; - case ARG_LEFT: - g_value_set_int (value, qc_getleft (src->qcam)); - break; - case ARG_TRANSFER_SCALE: - g_value_set_int (value, qc_gettransfer_scale (src->qcam)); - break; - case ARG_DEPTH: - g_value_set_int (value, qc_getbitdepth (src->qcam)); - break; - case ARG_PORT: - g_value_set_int (value, src->qcam->port); - break; - case ARG_AUTOEXP: - g_value_set_enum (value, src->autoexposure); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GstStateChangeReturn -gst_qcamsrc_change_state (GstElement * element, GstStateChange transition) -{ - g_return_val_if_fail (GST_IS_QCAMSRC (element), FALSE); - - switch (transition) { - case GST_STATE_CHANGE_READY_TO_NULL: - if (GST_OBJECT_FLAG_IS_SET (element, GST_QCAMSRC_OPEN)) - gst_qcamsrc_close (GST_QCAMSRC (element)); - break; - case GST_STATE_CHANGE_NULL_TO_READY: - if (!GST_OBJECT_FLAG_IS_SET (element, GST_QCAMSRC_OPEN)) { - GST_DEBUG ("opening"); - if (!gst_qcamsrc_open (GST_QCAMSRC (element))) { - GST_DEBUG ("open failed"); - return GST_STATE_CHANGE_FAILURE; - } - } - break; - default: - break; - } - - if (GST_ELEMENT_CLASS (parent_class)->change_state) - return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); - - return GST_STATE_CHANGE_SUCCESS; -} - -static gboolean -gst_qcamsrc_open (GstQCamSrc * qcamsrc) -{ - if (qc_open (qcamsrc->qcam)) { - GST_ELEMENT_ERROR (qcamsrc, RESOURCE, OPEN_READ, (NULL), - ("Failed to open QuickCam")); - return FALSE; - } - - GST_OBJECT_FLAG_SET (qcamsrc, GST_QCAMSRC_OPEN); - - return TRUE; -} - -static void -gst_qcamsrc_close (GstQCamSrc * src) -{ - qc_close (src->qcam); - GST_OBJECT_FLAG_UNSET (src, GST_QCAMSRC_OPEN); -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - if (!gst_element_register (plugin, "qcamsrc", GST_RANK_NONE, - GST_TYPE_QCAMSRC)) - return FALSE; - - return TRUE; -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - qcamsrc, - "Read from a QuickCam device", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/sys/qcam/gstqcamsrc.h b/sys/qcam/gstqcamsrc.h deleted file mode 100644 index a617b8d19..000000000 --- a/sys/qcam/gstqcamsrc.h +++ /dev/null @@ -1,78 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> - * - * 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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - - -#ifndef __GST_QCAMSRC_H__ -#define __GST_QCAMSRC_H__ - - -#include <gst/gst.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** QuickCam include files */ -#include "qcam.h" -#include "qcam-os.h" - -#define GST_TYPE_QCAMSRC \ - (gst_qcamsrc_get_type()) -#define GST_QCAMSRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QCAMSRC,GstQCamSrc)) -#define GST_QCAMSRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QCAMSRC,GstQCamSrcClass)) -#define GST_IS_QCAMSRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QCAMSRC)) -#define GST_IS_QCAMSRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QCAMSRC)) - -/* NOTE: per-element flags start with 16 for now */ -typedef enum { - GST_QCAMSRC_OPEN = (GST_ELEMENT_FLAG_LAST << 0), - - GST_QCAMSRC_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 2), -} GstQCamSrcFlags; - -typedef struct _GstQCamSrc GstQCamSrc; -typedef struct _GstQCamSrcClass GstQCamSrcClass; - -struct _GstQCamSrc { - GstElement element; - - /* pads */ - GstPad *srcpad; - - struct qcam *qcam; - gboolean autoexposure; - gint port; -}; - -struct _GstQCamSrcClass { - GstElementClass parent_class; -}; - -GType gst_qcamsrc_get_type(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GST_QCAMSRC_H__ */ diff --git a/sys/qcam/qcam-Linux.c b/sys/qcam/qcam-Linux.c deleted file mode 100644 index 07e69170b..000000000 --- a/sys/qcam/qcam-Linux.c +++ /dev/null @@ -1,277 +0,0 @@ -/* qcam-Linux.c -- Linux-specific routines for accessing QuickCam */ - -/* Version 0.1, January 2, 1996 */ -/* Version 0.5, August 24, 1996 */ - -#define LOCALSTATEDIR "" -//#define LOCALSTATEDIR "/var/run" - -/****************************************************************** - -Copyright (C) 1996 by Scott Laird - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL SCOTT LAIRD BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <unistd.h> -#ifdef TESTING -#include <errno.h> -#endif -#include <sys/io.h> - -#include <sys/time.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -#include "qcam.h" -#include "qcam-Linux.h" - -int __inline__ -read_lpstatus (const struct qcam *q) -{ - return inb (q->port + 1); -} - -int -read_lpcontrol (const struct qcam *q) -{ - return inb (q->port + 2); -} - -int -read_lpdata (const struct qcam *q) -{ - return inb (q->port); -} - -void -write_lpdata (const struct qcam *q, int d) -{ - outb (d, q->port); -} - -void -write_lpcontrol (const struct qcam *q, int d) -{ - outb (d, q->port + 2); -} - -int -enable_ports (const struct qcam *q) -{ - if (q->port < 0x278) - return 1; /* Better safe than sorry */ - if (q->port > 0x3bc) - return 1; - return (ioperm (q->port, 3, 1)); -} - -int -disable_ports (const struct qcam *q) -{ - return (ioperm (q->port, 3, 0)); -} - -/* Lock port. This is currently sub-optimal, and is begging to be - fixed. It should check for dead locks. Any takers? */ - -/* qc_lock_wait - * This function uses POSIX fcntl-style locking on a file created in the - * /tmp directory. Because it uses the Unix record locking facility, locks - * are relinquished automatically on process termination, so "dead locks" - * are not a problem. (FYI, the lock file will remain after process - * termination, but this is actually desired so that the next process need - * not re-creat(2)e it... just lock it.) - * The wait argument indicates whether or not this funciton should "block" - * waiting for the previous lock to be relinquished. This is ideal so that - * multiple processes (eg. qcam) taking "snapshots" can peacefully coexist. - * - Dave Plonka (plonka@carroll1.cc.edu) - */ -int -qc_lock_wait (struct qcam *q, int wait) -{ -#if 1 - static struct flock sfl; - - if (-1 == q->fd) { /* we've yet to open the lock file */ - static char lockfile[128]; - - sprintf (lockfile, LOCALSTATEDIR "/LOCK.qcam.0x%x", q->port); - if (-1 == (q->fd = open (lockfile, O_WRONLY | O_CREAT, 0666))) { - perror ("open"); - return 1; - } -#ifdef TESTING - fprintf (stderr, "%s - %d: %s open(2)ed\n", __FILE__, __LINE__, lockfile); -#endif - - /* initialize the l_type memver to lock the file exclusively */ - sfl.l_type = F_WRLCK; - } -#ifdef TESTING - if (0 != fcntl (q->fd, F_SETLK, &sfl)) /* non-blocking set lock */ -#else - if (0 != fcntl (q->fd, wait ? F_SETLKW : F_SETLK, &sfl)) -#endif - { -#ifdef TESTING - perror ("fcntl"); - if (EAGAIN != errno || !wait) - return 1; - - fprintf (stderr, "%s - %d: waiting for exclusive lock on fd %d...\n", - __FILE__, __LINE__, q->fd); - - if (0 != fcntl (q->fd, F_SETLKW, &sfl)) /* "blocking" set lock */ -#endif - { - perror ("fcntl"); - return 1; - } - } -#ifdef TESTING - fprintf (stderr, "%s - %d: fd %d locked exclusively\n", __FILE__, __LINE__, - q->fd); -#endif - -#else - char lockfile[128], tmp[128]; - struct stat statbuf; - - sprintf (lockfile, LOCALSTATEDIR "/LOCK.qcam.0x%x", q->port); - sprintf (tmp, "%s-%d", lockfile, getpid ()); - - if ((creat (tmp, 0) == -1) || - (link (tmp, lockfile) == -1) || - (stat (tmp, &statbuf) == -1) || (statbuf.st_nlink == 1)) { -#ifdef DEBUGQC - perror ("QuickCam Locked"); - if (unlink (tmp) == -1) - perror ("Error unlinking temp file."); -#else - unlink (tmp); -#endif - return 1; - } - - unlink (tmp); - if (chown (lockfile, getuid (), getgid ()) == -1) - perror ("Chown problems"); -#endif - - return 0; -} - -int -qc_lock (struct qcam *q) -{ -#if 1 - return qc_lock_wait (q, 1 /*wait */ ); -#else - return qc_lock_wait (q, 0 /*don't wait */ ); -#endif -} - -/* Unlock port */ - -int -qc_unlock (struct qcam *q) -{ - static struct flock sfl; - -#if 1 - if (-1 == q->fd) { /* port was not locked */ - return 1; - } - - /* clear the exclusive lock */ - sfl.l_type = F_UNLCK; - if (0 != fcntl (q->fd, F_SETLK, &sfl)) { - perror ("fcntl"); - return 1; - } -#ifdef TESTING - fprintf (stderr, "%s - %d: fd %d unlocked\n", __FILE__, __LINE__, q->fd); -#endif - -#else - char lockfile[128]; - - sprintf (lockfile, LOCALSTATEDIR "/LOCK.qcam.0x%x", q->port); - unlink (lockfile); /* What would I do with an error? */ -#endif - - return 0; -} - - -/* Probe for camera. Returns 0 if found, 1 if not found, sets - q->port.*/ - -int -qc_probe (struct qcam *q) -{ - int ioports[] = { 0x378, 0x278, 0x3bc, 0 }; - int i = 0; - - /* Attempt to get permission to access IO ports. Must be root */ - - while (ioports[i] != 0) { - q->port = ioports[i++]; - - if (qc_open (q)) { - perror ("Can't get I/O permission"); - exit (1); - } - - if (qc_detect (q)) { - fprintf (stderr, "QuickCam detected at 0x%x\n", q->port); - qc_close (q); - return (0); - } else - qc_close (q); - } - - return 1; -} - - -/* THIS IS UGLY. I need a short delay loop -- somthing well under a -millisecond. Unfortunately, adding 2 usleep(1)'s to qc_command slowed -it down by a factor of over 1000 over the same loop with 2 -usleep(0)'s, and that's too slow -- qc_start was taking over a second -to run. This seems to help, but if anyone has a good -speed-independent pause routine, please tell me. -- Scott */ - -void -qc_wait (int val) -{ - int i; - - while (val--) - for (i = 0; i < 50000; i++); -} diff --git a/sys/qcam/qcam-Linux.h b/sys/qcam/qcam-Linux.h deleted file mode 100644 index 46dcbe519..000000000 --- a/sys/qcam/qcam-Linux.h +++ /dev/null @@ -1,32 +0,0 @@ -/* qcam-linux.h -- Linux-specific routines for accessing QuickCam */ - -/* Version 0.1, January 2, 1996 */ -/* Version 0.5, August 24, 1996 */ - - -/****************************************************************** - -Copyright (C) 1996 by Scott Laird - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL SCOTT LAIRD BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -******************************************************************/ - - diff --git a/sys/qcam/qcam-lib.c b/sys/qcam/qcam-lib.c deleted file mode 100644 index c472e5778..000000000 --- a/sys/qcam/qcam-lib.c +++ /dev/null @@ -1,849 +0,0 @@ -/* qcam-lib.c -- Library for programming with the Connectix QuickCam. - * See the included documentation for usage instructions and details - * of the protocol involved. */ - - -/* Version 0.5, August 4, 1996 */ -/* Version 0.7, August 27, 1996 */ -/* Version 0.9, November 17, 1996 */ - - -/****************************************************************** - -Copyright (C) 1996 by Scott Laird - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL SCOTT LAIRD BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> - -#include <unistd.h> - -#include <assert.h> - -#include "qcam.h" -#include "qcam-os.h" -#include "qcam-os.c" - -/* Prototypes for static functions. Externally visible functions - * should be prototyped in qcam.h */ - -static int qc_waithand (const struct qcam *q, int val); -static int qc_command (const struct qcam *q, int command); -static int qc_readparam (const struct qcam *q); -static int qc_setscanmode (struct qcam *q); -static int qc_readbytes (const struct qcam *q, char buffer[]); - -/* The next several functions are used for controlling the qcam - * structure. They aren't used inside this library, but they should - * provide a clean interface for external programs.*/ - -/* Gets/sets the brightness. */ - -int -qc_getbrightness (const struct qcam *q) -{ - return q->brightness; -} - -int -qc_setbrightness (struct qcam *q, int val) -{ - if (val >= 0 && val <= 255) { - q->brightness = val; - return 0; - } - return 1; -} - - -/* Gets/sets the contrast */ - -int -qc_getcontrast (const struct qcam *q) -{ - return q->contrast; -} - -int -qc_setcontrast (struct qcam *q, int val) -{ - if (val >= 0 && val <= 255) { - q->contrast = val; - return 0; - } - return 1; -} - - -/* Gets/sets the white balance */ - -int -qc_getwhitebal (const struct qcam *q) -{ - return q->whitebal; -} - -int -qc_setwhitebal (struct qcam *q, int val) -{ - if (val >= 0 && val <= 255) { - q->whitebal = val; - return 0; - } - return 1; -} - - -/* Gets/sets the resolution */ - -void -qc_getresolution (const struct qcam *q, int *x, int *y) -{ - *x = q->width; - *y = q->height; -} - -int -qc_setresolution (struct qcam *q, int x, int y) -{ - if (x >= 0 && x <= 336 && y >= 0 && y <= 243) { - q->width = x; - q->height = y; - return 0; - } - return 1; -} - -int -qc_getheight (const struct qcam *q) -{ - return q->height; -} - -int -qc_setheight (struct qcam *q, int y) -{ - if (y >= 0 && y <= 243) { - q->height = y; - return 0; - } - return 1; -} - -int -qc_getwidth (const struct qcam *q) -{ - return q->width; -} - -int -qc_setwidth (struct qcam *q, int x) -{ - if (x >= 0 && x <= 336) { - q->width = x; - return 0; - } - return 1; -} - -/* Gets/sets the bit depth */ - -int -qc_getbitdepth (const struct qcam *q) -{ - return q->bpp; -} - -int -qc_setbitdepth (struct qcam *q, int val) -{ - if (val == 4 || val == 6) { - q->bpp = val; - return qc_setscanmode (q); - } - return 1; -} - -int -qc_gettop (const struct qcam *q) -{ - return q->top; -} - -int -qc_settop (struct qcam *q, int val) -{ - if (val >= 1 && val <= 243) { - q->top = val; - return 0; - } - return 1; -} - -int -qc_getleft (const struct qcam *q) -{ - return q->left; -} - -int -qc_setleft (struct qcam *q, int val) -{ - if (val % 2 == 0 && val >= 2 && val <= 336) { - q->left = val; - return 0; - } - return 1; -} - -int -qc_gettransfer_scale (const struct qcam *q) -{ - return q->transfer_scale; -} - -int -qc_settransfer_scale (struct qcam *q, int val) -{ - if (val == 1 || val == 2 || val == 4) { - q->transfer_scale = val; - return qc_setscanmode (q); - } - return 1; -} - -int -qc_calibrate (struct qcam *q) -/* bugfix by Hanno Mueller hmueller@kabel.de, Mai 21 96 */ -/* The white balance is an individiual value for each */ -/* quickcam. Run calibration once, write the value down */ -/* and put it in your qcam.conf file. You won't need to */ -/* recalibrate your camera again. */ -{ - int value; - -#ifdef DEBUG - int count = 0; -#endif - - qc_command (q, 27); /* AutoAdjustOffset */ - qc_command (q, 0); /* Dummy Parameter, ignored by the camera */ - - /* GetOffset (33) will read 255 until autocalibration */ - /* is finished. After that, a value of 1-254 will be */ - /* returned. */ - - do { - qc_command (q, 33); - value = qc_readparam (q); -#ifdef DEBUG - count++; -#endif - } while (value == 0xff); - - q->whitebal = value; - -#ifdef DEBUG - fprintf (stderr, "%d loops to calibrate\n", count); - fprintf (stderr, "Calibrated to %d\n", value); -#endif - - return value; -} - -int -qc_forceunidir (struct qcam *q) -{ - q->port_mode = (q->port_mode & ~QC_FORCE_MASK) | QC_FORCE_UNIDIR; - return 0; -} - - -/* Initialize the QuickCam driver control structure. This is where - * defaults are set for people who don't have a config file.*/ -struct qcam * -qc_init (void) -{ - struct qcam *q; - - q = malloc (sizeof (struct qcam)); - - q->port = 0; /* Port 0 == Autoprobe */ - q->port_mode = (QC_ANY | QC_NOTSET); - q->width = 160; - q->height = 120; - q->bpp = 4; - q->transfer_scale = 2; - q->contrast = 104; - q->brightness = 150; - q->whitebal = 150; - q->top = 1; - q->left = 14; - q->mode = -1; - q->fd = -1; /* added initialization of fd member - * BTW, there doesn't seem to be a place to close this fd... - * I think we need a qc_free function. - * - Dave Plonka (plonka@carroll1.cc.edu) - */ - - return q; -} - - -/* qc_open enables access to the port specified in q->port. It takes - * care of locking and enabling I/O port access by calling the - * appropriate routines. - * - * Returns 0 for success, 1 for opening error, 2 for locking error, - * and 3 for qcam not found */ - -int -qc_open (struct qcam *q) -{ - if (q->port == 0) - if (qc_probe (q)) { - fprintf (stderr, "Qcam not found\n"); - return 3; - } - - if (qc_lock (q)) { - fprintf (stderr, "Cannot lock qcam.\n"); - return 2; - } - - if (enable_ports (q)) { - fprintf (stderr, "Cannot open QuickCam -- permission denied."); - return 1; - } else { - return 0; - } -} - - -/* qc_close closes and unlocks the driver. You *need* to call this, - * or lockfiles will be left behind and everything will be screwed. */ - -int -qc_close (struct qcam *q) -{ - qc_unlock (q); - - disable_ports (q); - return 0; -} - - -/* qc_command is probably a bit of a misnomer -- it's used to send - * bytes *to* the camera. Generally, these bytes are either commands - * or arguments to commands, so the name fits, but it still bugs me a - * bit. See the documentation for a list of commands. */ - -static int -qc_command (const struct qcam *q, int command) -{ - int n1, n2; - int cmd; - - write_lpdata (q, command); - write_lpcontrol (q, 6); - - n1 = qc_waithand (q, 1); - - write_lpcontrol (q, 0xe); - n2 = qc_waithand (q, 0); - - cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4); -#ifdef DEBUG - if (cmd != command) { - fprintf (stderr, "Command 0x%02x sent, 0x%02x echoed", command, cmd); - n2 = read_lpstatus (q); - cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4); - if (cmd != command) - fprintf (stderr, " (re-read does not help)\n"); - else - fprintf (stderr, " (fixed on re-read)\n"); - } -#endif - return cmd; -} - -static int -qc_readparam (const struct qcam *q) -{ - int n1, n2; - int cmd; - - write_lpcontrol (q, 6); - n1 = qc_waithand (q, 1); - - write_lpcontrol (q, 0xe); - n2 = qc_waithand (q, 0); - - cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4); - return cmd; -} - -/* qc_waithand busy-waits for a handshake signal from the QuickCam. - * Almost all communication with the camera requires handshaking. */ - -static int -qc_waithand (const struct qcam *q, int val) -{ - int status; - - if (val) - while (!((status = read_lpstatus (q)) & 8)); - else - while (((status = read_lpstatus (q)) & 8)); - - return status; -} - -/* Waithand2 is used when the qcam is in bidirectional mode, and the - * handshaking signal is CamRdy2 (bit 0 of data reg) instead of CamRdy1 - * (bit 3 of status register). It also returns the last value read, - * since this data is useful. */ - -static unsigned int -qc_waithand2 (const struct qcam *q, int val) -{ - unsigned int status; - - do { - status = read_lpdata (q); - } while ((status & 1) != val); - - return status; -} - - -/* Try to detect a QuickCam. It appears to flash the upper 4 bits of - the status register at 5-10 Hz. This is only used in the autoprobe - code. Be aware that this isn't the way Connectix detects the - camera (they send a reset and try to handshake), but this should be - almost completely safe, while their method screws up my printer if - I plug it in before the camera. */ - -int -qc_detect (const struct qcam *q) -{ - int reg, lastreg; - int count = 0; - int i; - - lastreg = reg = read_lpstatus (q) & 0xf0; - - for (i = 0; i < 30; i++) { - reg = read_lpstatus (q) & 0xf0; - if (reg != lastreg) - count++; - lastreg = reg; - usleep (10000); - } - - /* Be liberal in what you accept... */ - - if (count > 3 && count < 15) - return 1; /* found */ - else - return 0; /* not found */ -} - - -/* Reset the QuickCam. This uses the same sequence the Windows - * QuickPic program uses. Someone with a bi-directional port should - * check that bi-directional mode is detected right, and then - * implement bi-directional mode in qc_readbyte(). */ - -void -qc_reset (struct qcam *q) -{ - switch (q->port_mode & QC_FORCE_MASK) { - case QC_FORCE_UNIDIR: - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; - break; - - case QC_FORCE_BIDIR: - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; - break; - - case QC_ANY: - write_lpcontrol (q, 0x20); - write_lpdata (q, 0x75); - - if (read_lpdata (q) != 0x75) { - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; - } else { - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; - } - break; - - case QC_FORCE_SERIAL: - default: - fprintf (stderr, "Illegal port_mode %x\n", q->port_mode); - break; - } - - /* usleep(250); */ - write_lpcontrol (q, 0xb); - usleep (250); - write_lpcontrol (q, 0xe); - (void) qc_setscanmode (q); /* in case port_mode changed */ -} - - -/* Decide which scan mode to use. There's no real requirement that - * the scanmode match the resolution in q->height and q-> width -- the - * camera takes the picture at the resolution specified in the - * "scanmode" and then returns the image at the resolution specified - * with the resolution commands. If the scan is bigger than the - * requested resolution, the upper-left hand corner of the scan is - * returned. If the scan is smaller, then the rest of the image - * returned contains garbage. */ - -static int -qc_setscanmode (struct qcam *q) -{ - switch (q->transfer_scale) { - case 1: - q->mode = 0; - break; - case 2: - q->mode = 4; - break; - case 4: - q->mode = 8; - break; - default: - return 1; - } - - switch (q->bpp) { - case 4: - break; - case 6: - q->mode += 2; - break; - default: - fprintf (stderr, "Error: Unsupported bit depth\n"); - return 1; - } - - switch (q->port_mode & QC_MODE_MASK) { - case QC_BIDIR: - q->mode += 1; - break; - case QC_NOTSET: - case QC_UNIDIR: - break; - default: - return 1; - } - return 0; -} - - -/* Reset the QuickCam and program for brightness, contrast, - * white-balance, and resolution. */ - -void -qc_set (struct qcam *q) -{ - int val; - int val2; - - qc_reset (q); - - /* Set the brightness. Yes, this is repetitive, but it works. - * Shorter versions seem to fail subtly. Feel free to try :-). */ - /* I think the problem was in qc_command, not here -- bls */ - qc_command (q, 0xb); - qc_command (q, q->brightness); - - val = q->height / q->transfer_scale; - qc_command (q, 0x11); - qc_command (q, val); - if ((q->port_mode & QC_MODE_MASK) == QC_UNIDIR && q->bpp == 6) { - /* The normal "transfers per line" calculation doesn't seem to work - as expected here (and yet it works fine in qc_scan). No idea - why this case is the odd man out. Fortunately, Laird's original - working version gives me a good way to guess at working values. - -- bls */ - val = q->width; - val2 = q->transfer_scale * 4; - } else { - val = q->width * q->bpp; - val2 = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) * - q->transfer_scale; - } - val = (val + val2 - 1) / val2; - qc_command (q, 0x13); - qc_command (q, val); - - /* I still don't know what these do! */ - /* They're setting top and left -- bls */ - qc_command (q, 0xd); - qc_command (q, q->top); - qc_command (q, 0xf); - qc_command (q, q->left / 2); - - qc_command (q, 0x19); - qc_command (q, q->contrast); - qc_command (q, 0x1f); - qc_command (q, q->whitebal); -} - - -/* Qc_readbytes reads some bytes from the QC and puts them in - the supplied buffer. It returns the number of bytes read, - or -1 on error. */ - -static int __inline__ -qc_readbytes (const struct qcam *q, char buffer[]) -{ - int ret; - unsigned int hi, lo; - unsigned int hi2, lo2; - static unsigned int saved_bits; - static int state = 0; - - if (buffer == NULL) { - state = 0; - return 0; - } - - switch (q->port_mode & QC_MODE_MASK) { - case QC_BIDIR: /* Bi-directional Port */ - write_lpcontrol (q, 0x26); - lo = (qc_waithand2 (q, 1) >> 1); - hi = (read_lpstatus (q) >> 3) & 0x1f; - write_lpcontrol (q, 0x2e); - lo2 = (qc_waithand2 (q, 0) >> 1); - hi2 = (read_lpstatus (q) >> 3) & 0x1f; - switch (q->bpp) { - case 4: - buffer[0] = lo & 0xf; - buffer[1] = ((lo & 0x70) >> 4) | ((hi & 1) << 3); - buffer[2] = (hi & 0x1e) >> 1; - buffer[3] = lo2 & 0xf; - buffer[4] = ((lo2 & 0x70) >> 4) | ((hi2 & 1) << 3); - buffer[5] = (hi2 & 0x1e) >> 1; - ret = 6; - break; - case 6: - buffer[0] = lo & 0x3f; - buffer[1] = ((lo & 0x40) >> 6) | (hi << 1); - buffer[2] = lo2 & 0x3f; - buffer[3] = ((lo2 & 0x40) >> 6) | (hi2 << 1); - ret = 4; - break; - default: - fprintf (stderr, "Bad bidir pixel depth %d\n", q->bpp); - ret = -1; - break; - } - break; - - case QC_UNIDIR: /* Unidirectional Port */ - write_lpcontrol (q, 6); - lo = (qc_waithand (q, 1) & 0xf0) >> 4; - write_lpcontrol (q, 0xe); - hi = (qc_waithand (q, 0) & 0xf0) >> 4; - - switch (q->bpp) { - case 4: - buffer[0] = lo; - buffer[1] = hi; - ret = 2; - break; - case 6: - switch (state) { - case 0: - buffer[0] = (lo << 2) | ((hi & 0xc) >> 2); - saved_bits = (hi & 3) << 4; - state = 1; - ret = 1; - break; - case 1: - buffer[0] = lo | saved_bits; - saved_bits = hi << 2; - state = 2; - ret = 1; - break; - case 2: - buffer[0] = ((lo & 0xc) >> 2) | saved_bits; - buffer[1] = ((lo & 3) << 4) | hi; - state = 0; - ret = 2; - break; - default: - fprintf (stderr, "Unidir 6-bit state %d?\n", state); - ret = -1; - break; - } - break; - default: - fprintf (stderr, "Bad unidir pixel depth %d\n", q->bpp); - ret = -1; - break; - } - break; - case QC_SERIAL: /* Serial Interface. Just in case. */ - default: - fprintf (stderr, "Mode %x not supported\n", q->port_mode); - ret = -1; - break; - } - return ret; -} - -/* Read a scan from the QC. This takes the qcam structure and - * requests a scan from the camera. It sends the correct instructions - * to the camera and then reads back the correct number of bytes. In - * previous versions of this routine the return structure contained - * the raw output from the camera, and there was a 'qc_convertscan' - * function that converted that to a useful format. In version 0.3 I - * rolled qc_convertscan into qc_scan and now I only return the - * converted scan. The format is just an one-dimensional array of - * characters, one for each pixel, with 0=black up to n=white, where - * n=2^(bit depth)-1. Ask me for more details if you don't understand - * this. */ - -scanbuf * -qc_scan (const struct qcam * q) -{ - unsigned char *ret; - int i, j, k; - int bytes; - int linestotrans, transperline; - int divisor; - int pixels_per_line; - int pixels_read; - char buffer[6]; - char invert; - - if (q->mode != -1) { - qc_command (q, 0x7); - qc_command (q, q->mode); - } else { - struct qcam bogus_cam; - - /* We're going through these odd hoops to retain the "const" - qualification on q. We can't do a qc_setscanmode directly on q, - so we copy it, do a setscanmode on that, and pass in the newly - computed mode. -- bls 11/21/96 - */ - -#ifdef DEBUG - fprintf (stderr, "Warning! qc->mode not set!\n"); -#endif - bogus_cam = *q; - (void) qc_setscanmode (&bogus_cam); - qc_command (q, 0x7); - qc_command (q, bogus_cam.mode); - } - - if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) { - write_lpcontrol (q, 0x2e); /* turn port around */ - write_lpcontrol (q, 0x26); - (void) qc_waithand (q, 1); - write_lpcontrol (q, 0x2e); - (void) qc_waithand (q, 0); - } - - /* strange -- should be 15:63 below, but 4bpp is odd */ - invert = (q->bpp == 4) ? 16 : 63; - - linestotrans = q->height / q->transfer_scale; - pixels_per_line = q->width / q->transfer_scale; - transperline = q->width * q->bpp; - divisor = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) * - q->transfer_scale; - transperline = (transperline + divisor - 1) / divisor; - - ret = malloc (linestotrans * pixels_per_line); - assert (ret); - -#ifdef DEBUG - fprintf (stderr, "%s %d bpp\n%d lines of %d transfers each\n", - ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? "Bidir" : "Unidir", - q->bpp, linestotrans, transperline); -#endif - - for (i = 0; i < linestotrans; i++) { - for (pixels_read = j = 0; j < transperline; j++) { - bytes = qc_readbytes (q, buffer); - assert (bytes > 0); - for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) { - assert (buffer[k] <= invert); - assert (buffer[k] >= 0); - if (buffer[k] == 0 && invert == 16) { - /* 4bpp is odd (again) -- inverter is 16, not 15, but output - must be 0-15 -- bls */ - buffer[k] = 16; - } - ret[i * pixels_per_line + pixels_read + k] = invert - buffer[k]; - } - pixels_read += bytes; - } - (void) qc_readbytes (q, 0); /* reset state machine */ - } - - if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) { - write_lpcontrol (q, 2); - write_lpcontrol (q, 6); - usleep (3); - write_lpcontrol (q, 0xe); - } - - return ret; -} - - -void -qc_dump (const struct qcam *q, char *fname) -{ - FILE *fp; - time_t t; - - if ((fp = fopen (fname, "w")) == 0) { - fprintf (stderr, "Error: cannot open %s\n", fname); - return; - } - - fprintf (fp, "# Version 0.9\n"); - time (&t); - fprintf (fp, "# Created %s", ctime (&t)); - fprintf (fp, "Width %d\nHeight %d\n", q->width, q->height); - fprintf (fp, "Top %d\nLeft %d\n", q->top, q->left); - fprintf (fp, "Bpp %d\nContrast %d\n", q->bpp, q->contrast); - fprintf (fp, "Brightness %d\nWhitebal %d\n", q->brightness, q->whitebal); - fprintf (fp, "Port 0x%x\nScale %d\n", q->port, q->transfer_scale); - fclose (fp); -} diff --git a/sys/qcam/qcam-os.c b/sys/qcam/qcam-os.c deleted file mode 100644 index 5a8f12591..000000000 --- a/sys/qcam/qcam-os.c +++ /dev/null @@ -1,277 +0,0 @@ -/* qcam-Linux.c -- Linux-specific routines for accessing QuickCam */ - -/* Version 0.1, January 2, 1996 */ -/* Version 0.5, August 24, 1996 */ - -#define LOCALSTATEDIR "" -//#define LOCALSTATEDIR "/var/run" - -/****************************************************************** - -Copyright (C) 1996 by Scott Laird - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL SCOTT LAIRD BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <unistd.h> -#ifdef TESTING -#include <errno.h> -#endif -#include <sys/io.h> - -#include <sys/time.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -#include "qcam.h" -#include "qcam-Linux.h" - -int __inline__ -read_lpstatus (const struct qcam *q) -{ - return inb (q->port + 1); -} - -int -read_lpcontrol (const struct qcam *q) -{ - return inb (q->port + 2); -} - -int -read_lpdata (const struct qcam *q) -{ - return inb (q->port); -} - -void -write_lpdata (const struct qcam *q, int d) -{ - outb (d, q->port); -} - -void -write_lpcontrol (const struct qcam *q, int d) -{ - outb (d, q->port + 2); -} - -int -enable_ports (const struct qcam *q) -{ - if (q->port < 0x278) - return 1; /* Better safe than sorry */ - if (q->port > 0x3bc) - return 1; - return (ioperm (q->port, 3, 1)); -} - -int -disable_ports (const struct qcam *q) -{ - return (ioperm (q->port, 3, 0)); -} - -/* Lock port. This is currently sub-optimal, and is begging to be - fixed. It should check for dead locks. Any takers? */ - -/* qc_lock_wait - * This function uses POSIX fcntl-style locking on a file created in the - * /tmp directory. Because it uses the Unix record locking facility, locks - * are relinquished automatically on process termination, so "dead locks" - * are not a problem. (FYI, the lock file will remain after process - * termination, but this is actually desired so that the next process need - * not re-creat(2)e it... just lock it.) - * The wait argument indicates whether or not this funciton should "block" - * waiting for the previous lock to be relinquished. This is ideal so that - * multiple processes (eg. qcam) taking "snapshots" can peacefully coexist. - * - Dave Plonka (plonka@carroll1.cc.edu) - */ -int -qc_lock_wait (struct qcam *q, int wait) -{ -#if 1 - static struct flock sfl; - - if (-1 == q->fd) { /* we've yet to open the lock file */ - static char lockfile[128]; - - sprintf (lockfile, LOCALSTATEDIR "LOCK.qcam.0x%x", q->port); - if (-1 == (q->fd = open (lockfile, O_WRONLY | O_CREAT, 0666))) { - perror ("open"); - return 1; - } -#ifdef TESTING - fprintf (stderr, "%s - %d: %s open(2)ed\n", __FILE__, __LINE__, lockfile); -#endif - - /* initialize the l_type memver to lock the file exclusively */ - sfl.l_type = F_WRLCK; - } -#ifdef TESTING - if (0 != fcntl (q->fd, F_SETLK, &sfl)) /* non-blocking set lock */ -#else - if (0 != fcntl (q->fd, wait ? F_SETLKW : F_SETLK, &sfl)) -#endif - { -#ifdef TESTING - perror ("fcntl"); - if (EAGAIN != errno || !wait) - return 1; - - fprintf (stderr, "%s - %d: waiting for exclusive lock on fd %d...\n", - __FILE__, __LINE__, q->fd); - - if (0 != fcntl (q->fd, F_SETLKW, &sfl)) /* "blocking" set lock */ -#endif - { - perror ("fcntl"); - return 1; - } - } -#ifdef TESTING - fprintf (stderr, "%s - %d: fd %d locked exclusively\n", __FILE__, __LINE__, - q->fd); -#endif - -#else - char lockfile[128], tmp[128]; - struct stat statbuf; - - sprintf (lockfile, LOCALSTATEDIR "/LOCK.qcam.0x%x", q->port); - sprintf (tmp, "%s-%d", lockfile, getpid ()); - - if ((creat (tmp, 0) == -1) || - (link (tmp, lockfile) == -1) || - (stat (tmp, &statbuf) == -1) || (statbuf.st_nlink == 1)) { -#ifdef DEBUGQC - perror ("QuickCam Locked"); - if (unlink (tmp) == -1) - perror ("Error unlinking temp file."); -#else - unlink (tmp); -#endif - return 1; - } - - unlink (tmp); - if (chown (lockfile, getuid (), getgid ()) == -1) - perror ("Chown problems"); -#endif - - return 0; -} - -int -qc_lock (struct qcam *q) -{ -#if 1 - return qc_lock_wait (q, 1 /*wait */ ); -#else - return qc_lock_wait (q, 0 /*don't wait */ ); -#endif -} - -/* Unlock port */ - -int -qc_unlock (struct qcam *q) -{ - static struct flock sfl; - -#if 1 - if (-1 == q->fd) { /* port was not locked */ - return 1; - } - - /* clear the exclusive lock */ - sfl.l_type = F_UNLCK; - if (0 != fcntl (q->fd, F_SETLK, &sfl)) { - perror ("fcntl"); - return 1; - } -#ifdef TESTING - fprintf (stderr, "%s - %d: fd %d unlocked\n", __FILE__, __LINE__, q->fd); -#endif - -#else - char lockfile[128]; - - sprintf (lockfile, LOCALSTATEDIR "/LOCK.qcam.0x%x", q->port); - unlink (lockfile); /* What would I do with an error? */ -#endif - - return 0; -} - - -/* Probe for camera. Returns 0 if found, 1 if not found, sets - q->port.*/ - -int -qc_probe (struct qcam *q) -{ - int ioports[] = { 0x378, 0x278, 0x3bc, 0 }; - int i = 0; - - /* Attempt to get permission to access IO ports. Must be root */ - - while (ioports[i] != 0) { - q->port = ioports[i++]; - - if (qc_open (q)) { - perror ("Can't get I/O permission"); - exit (1); - } - - if (qc_detect (q)) { - fprintf (stderr, "QuickCam detected at 0x%x\n", q->port); - qc_close (q); - return (0); - } else - qc_close (q); - } - - return 1; -} - - -/* THIS IS UGLY. I need a short delay loop -- somthing well under a -millisecond. Unfortunately, adding 2 usleep(1)'s to qc_command slowed -it down by a factor of over 1000 over the same loop with 2 -usleep(0)'s, and that's too slow -- qc_start was taking over a second -to run. This seems to help, but if anyone has a good -speed-independent pause routine, please tell me. -- Scott */ - -void -qc_wait (int val) -{ - int i; - - while (val--) - for (i = 0; i < 50000; i++); -} diff --git a/sys/qcam/qcam-os.h b/sys/qcam/qcam-os.h deleted file mode 100644 index 46dcbe519..000000000 --- a/sys/qcam/qcam-os.h +++ /dev/null @@ -1,32 +0,0 @@ -/* qcam-linux.h -- Linux-specific routines for accessing QuickCam */ - -/* Version 0.1, January 2, 1996 */ -/* Version 0.5, August 24, 1996 */ - - -/****************************************************************** - -Copyright (C) 1996 by Scott Laird - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL SCOTT LAIRD BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -******************************************************************/ - - diff --git a/sys/qcam/qcam.h b/sys/qcam/qcam.h deleted file mode 100644 index 35b2dc267..000000000 --- a/sys/qcam/qcam.h +++ /dev/null @@ -1,134 +0,0 @@ -/* qcam.h -- routines for accessing the Connectix QuickCam */ - -/* Version 0.1, January 2, 1996 */ -/* Version 0.5, August 24, 1996 */ -/* Version 0.7, August 26, 1996 */ - - -/****************************************************************** - -Copyright (C) 1996 by Scott Laird - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL SCOTT LAIRD BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -******************************************************************/ - -#ifndef _QCAM_H -#define _QCAM_H - -#define QC_VERSION "0.91" - -/* One from column A... */ -#define QC_NOTSET 0 -#define QC_UNIDIR 1 -#define QC_BIDIR 2 -#define QC_SERIAL 3 - -/* ... and one from column B */ -#define QC_ANY 0x00 -#define QC_FORCE_UNIDIR 0x10 -#define QC_FORCE_BIDIR 0x20 -#define QC_FORCE_SERIAL 0x30 -/* in the port_mode member */ - -#define QC_MODE_MASK 0x07 -#define QC_FORCE_MASK 0x70 - -#define MAX_HEIGHT 243 -#define MAX_WIDTH 336 - -struct qcam { - int width, height; - int bpp; - int mode; - int contrast, brightness, whitebal; - int port; - int port_mode; - int transfer_scale; - int top, left; - int fd; /* lock file descriptor - * It was, unfortunately, necessary to add this member to the - * struct qcam to conveniently implement POSIX fcntl-style locking. - * We need a seperate lock file for each struct qcam, for instance, - * if the same process (using qcam-lib) is accessing multiple - * QuickCams on (of course) multiple ports. - * - Dave Plonka (plonka@carroll1.cc.edu) - */ -}; - -typedef unsigned char scanbuf; - -/* General QuickCam handling routines */ - -int qc_getbrightness(const struct qcam *q); -int qc_setbrightness(struct qcam *q, int val); -int qc_getcontrast(const struct qcam *q); -int qc_setcontrast(struct qcam *q, int val); -int qc_getwhitebal(const struct qcam *q); -int qc_setwhitebal(struct qcam *q, int val); -void qc_getresolution(const struct qcam *q, int *x, int *y); -int qc_setresolution(struct qcam *q, int x, int y); -int qc_getbitdepth(const struct qcam *q); -int qc_setbitdepth(struct qcam *q, int val); -int qc_getheight(const struct qcam *q); -int qc_setheight(struct qcam *q, int y); -int qc_getwidth(const struct qcam *q); -int qc_setwidth(struct qcam *q, int x); -int qc_gettop(const struct qcam *q); -int qc_settop(struct qcam *q, int val); -int qc_getleft(const struct qcam *q); -int qc_setleft(struct qcam *q, int val); -int qc_gettransfer_scale(const struct qcam *q); -int qc_settransfer_scale(struct qcam *q, int val); -int qc_calibrate(struct qcam *q); -int qc_forceunidir(struct qcam *q); -void qc_dump(const struct qcam *q, char *file); - -struct qcam *qc_init(void); -int qc_initfile(struct qcam *q, char *fname); -int qc_open(struct qcam *q); -int qc_close(struct qcam *q); -int qc_detect(const struct qcam *q); -void qc_reset(struct qcam *q); -void qc_set(struct qcam *q); -scanbuf *qc_scan(const struct qcam *q); -scanbuf *qc_convertscan(struct qcam *q, scanbuf *scan); -void qc_writepgm(const struct qcam *q, FILE *f, scanbuf *scan); -void qc_wait(int val); - -/* OS/hardware specific routines */ - -int read_lpstatus(const struct qcam *q); -int read_lpcontrol(const struct qcam *q); -int read_lpdata(const struct qcam *q); -void write_lpdata(const struct qcam *q, int d); -void write_lpcontrol(const struct qcam *q, int d); -int enable_ports(const struct qcam *q); -int disable_ports(const struct qcam *q); -int qc_unlock(struct qcam *q); -int qc_lock(struct qcam *q); -void qc_wait(int val); -int qc_probe(struct qcam *q); - -/* Image processing routines */ -int fixdark(const struct qcam *q, scanbuf *scan); -int qc_edge_detect(const struct qcam *q, scanbuf *scan, int tolerance); - -#endif /*! _QCAM_H*/ diff --git a/sys/qcam/qcamip.h b/sys/qcam/qcamip.h deleted file mode 100644 index 3bab6fafb..000000000 --- a/sys/qcam/qcamip.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * qcamip.h - Connectix QuickCam Image Processing routines - * - * Time-stamp: <02 Sep 96 11:19:27 HST edo@eosys.com> - * - * Version 0.2 - */ - -/****************************************************************** - -Copyright (C) 1996 by Ed Orcutt Systems - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, and/or distribute copies of the -Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -1. The above copyright notice and this permission notice shall - be included in all copies or substantial portions of the - Software. - -2. Redistribution for profit requires the express, written - permission of the author. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL ED ORCUTT SYSTEMS BE LIABLE -FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -******************************************************************/ - -#ifndef _QCAMIP_H -#define _QCAMIP_H -#include "qcam.h" - -/* Auto exposure modes */ - -#define AE_ALL_AVG 0 -#define AE_CTR_AVG 1 -#define AE_STD_AVG 2 - -/* Return value of image processing routines */ - -#define QCIP_XPSR_OK 0 -#define QCIP_XPSR_RSCN 1 -#define QCIP_XPSR_ERR 2 -#define QCIP_XPSR_LUM_INVLD 3 - -/* Prototypes for image processing routines */ - -int qcip_autoexposure(struct qcam *q, scanbuf *scan); -int qcip_set_luminance_target(struct qcam *q, int val); -int qcip_set_luminance_tolerance(struct qcam *q, int val); -int qcip_set_luminance_std_target(struct qcam *q, int val); -int qcip_set_luminance_std_tolerance(struct qcam *q, int val); -int qcip_set_autoexposure_mode(int val); -void qcip_histogram(struct qcam *q, scanbuf *scan, int *histogram); -void qcip_display_histogram(struct qcam *q, scanbuf *scan); - -#endif /*! _QCAMIP_H*/ diff --git a/sys/wininet/Makefile.am b/sys/wininet/Makefile.am deleted file mode 100644 index 816d868f9..000000000 --- a/sys/wininet/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -plugin_LTLIBRARIES = libgstwininet.la - -libgstwininet_la_SOURCES = gstwininetsrc.c - -libgstwininet_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_CFLAGS) -libgstwininet_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) -lwininet -libgstwininet_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -libgstwininet_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS) - -noinst_HEADERS = gstwininetsrc.h - diff --git a/sys/wininet/gstwininetsrc.c b/sys/wininet/gstwininetsrc.c deleted file mode 100644 index 60d29446a..000000000 --- a/sys/wininet/gstwininetsrc.c +++ /dev/null @@ -1,450 +0,0 @@ -/* GStreamer Windows network source - * Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -/** - * SECTION:element-wininetsrc - * - * <refsect2> - * <title>Example launch line</title> - * |[ - * gst-launch-1.0 -v wininetsrc location="http://71.83.57.210:9000" ! application/x-icy,metadata-interval=0 ! icydemux ! mad ! audioconvert ! directsoundsink - * ]| receive mp3 audio over http and play it back. - * </refsect2> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "gstwininetsrc.h" - -#include <string.h> - -#define DEFAULT_LOCATION "http://localhost/" -#define DEFAULT_POLL_MODE FALSE -#define DEFAULT_IRADIO_MODE TRUE - -enum -{ - PROP_0, - PROP_LOCATION, - PROP_POLL_MODE, - PROP_IRADIO_MODE -}; - -GST_DEBUG_CATEGORY_STATIC (gst_win_inet_src_debug); -#define GST_CAT_DEFAULT gst_win_inet_src_debug - -static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static void gst_win_inet_src_init_interfaces (GType type); -static void gst_win_inet_src_uri_handler_init (gpointer g_iface, - gpointer iface_data); - -static void gst_win_inet_src_dispose (GObject * object); -static void gst_win_inet_src_finalize (GObject * object); -static void gst_win_inet_src_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec); -static void gst_win_inet_src_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec); - -static gboolean gst_win_inet_src_start (GstBaseSrc * basesrc); -static gboolean gst_win_inet_src_stop (GstBaseSrc * basesrc); - -static GstFlowReturn gst_win_inet_src_create (GstPushSrc * pushsrc, - GstBuffer ** buffer); - -static void gst_win_inet_src_reset (GstWinInetSrc * self); - -GST_BOILERPLATE_FULL (GstWinInetSrc, gst_win_inet_src, GstPushSrc, - GST_TYPE_PUSH_SRC, gst_win_inet_src_init_interfaces); - -static void -gst_win_inet_src_base_init (gpointer gclass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); - - gst_element_class_add_static_pad_template (element_class, &src_template); - - gst_element_class_set_static_metadata (element_class, - "Windows Network Source", "Source/Network", - "Receive data as a client over the network via HTTP or FTP", - "Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com>"); -} - -static void -gst_win_inet_src_class_init (GstWinInetSrcClass * klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GstBaseSrcClass *gstbasesrc_class = GST_BASE_SRC_CLASS (klass); - GstPushSrcClass *gstpushsrc_class = GST_PUSH_SRC_CLASS (klass); - - gobject_class->dispose = gst_win_inet_src_dispose; - gobject_class->finalize = gst_win_inet_src_finalize; - gobject_class->get_property = gst_win_inet_src_get_property; - gobject_class->set_property = gst_win_inet_src_set_property; - - gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_win_inet_src_start); - gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_win_inet_src_stop); - gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_win_inet_src_create); - - g_object_class_install_property (gobject_class, - PROP_LOCATION, g_param_spec_string ("location", "Location", - "Location to read from", DEFAULT_LOCATION, G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, - PROP_POLL_MODE, g_param_spec_boolean ("poll-mode", "poll-mode", - "Enable poll mode (keep re-issuing request)", - DEFAULT_POLL_MODE, G_PARAM_READWRITE)); - - g_object_class_install_property (gobject_class, - PROP_IRADIO_MODE, g_param_spec_boolean ("iradio-mode", "iradio-mode", - "Enable Internet radio mode " - "(extraction of shoutcast/icecast metadata)", - DEFAULT_IRADIO_MODE, G_PARAM_READWRITE)); -} - -static void -gst_win_inet_src_init_interfaces (GType type) -{ - static const GInterfaceInfo uri_handler_info = { - gst_win_inet_src_uri_handler_init, - NULL, - NULL - }; - - g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &uri_handler_info); - - GST_DEBUG_CATEGORY_INIT (gst_win_inet_src_debug, "wininetsrc", - 0, "Wininet source"); -} - -static void -gst_win_inet_src_init (GstWinInetSrc * self, GstWinInetSrcClass * gclass) -{ - self->location = g_strdup (DEFAULT_LOCATION); - self->poll_mode = DEFAULT_POLL_MODE; - self->iradio_mode = DEFAULT_IRADIO_MODE; - - self->inet = NULL; - self->url = NULL; - self->cur_offset = 0; - self->icy_caps = NULL; -} - -static void -gst_win_inet_src_dispose (GObject * object) -{ - GstWinInetSrc *self = GST_WIN_INET_SRC (object); - - gst_win_inet_src_reset (self); - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -gst_win_inet_src_finalize (GObject * object) -{ - GstWinInetSrc *self = GST_WIN_INET_SRC (object); - - g_free (self->location); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gst_win_inet_src_get_property (GObject * object, guint prop_id, - GValue * value, GParamSpec * pspec) -{ - GstWinInetSrc *self = GST_WIN_INET_SRC (object); - - switch (prop_id) { - case PROP_LOCATION: - g_value_set_string (value, self->location); - break; - - case PROP_POLL_MODE: - g_value_set_boolean (value, self->poll_mode); - break; - - case PROP_IRADIO_MODE: - g_value_set_boolean (value, self->iradio_mode); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_win_inet_src_set_property (GObject * object, guint prop_id, - const GValue * value, GParamSpec * pspec) -{ - GstWinInetSrc *self = GST_WIN_INET_SRC (object); - - switch (prop_id) { - case PROP_LOCATION: - if (GST_STATE (self) == GST_STATE_PLAYING || - GST_STATE (self) == GST_STATE_PAUSED) { - GST_WARNING_OBJECT (self, "element must be in stopped or paused state " - "in order to change location"); - break; - } - - g_free (self->location); - self->location = g_value_dup_string (value); - break; - - case PROP_POLL_MODE: - self->poll_mode = g_value_get_boolean (value); - break; - - case PROP_IRADIO_MODE: - self->iradio_mode = g_value_get_boolean (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_win_inet_src_reset (GstWinInetSrc * self) -{ - if (self->url != NULL) { - InternetCloseHandle (self->url); - self->url = NULL; - } - - if (self->inet != NULL) { - InternetCloseHandle (self->inet); - self->inet = NULL; - } - - if (self->icy_caps != NULL) { - gst_caps_unref (self->icy_caps); - self->icy_caps = NULL; - } - - self->cur_offset = 0; -} - -static gboolean -gst_win_inet_src_get_header_value_as_int (GstWinInetSrc * self, - const gchar * header_name, gint * header_value, gboolean log_failure) -{ - gchar buf[16] = { 0, }; - DWORD buf_size = sizeof (buf); - gint *value = (gint *) buf; - - strcpy (buf, header_name); - - if (!HttpQueryInfo (self->url, HTTP_QUERY_CUSTOM | HTTP_QUERY_FLAG_NUMBER, - buf, &buf_size, NULL)) { - if (log_failure) { - DWORD error_code = GetLastError (); - const gchar *error_str = "unknown error"; - - if (error_code == ERROR_HTTP_HEADER_NOT_FOUND) - error_str = "ERROR_HTTP_HEADER_NOT_FOUND"; - - GST_WARNING_OBJECT (self, "HttpQueryInfo for header '%s' failed: %s " - "(0x%08lx)", header_name, error_str, error_code); - } - - return FALSE; - } - - *header_value = *value; - return TRUE; -} - -static gboolean -gst_win_inet_src_open (GstWinInetSrc * self) -{ - const gchar *extra_headers = NULL; - - gst_win_inet_src_reset (self); - - self->inet = InternetOpen (NULL, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); - if (self->inet == NULL) - goto error; - - if (self->iradio_mode) - extra_headers = "Icy-MetaData:1"; /* exactly as sent by WinAmp, no space */ - - self->url = InternetOpenUrl (self->inet, self->location, extra_headers, - (extra_headers != NULL) ? -1 : 0, INTERNET_FLAG_NO_UI, (DWORD_PTR) self); - if (self->url == NULL) - goto error; - - if (self->iradio_mode) { - gint value; - - if (gst_win_inet_src_get_header_value_as_int (self, "icy-metaint", &value, - TRUE)) { - self->icy_caps = gst_caps_new_simple ("application/x-icy", - "metadata-interval", G_TYPE_INT, value, NULL); - } - } - - return TRUE; - -error: - GST_ELEMENT_ERROR (self, RESOURCE, NOT_FOUND, (NULL), - ("Could not open location \"%s\" for reading: 0x%08lx", - self->location, GetLastError ())); - gst_win_inet_src_reset (self); - - return FALSE; -} - -static gboolean -gst_win_inet_src_start (GstBaseSrc * basesrc) -{ - GstWinInetSrc *self = GST_WIN_INET_SRC (basesrc); - - return gst_win_inet_src_open (self); -} - -static gboolean -gst_win_inet_src_stop (GstBaseSrc * basesrc) -{ - gst_win_inet_src_reset (GST_WIN_INET_SRC (basesrc)); - - return TRUE; -} - -static GstFlowReturn -gst_win_inet_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer) -{ - GstWinInetSrc *self = GST_WIN_INET_SRC (pushsrc); - GstBaseSrc *basesrc = GST_BASE_SRC (pushsrc); - GstBuffer *buf = NULL; - GstFlowReturn ret = GST_FLOW_OK; - DWORD bytes_read = 0; - - do { - GstCaps *caps = GST_PAD_CAPS (GST_BASE_SRC_PAD (self)); - - if (self->icy_caps != NULL) - caps = self->icy_caps; - - ret = gst_pad_alloc_buffer (GST_BASE_SRC_PAD (basesrc), - self->cur_offset, basesrc->blocksize, caps, &buf); - - if (G_LIKELY (ret == GST_FLOW_OK)) { - if (InternetReadFile (self->url, GST_BUFFER_DATA (buf), - basesrc->blocksize, &bytes_read)) { - if (bytes_read == 0) { - if (self->poll_mode) { - if (gst_win_inet_src_open (self)) { - gst_buffer_unref (buf); - buf = NULL; - } else { - ret = GST_FLOW_ERROR; - } - } else { - GST_ERROR_OBJECT (self, "short read (eof?)"); - ret = GST_FLOW_UNEXPECTED; - } - } - } else { - GST_ERROR_OBJECT (self, "InternetReadFile failed: 0x%08lx", - GetLastError ()); - - ret = GST_FLOW_ERROR; - } - } - } - while (bytes_read == 0 && ret == GST_FLOW_OK); - - if (ret == GST_FLOW_OK) { - GST_BUFFER_SIZE (buf) = bytes_read; - self->cur_offset += bytes_read; - - *buffer = buf; - } else { - if (buf != NULL) - gst_buffer_unref (buf); - } - - return ret; -} - -static GstURIType -gst_win_inet_src_uri_get_type (void) -{ - return GST_URI_SRC; -} - -static gchar ** -gst_win_inet_src_uri_get_protocols (void) -{ - static const gchar *protocols[] = { "http", "https", "ftp", NULL }; - - return (gchar **) protocols; -} - -static const gchar * -gst_win_inet_src_uri_get_uri (GstURIHandler * handler) -{ - GstWinInetSrc *src = GST_WIN_INET_SRC (handler); - - return src->location; -} - -static gboolean -gst_win_inet_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) -{ - GstWinInetSrc *src = GST_WIN_INET_SRC (handler); - - g_free (src->location); - src->location = g_strdup (uri); - return TRUE; -} - -static void -gst_win_inet_src_uri_handler_init (gpointer g_iface, gpointer iface_data) -{ - GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface; - - iface->get_type = gst_win_inet_src_uri_get_type; - iface->get_protocols = gst_win_inet_src_uri_get_protocols; - iface->get_uri = gst_win_inet_src_uri_get_uri; - iface->set_uri = gst_win_inet_src_uri_set_uri; -} - -static gboolean -plugin_init (GstPlugin * plugin) -{ - return gst_element_register (plugin, "wininetsrc", - GST_RANK_NONE, GST_TYPE_WIN_INET_SRC); -} - -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - wininet, - "Windows network plugins", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) diff --git a/sys/wininet/gstwininetsrc.h b/sys/wininet/gstwininetsrc.h deleted file mode 100644 index 0803d9ec3..000000000 --- a/sys/wininet/gstwininetsrc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* GStreamer Windows network source - * Copyright (C) 2008 Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.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., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __GST_WIN_INET_SRC_H__ -#define __GST_WIN_INET_SRC_H__ - -#include <windows.h> -#include <wininet.h> -#include <gst/base/gstpushsrc.h> - -G_BEGIN_DECLS - -#define GST_TYPE_WIN_INET_SRC \ - (gst_win_inet_src_get_type ()) -#define GST_WIN_INET_SRC(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WIN_INET_SRC, GstWinInetSrc)) -#define GST_WIN_INET_SRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WIN_INET_SRC, GstWinInetSrcClass)) -#define GST_IS_WIN_INET_SRC(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WIN_INET_SRC)) -#define GST_IS_WIN_INET_SRC_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WIN_INET_SRC)) - -typedef struct _GstWinInetSrc GstWinInetSrc; -typedef struct _GstWinInetSrcClass GstWinInetSrcClass; - -struct _GstWinInetSrc -{ - GstPushSrc push_src; - - /* property storage */ - gchar * location; - gboolean poll_mode; - gboolean iradio_mode; - - /* state */ - HINTERNET inet; - HINTERNET url; - guint64 cur_offset; - GstCaps * icy_caps; -}; - -struct _GstWinInetSrcClass -{ - GstPushSrcClass parent_class; -}; - -GType gst_win_inet_src_get_type (void); - -G_END_DECLS - -#endif /* __GST_WIN_INET_SRC_H__ */ - |