Commit cdcc3945 authored by Luciana Fujii Pontello's avatar Luciana Fujii Pontello Committed by Alessandro Decina

Add pvrvideosink element

PVRVideoSink uses PVR2D library to blit images.

Author: Alessandro Decina <alessandro.decina@collabora.co.uk>
Author: Luciana Fujii <luciana.fujii@collabora.co.uk>
parent c61f85da
......@@ -229,6 +229,8 @@ if test "x$BUILD_EXAMPLES" = "xyes"; then
fi
AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
dnl Needed for GtkBuilder to autoconnect signals
PKG_CHECK_MODULES(GMODULE_EXPORT, gmodule-export-2.0, HAVE_GMODULE_EXPORT=yes, HAVE_GMODULE_EXPORT=no)
......@@ -1401,6 +1403,20 @@ AG_GST_CHECK_FEATURE(OPUS, [opus], opus, [
AC_SUBST(OPUS_LIBS)
])
dnl *** pvr ***
translit(dnm, m, l) AM_CONDITIONAL(USE_PVR, true)
AG_GST_CHECK_FEATURE(PVR, [pvrvideosink], pvr, [
PKG_CHECK_MODULES([PVR], [libtimemmgr], HAVE_PVR=yes, HAVE_PVR=no)
AC_SUBST(PVR_CFLAGS)
AC_SUBST(PVR_LIBS)
])
AC_ARG_WITH([pvr-external-headers],
AC_HELP_STRING([--with-pvr-external-headers], [Use system installed PVR2D headers]),
[AS_IF([test "x$with_pvr_external_headers" = "xno"],
[PVR_CFLAGS="$PVR_CFLAGS -I\$(srcdir)/pvr_includes"])],
[PVR_CFLAGS="$PVR_CFLAGS -I\$(srcdir)/pvr_includes"])
dnl *** rsvg ***
translit(dnm, m, l) AM_CONDITIONAL(USE_RSVG, true)
AG_GST_CHECK_FEATURE(RSVG, [rsvg decoder], rsvg, [
......@@ -1792,6 +1808,7 @@ AM_CONDITIONAL(USE_OFA, false)
AM_CONDITIONAL(USE_OPENAL, false)
AM_CONDITIONAL(USE_OPENCV, false)
AM_CONDITIONAL(USE_OPUS, false)
AM_CONDITIONAL(USE_PVR, false)
AM_CONDITIONAL(USE_RSVG, false)
AM_CONDITIONAL(USE_TIMIDITY, false)
AM_CONDITIONAL(USE_WILDMIDI, false)
......@@ -1991,6 +2008,7 @@ sys/vcd/Makefile
sys/vdpau/Makefile
sys/vdpau/gstvdp/Makefile
sys/vdpau/basevideodecoder/Makefile
sys/pvr2d/Makefile
sys/wasapi/Makefile
sys/wininet/Makefile
sys/winks/Makefile
......
......@@ -101,6 +101,7 @@ else
VDPAU_DIR=
endif
if USE_SHM
SHM_DIR=shm
else
......@@ -113,9 +114,15 @@ else
AVC_DIR=
endif
SUBDIRS = $(ACM_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTDRAW_DIR) $(DIRECTSOUND_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OSX_VIDEO_DIR) $(QT_DIR) $(SHM_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR)
if USE_PVR
PVR_DIR=pvr2d
else
PVR_DIR=
endif
SUBDIRS = $(ACM_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTDRAW_DIR) $(DIRECTSOUND_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OSX_VIDEO_DIR) $(QT_DIR) $(SHM_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(PVR_DIR)
DIST_SUBDIRS = acmenc acmmp3dec applemedia avc d3dvideosink decklink directdraw directsound dvb linsys fbdev dshowdecwrapper dshowsrcwrapper dshowvideosink \
osxvideo qtwrapper shm vcd vdpau wasapi wininet winks winscreencap
osxvideo qtwrapper shm vcd vdpau wasapi wininet winks winscreencap pvr2d
include $(top_srcdir)/common/parallel-subdirs.mak
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_MAJORMINOR) \
-lgstinterfaces-$(GST_MAJORMINOR) -lpvr2d -lpvrPVR2D_DRIWSEGL\
$(PVR_LIBS) \
$(LIBM)
libgstpvr_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstpvr_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
gstpvr.h \
gstpvrbufferpool.h \
gstpvrvideosink.h
/*
* 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);
}
/* 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/")
/*
* 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 <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);
G_END_DECLS
#endif /* __GST_DUCATI_H__ */
/*
* 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
*/
#include "gstpvrbufferpool.h"
GST_DEBUG_CATEGORY_EXTERN (gst_debug_pvrvideosink);
#define GST_CAT_DEFAULT gst_debug_pvrvideosink
/*
* GstDucatiBuffer
*/
static GstBufferClass *buffer_parent_class;
/* Get the original buffer, or whatever is the best output buffer.
* Consumes the input reference, produces the output reference
*/
GstBuffer *
gst_ducati_buffer_get (GstDucatiBuffer * self)
{
if (self->orig) {
// TODO copy to orig buffer.. if needed.
gst_buffer_unref (self->orig);
self->orig = NULL;
}
return GST_BUFFER (self);
}
PVR2DMEMINFO *
gst_ducati_buffer_get_meminfo (GstDucatiBuffer * self)
{
return self->src_mem;
}
static GstDucatiBuffer *
gst_ducati_buffer_new (GstPvrBufferPool * pool)
{
PVR2DERROR pvr_error;
GstDucatiBuffer *self = (GstDucatiBuffer *)
gst_mini_object_new (GST_TYPE_DUCATIBUFFER);
GST_LOG_OBJECT (pool->element, "creating buffer %p in pool %p", self, pool);
self->pool = (GstPvrBufferPool *)
gst_mini_object_ref (GST_MINI_OBJECT (pool));
GST_BUFFER_DATA (self) = gst_ducati_alloc_1d (pool->size);
GST_BUFFER_SIZE (self) = pool->size;
GST_LOG_OBJECT (pool->element, "width=%d, height=%d and size=%d",
pool->padded_width, pool->padded_height, pool->size);
pvr_error =
PVR2DMemWrap (pool->pvr_context, GST_BUFFER_DATA (self), 0, pool->size,
NULL, &(self->src_mem));
if (pvr_error != PVR2D_OK) {
GST_LOG_OBJECT (pool->element, "Failed to Wrap buffer memory"
"returned %d", pvr_error);
} else {
self->wrapped = TRUE;
}
gst_buffer_set_caps (GST_BUFFER (self), pool->caps);
return self;
}
static void
gst_ducati_buffer_finalize (GstDucatiBuffer * self)
{
PVR2DERROR pvr_error;
GstPvrBufferPool *pool = self->pool;
gboolean resuscitated = FALSE;
GST_LOG_OBJECT (pool->element, "finalizing buffer %p", self);
GST_PVR_BUFFERPOOL_LOCK (pool);
g_queue_remove (pool->used_buffers, self);
if (pool->running) {
resuscitated = TRUE;
GST_LOG_OBJECT (pool->element, "reviving buffer %p", self);
g_queue_push_head (pool->free_buffers, self);
} else {
GST_LOG_OBJECT (pool->element, "the pool is shutting down");
}
GST_PVR_BUFFERPOOL_UNLOCK (pool);
if (resuscitated) {
GST_LOG_OBJECT (pool->element, "reviving buffer %p, %d", self, index);
gst_buffer_ref (GST_BUFFER (self));
GST_BUFFER_SIZE (self) = 0;
}
if (!resuscitated) {
GST_LOG_OBJECT (pool->element,
"buffer %p (data %p, len %u) not recovered, freeing",
self, GST_BUFFER_DATA (self), GST_BUFFER_SIZE (self));
if (self->wrapped) {
pvr_error = PVR2DMemFree (pool->pvr_context, self->src_mem);
if (pvr_error != PVR2D_OK) {
GST_ERROR_OBJECT (pool->element, "Failed to Unwrap buffer memory"
"returned %d", pvr_error);
}
self->wrapped = FALSE;
}
MemMgr_Free ((void *) GST_BUFFER_DATA (self));
GST_BUFFER_DATA (self) = NULL;
gst_mini_object_unref (GST_MINI_OBJECT (pool));
GST_MINI_OBJECT_CLASS (buffer_parent_class)->finalize (GST_MINI_OBJECT
(self));
}
}
static void
gst_ducati_buffer_class_init (gpointer g_class, gpointer class_data)
{
GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
buffer_parent_class = g_type_class_peek_parent (g_class);
mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
GST_DEBUG_FUNCPTR (gst_ducati_buffer_finalize);
}
GType
gst_ducati_buffer_get_type (void)
{
static GType type;
if (G_UNLIKELY (type == 0)) {
static const GTypeInfo info = {
.class_size = sizeof (GstBufferClass),
.class_init = gst_ducati_buffer_class_init,
.instance_size = sizeof (GstDucatiBuffer),
};
type = g_type_register_static (GST_TYPE_BUFFER,
"GstDucatiBufferPvrsink", &info, 0);
}
return type;
}
/*
* GstDucatiBufferPool
*/
static GstMiniObjectClass *bufferpool_parent_class = NULL;
/** create new bufferpool
* @element : the element that owns this pool
* @caps: the caps to set on the buffer
* @num_buffers: the requested number of buffers in the pool
*/
GstPvrBufferPool *
gst_pvr_bufferpool_new (GstElement * element, GstCaps * caps, gint num_buffers,
gint size, PVR2DCONTEXTHANDLE pvr_context)
{
GstPvrBufferPool *self = (GstPvrBufferPool *)
gst_mini_object_new (GST_TYPE_PVRBUFFERPOOL);
GstStructure *s = gst_caps_get_structure (caps, 0);
self->element = gst_object_ref (element);
gst_structure_get_int (s, "width", &self->padded_width);
gst_structure_get_int (s, "height", &self->padded_height);
self->caps = gst_caps_ref (caps);
self->size = size;
self->pvr_context = pvr_context;
self->free_buffers = g_queue_new ();
self->used_buffers = g_queue_new ();
self->lock = g_mutex_new ();
self->running = TRUE;
return self;
}
static void
unwrap_buffer (gpointer buffer, gpointer user_data)
{
PVR2DERROR pvr_error;
GstDucatiBuffer *buf = GST_DUCATIBUFFER (buffer);
GstPvrBufferPool *pool = (GstPvrBufferPool *) user_data;
if (buf->wrapped) {
pvr_error = PVR2DMemFree (pool->pvr_context, buf->src_mem);
if (pvr_error != PVR2D_OK) {
GST_ERROR_OBJECT (pool->element, "Failed to Unwrap buffer memory"
"returned %d", pvr_error);
}
buf->wrapped = FALSE;
}
}
void
gst_pvr_bufferpool_stop_running (GstPvrBufferPool * self, gboolean unwrap)
{
gboolean empty = FALSE;
g_return_if_fail (self);
GST_PVR_BUFFERPOOL_LOCK (self);
self->running = FALSE;
GST_PVR_BUFFERPOOL_UNLOCK (self);
GST_DEBUG_OBJECT (self->element, "free available buffers");
/* free all buffers on the freelist */
while (!empty) {
GstDucatiBuffer *buf;
GST_PVR_BUFFERPOOL_LOCK (self);
buf = g_queue_pop_head (self->free_buffers);
GST_PVR_BUFFERPOOL_UNLOCK (self);
if (buf)
gst_buffer_unref (GST_BUFFER (buf));
else
empty = TRUE;
}
if (unwrap)
g_queue_foreach (self->used_buffers, unwrap_buffer, self);
gst_mini_object_unref (GST_MINI_OBJECT (self));
}
/** get buffer from bufferpool, allocate new buffer if needed */
GstDucatiBuffer *
gst_pvr_bufferpool_get (GstPvrBufferPool * self, GstBuffer * orig)
{
GstDucatiBuffer *buf = NULL;
g_return_val_if_fail (self, NULL);
GST_PVR_BUFFERPOOL_LOCK (self);
if (self->running) {
/* re-use a buffer off the freelist if any are available
*/
buf = g_queue_pop_head (self->free_buffers);
if (!buf)
buf = gst_ducati_buffer_new (self);
buf->orig = orig;
g_queue_push_head (self->used_buffers, buf);
}
GST_PVR_BUFFERPOOL_UNLOCK (self);
if (buf && orig) {
GST_BUFFER_TIMESTAMP (buf) = GST_BUFFER_TIMESTAMP (orig);
GST_BUFFER_DURATION (buf) = GST_BUFFER_DURATION (orig);
}
GST_BUFFER_SIZE (buf) = self->size;
return buf;
}
static void
gst_pvr_bufferpool_finalize (GstPvrBufferPool * self)
{
GST_DEBUG_OBJECT (self->element, "destroy bufferpool");
g_mutex_free (self->lock);
self->lock = NULL;
g_queue_free (self->free_buffers);
self->free_buffers = NULL;
g_queue_free (self->used_buffers);
self->used_buffers = NULL;
gst_caps_unref (self->caps);
self->caps = NULL;
gst_object_unref (self->element);
self->element = NULL;
GST_MINI_OBJECT_CLASS (bufferpool_parent_class)->finalize (GST_MINI_OBJECT
(self));
}
static void
gst_pvr_bufferpool_class_init (gpointer g_class, gpointer class_data)
{
GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
bufferpool_parent_class = g_type_class_peek_parent (g_class);
mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
GST_DEBUG_FUNCPTR (gst_pvr_bufferpool_finalize);
}
GType
gst_pvr_bufferpool_get_type (void)
{
static GType type;
if (G_UNLIKELY (type == 0)) {
static const GTypeInfo info = {
.class_size = sizeof (GstMiniObjectClass),
.class_init = gst_pvr_bufferpool_class_init,
.instance_size = sizeof (GstPvrBufferPool),
};
type = g_type_register_static (GST_TYPE_MINI_OBJECT,
"GstPvrBufferPool", &info, 0);
}
return type;
}
/*
* 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
GType gst_ducati_buffer_get_type (void);
#define GST_TYPE_DUCATIBUFFER (gst_ducati_buffer_get_type())
#define GST_IS_DUCATIBUFFER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DUCATIBUFFER))
#define GST_DUCATIBUFFER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DUCATIBUFFER, GstDucatiBuffer))
GType gst_pvr_bufferpool_get_type (void);
#define GST_TYPE_PVRBUFFERPOOL (gst_pvr_bufferpool_get_type())
#define GST_IS_PVRBUFFERPOOL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PVRBUFFERPOOL))
#define GST_PVRBUFFERPOOL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PVRBUFFERPOOL, \
GstPvrBufferPool))
typedef struct _GstPvrBufferPool GstPvrBufferPool;
typedef struct _GstDucatiBuffer GstDucatiBuffer;
struct _GstPvrBufferPool
{
GstMiniObject parent;
/* output (padded) size including any codec padding: */
gint padded_width, padded_height;
gint size;
PVR2DCONTEXTHANDLE pvr_context;
GstCaps *caps;
GMutex *lock;
gboolean running; /* with lock */
GstElement *element; /* the element that owns us.. */
GQueue *free_buffers;
GQueue *used_buffers;
guint buffer_count;
};
GstPvrBufferPool * gst_pvr_bufferpool_new (GstElement * element,
GstCaps * caps, gint num_buffers, gint size,
PVR2DCONTEXTHANDLE pvr_context);
void gst_pvr_bufferpool_stop_running (GstPvrBufferPool * pool, gboolean unwrap);
GstDucatiBuffer * gst_pvr_bufferpool_get (GstPvrBufferPool * self,
GstBuffer * orig);
#define GST_PVR_BUFFERPOOL_LOCK(self) g_mutex_lock ((self)->lock)
#define GST_PVR_BUFFERPOOL_UNLOCK(self) g_mutex_unlock ((self)->lock)
struct _GstDucatiBuffer {
GstBuffer parent;
GstPvrBufferPool *pool; /* buffer-pool that this buffer belongs to */
GstBuffer *orig; /* original buffer, if we need to copy output */
PVR2DMEMINFO *src_mem; /* Memory wrapped by pvr */
gboolean wrapped;
};
GstBuffer * gst_ducati_buffer_get (GstDucatiBuffer * self);
PVR2DMEMINFO * gst_ducati_buffer_get_meminfo (GstDucatiBuffer * self);
G_END_DECLS
#endif /* __GSTPVRBUFFERPOOL_H__ */
This diff is collapsed.
<
/* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PVRVIDEOSINK_H__
#define __GST_PVRVIDEOSINK_H__
#include <gst/video/gstvideosink.h>
#include <gst/video/video.h>
#include "gstpvrbufferpool.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
* @pool_lock: used to protect the buffer pool
* @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;