video: Remove video library from -bad

This only contained API that now has replacements in core and base.
This commit is contained in:
Sebastian Dröge 2013-04-11 13:34:13 +02:00
parent 2713fd1058
commit 524421e436
16 changed files with 5 additions and 1171 deletions

View file

@ -95,6 +95,7 @@ CRUFT_DIRS = \
$(top_srcdir)/gst/shapewipe \
$(top_srcdir)/gst/valve \
$(top_srcdir)/gst-libs/gst/baseparse \
$(top_srcdir)/gst-libs/gst/video \
$(top_srcdir)/tests/examples/scaletempo \
$(top_srcdir)/tests/examples/shapewipe \
$(top_srcdir)/tests/examples/switch \

View file

@ -2376,7 +2376,6 @@ gst-libs/gst/insertbin/Makefile
gst-libs/gst/interfaces/Makefile
gst-libs/gst/signalprocessor/Makefile
gst-libs/gst/codecparsers/Makefile
gst-libs/gst/video/Makefile
sys/Makefile
sys/dshowdecwrapper/Makefile
sys/acmenc/Makefile
@ -2489,8 +2488,6 @@ pkgconfig/gstreamer-codecparsers.pc
pkgconfig/gstreamer-codecparsers-uninstalled.pc
pkgconfig/gstreamer-insertbin.pc
pkgconfig/gstreamer-insertbin-uninstalled.pc
pkgconfig/gstreamer-basevideo.pc
pkgconfig/gstreamer-basevideo-uninstalled.pc
pkgconfig/gstreamer-egl.pc
pkgconfig/gstreamer-egl-uninstalled.pc
tools/Makefile

View file

@ -55,7 +55,6 @@ GTKDOC_LIBS = \
$(top_builddir)/gst-libs/gst/basecamerabinsrc/libgstbasecamerabinsrc-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/interfaces/libgstphotography-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/signalprocessor/libgstsignalprocessor-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/video/libgstbasevideo-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/insertbin/libgstinsertbin-@GST_API_VERSION@.la \
$(GST_BASE_LIBS)

View file

@ -35,17 +35,6 @@
<xi:include href="xml/gstmpegvideometa.xml" />
</chapter>
<chapter id="video">
<title>Base video element classes</title>
<xi:include href="xml/gstbasevideocodec.xml" />
<xi:include href="xml/gstbasevideodecoder.xml" />
<xi:include href="xml/gstbasevideoencoder.xml" />
<xi:include href="xml/gstbasevideoutils.xml" />
<xi:include href="xml/gstvideocontext.xml" />
<xi:include href="xml/gstsurfacebuffer.xml" />
<xi:include href="xml/gstsurfaceconverter.xml" />
</chapter>
<chapter id="tools">
<title>Useful elements</title>
<xi:include href="xml/gstinsertbin.xml" />

View file

@ -295,93 +295,6 @@ GST_IS_BASE_CAMERA_SRC_CLASS
GST_BASE_CAMERA_SRC_GET_CLASS
</SECTION>
<SECTION>
<FILE>gstbasevideoencoder</FILE>
<TITLE>GstBaseVideoEncoder</TITLE>
GST_BASE_VIDEO_ENCODER_SINK_NAME
GST_BASE_VIDEO_ENCODER_SRC_NAME
GST_BASE_VIDEO_ENCODER_FLOW_DROPPED
GstBaseVideoEncoder
GstBaseVideoEncoderClass
gst_base_video_encoder_get_state
gst_base_video_encoder_get_oldest_frame
gst_base_video_encoder_finish_frame
gst_base_video_encoder_set_headers
gst_base_video_encoder_set_latency
gst_base_video_encoder_set_latency_fields
<SUBSECTION Standard>
GST_BASE_VIDEO_ENCODER
GST_IS_BASE_VIDEO_ENCODER
GST_TYPE_BASE_VIDEO_ENCODER
gst_base_video_encoder_get_type
GST_BASE_VIDEO_ENCODER_CLASS
GST_IS_BASE_VIDEO_ENCODER_CLASS
GST_BASE_VIDEO_ENCODER_GET_CLASS
</SECTION>
<SECTION>
<FILE>gstbasevideodecoder</FILE>
<TITLE>GstBaseVideoDecoder</TITLE>
GST_BASE_VIDEO_DECODER_SINK_NAME
GST_BASE_VIDEO_DECODER_SRC_NAME
GST_BASE_VIDEO_DECODER_FLOW_NEED_DATA
GST_BASE_VIDEO_DECODER_FLOW_DROPPED
GstBaseVideoDecoder
GstBaseVideoDecoderClass
gst_base_video_decoder_class_set_capture_pattern
gst_base_video_decoder_get_frame
gst_base_video_decoder_drop_frame
gst_base_video_decoder_get_oldest_frame
gst_base_video_decoder_add_to_frame
gst_base_video_decoder_lost_sync
gst_base_video_decoder_have_frame
gst_base_video_decoder_set_sync_point
gst_base_video_decoder_set_src_caps
gst_base_video_decoder_alloc_src_buffer
gst_base_video_decoder_alloc_src_frame
gst_base_video_decoder_get_state
gst_base_video_decoder_get_max_decode_time
gst_base_video_decoder_finish_frame
<SUBSECTION Standard>
GST_BASE_VIDEO_DECODER
GST_IS_BASE_VIDEO_DECODER
GST_TYPE_BASE_VIDEO_DECODER
gst_base_video_decoder_get_type
GST_BASE_VIDEO_DECODER_CLASS
GST_IS_BASE_VIDEO_DECODER_CLASS
GST_BASE_VIDEO_DECODER_GET_CLASS
</SECTION>
<SECTION>
<FILE>gstbasevideocodec</FILE>
<TITLE>GstBaseVideoCodec</TITLE>
GST_BASE_VIDEO_CODEC_SINK_NAME
GST_BASE_VIDEO_CODEC_SRC_NAME
GST_BASE_VIDEO_CODEC_SRC_PAD
GST_BASE_VIDEO_CODEC_SINK_PAD
GST_BASE_VIDEO_CODEC_FLOW_NEED_DATA
GST_BASE_VIDEO_CODEC_STREAM_LOCK
GST_BASE_VIDEO_CODEC_STREAM_UNLOCK
GstVideoState
GstVideoFrameState
GstBaseVideoCodec
GstBaseVideoCodecClass
gst_base_video_codec_new_frame
gst_base_video_codec_append_frame
gst_base_video_codec_remove_frame
gst_video_frame_state_get_type
gst_video_frame_state_ref
gst_video_frame_state_unref
<SUBSECTION Standard>
GST_BASE_VIDEO_CODEC
GST_IS_BASE_VIDEO_CODEC
GST_TYPE_BASE_VIDEO_CODEC
gst_base_video_codec_get_type
GST_BASE_VIDEO_CODEC_CLASS
GST_IS_BASE_VIDEO_CODEC_CLASS
GST_BASE_VIDEO_CODEC_GET_CLASS
</SECTION>
<SECTION>
<FILE>gstsignalprocessor</FILE>
<TITLE>GstSignalProcessor</TITLE>
@ -452,55 +365,6 @@ gst_camerabin_preview_pipeline_post
gst_camerabin_preview_set_caps
</SECTION>
<SECTION>
<FILE>gstbasevideoutils</FILE>
gst_base_video_rawvideo_convert
gst_base_video_encoded_video_convert
gst_video_state_get_timestamp
</SECTION>
<SECTION>
<FILE>gstvideocontext</FILE>
<TITLE>GstVideoContextInterface</TITLE>
GST_IS_VIDEO_CONTEXT
GstVideoContext
GstVideoContextInterface
gst_video_context_iface_get_type
gst_video_context_set_context
gst_video_context_set_context_string
gst_video_context_set_context_pointer
gst_video_context_set_context_object
gst_video_context_prepare
gst_video_context_message_parse_prepare
gst_video_context_query_new
gst_video_context_run_query
gst_video_context_query_get_supported_types
gst_video_context_query_parse_value
gst_video_context_query_set_value
gst_video_context_query_set_string
gst_video_context_query_set_pointer
gst_video_context_query_set_object
</SECTION>
<SECTION>
<FILE>gstsurfacebuffer</FILE>
<TITLE>GstSurfaceBuffer</TITLE>
GST_VIDEO_CAPS_SURFACE
GstSurfaceBuffer
GstSurfaceBufferClass
gst_surface_buffer_get_type
gst_surface_buffer_create_converter
</SECTION>
<SECTION>
<FILE>gstsurfaceconverter</FILE>
<TITLE>GstSurfaceConverter</TITLE>
GstSurfaceConverter
GstSurfaceConverterInterface
gst_surface_converter_get_type
gst_surface_converter_upload
</SECTION>
<SECTION>
<FILE>gstinsertbin</FILE>
<TITLE>GstInsertbin</TITLE>

View file

@ -2,10 +2,10 @@ if HAVE_EGL
EGL_DIR = egl
endif
SUBDIRS = interfaces signalprocessor video basecamerabinsrc codecparsers \
SUBDIRS = interfaces signalprocessor basecamerabinsrc codecparsers \
insertbin $(EGL_DIR)
noinst_HEADERS = gst-i18n-plugin.h gettext.h glib-compat-private.h
DIST_SUBDIRS = interfaces egl signalprocessor video basecamerabinsrc codecparsers \
DIST_SUBDIRS = interfaces egl signalprocessor basecamerabinsrc codecparsers \
insertbin

View file

@ -1,24 +0,0 @@
lib_LTLIBRARIES = libgstbasevideo-@GST_API_VERSION@.la
CLEANFILES = $(BUILT_SOURCES)
libgstbasevideo_@GST_API_VERSION@_la_SOURCES = \
gstsurfacemeta.c \
gstsurfaceconverter.c \
videocontext.c
libgstbasevideo_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/video
libgstbasevideo_@GST_API_VERSION@include_HEADERS = \
gstsurfacemeta.h \
gstsurfaceconverter.h \
videocontext.h
libgstbasevideo_@GST_API_VERSION@_la_CFLAGS = \
$(GST_PLUGINS_BAD_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) \
-DGST_USE_UNSTABLE_API \
$(GST_CFLAGS)
libgstbasevideo_@GST_API_VERSION@_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) -lgstvideo-@GST_API_VERSION@
libgstbasevideo_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)

View file

@ -1,80 +0,0 @@
/* GStreamer
* Copyright (C) 2011 Collabora Ltd.
* Copyright (C) 2011 Intel
*
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.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 "gstsurfaceconverter.h"
#include "gstsurfacemeta.h"
/**
* SECTION:gstsurfaceconverter
* @short_description: Interface for #GstSurfaceBuffer convertion
*
* Objects implementing this interface are used as a convertion context. This
* allow element optimizing the upload by keeping required resources between
* uploads. The context must be discarded when the pipeline goes to
* #GST_STATE_NULL or renewed whenever the caps are changed.
* <note>
* The GstSurfaceConverter interface is unstable API and may change in future.
* One can define GST_USE_UNSTABLE_API to acknowledge and avoid this warning.
* </note>
*
* <refsect2>
* <title>Example uploading to GL texture</title>
* |[
* if (G_UNLIKELY (priv->converter == NULL))
* priv->converter = gst_surface_buffer_create_converter (surface, "opengl", &value);
*
* gst_surface_converter_uplaod (priv->converter, surface);
* ]|
* </refsect2>
*/
G_DEFINE_INTERFACE (GstSurfaceConverter, gst_surface_converter, G_TYPE_INVALID);
static void
gst_surface_converter_default_init (GstSurfaceConverterInterface * iface)
{
/* default virtual functions */
iface->upload = NULL;
}
/**
* gst_surface_converter_upload:
* @converter: a #GstSurfaceConverter
* @buffer: the #GstBuffer to upload
*
* Convert and uploads the #GstSurfaceBuffer to the converter destination.
*
* Returns: #TRUE on success, #FALSE otherwise
*/
gboolean
gst_surface_converter_upload (GstSurfaceConverter * converter,
GstBuffer * buffer)
{
g_return_val_if_fail (GST_IS_SURFACE_CONVERTER (converter), FALSE);
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
return GST_SURFACE_CONVERTER_GET_IFACE (converter)->upload (converter,
buffer);
}

View file

@ -1,65 +0,0 @@
/* GStreamer
* Copyright (C) 2011 Collabora Ltd.
* Copyright (C) 2011 Intel
*
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.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_SURFACE_CONVERTER_H_
#define _GST_SURFACE_CONVERTER_H_
#ifndef GST_USE_UNSTABLE_API
#warning "GstSurfaceConverter is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_SURFACE_CONVERTER (gst_surface_converter_get_type ())
#define GST_SURFACE_CONVERTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_SURFACE_CONVERTER, GstSurfaceConverter))
#define GST_IS_SURFACE_CONVERTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_SURFACE_CONVERTER))
#define GST_SURFACE_CONVERTER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_SURFACE_CONVERTER, GstSurfaceConverterInterface))
typedef struct _GstSurfaceConverter GstSurfaceConverter;
typedef struct _GstSurfaceConverterInterface GstSurfaceConverterInterface;
/**
* GstSurfaceConverterInterface:
* @parent: parent interface type.
* @upload: vmethod to upload #GstSurfaceBuffer.
*
* #GstSurfaceConverterInterface interface.
*/
struct _GstSurfaceConverterInterface
{
GTypeInterface parent;
gboolean (*upload) (GstSurfaceConverter *converter,
GstBuffer *buffer);
};
GType gst_surface_converter_get_type (void);
gboolean gst_surface_converter_upload (GstSurfaceConverter *converter,
GstBuffer *buffer);
G_END_DECLS
#endif

View file

@ -1,96 +0,0 @@
/* GStreamer
* Copyright (C) 2011 Collabora Ltd.
* Copyright (C) 2011 Intel
*
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.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 "gstsurfacemeta.h"
/**
* SECTION:gstsurfacemeta
* @short_description: Accelerated surface metadata
*
* This meta data is used to abstract hardware accelerated buffers and enable
* generic convertion to standard type such as GL textures. The media type for
* those buffers is defined by #GST_VIDEO_CAPS_SURFACE. An implementation
* specific type must be set using the "type" key (e.g. type="vaapi").
* Available convertion type are speficied using seperate boolean
* arguement (e.g. opengl=true). Having this information in the capabilities
* allow easy negotiating of such feature with other elements (e.g. a
* ClutterGstVideoSink can claim accpeting caps "video/x-surface,opengl=true").
* <note>
* The GstSurfaceMeta interface is unstable API and may change in future.
* One can define GST_USE_UNSTABLE_API to acknowledge and avoid this warning.
* </note>
*/
GType
gst_surface_meta_api_get_type (void)
{
static volatile GType type;
static const gchar *tags[] = { "memory", NULL };
if (g_once_init_enter (&type)) {
GType _type = gst_meta_api_type_register ("GstSurfaceMetaAPI", tags);
g_once_init_leave (&type, _type);
}
return type;
}
const GstMetaInfo *
gst_surface_meta_get_info (void)
{
static const GstMetaInfo *meta_info = NULL;
if (g_once_init_enter (&meta_info)) {
const GstMetaInfo *meta =
gst_meta_register (GST_SURFACE_META_API_TYPE, "GstSurfaceMeta",
sizeof (GstSurfaceMeta),
(GstMetaInitFunction) NULL,
(GstMetaFreeFunction) NULL, (GstMetaTransformFunction) NULL);
g_once_init_leave (&meta_info, meta);
}
return meta_info;
}
/**
* gst_surface_meta_create_converter:
* @meta: a #GstSurfaceMeta
* @type: the type to convert to
* @dest: a #GValue containing the destination to upload
*
* This method is used to create a type specific converter. The converter will
* serve as context to accelerate the data convertion. This converter object
* shall be discarded when the pipeline state changes to NULL and renewed when
* caps are changed.
*
* Returns: newly allocated #GstSurfaceConverter
*/
GstSurfaceConverter *
gst_surface_meta_create_converter (GstSurfaceMeta * meta,
const gchar * type, GValue * dest)
{
g_return_val_if_fail (meta != NULL, FALSE);
return meta->create_converter (meta, type, dest);
}

View file

@ -1,68 +0,0 @@
/* GStreamer
* Copyright (C) 2011 Collabora Ltd.
* Copyright (C) 2011 Intel
*
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.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_SURFACE_META_H_
#define _GST_SURFACE_META_H_
#ifndef GST_USE_UNSTABLE_API
#warning "GstSurfaceMeta is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
#include <gst/video/gstsurfaceconverter.h>
G_BEGIN_DECLS
typedef struct _GstSurfaceMeta GstSurfaceMeta;
/**
* GstSurfaceMeta:
* @create_converter: vmethod to create a converter.
*
*/
struct _GstSurfaceMeta {
GstMeta meta;
GstSurfaceConverter * (*create_converter) (GstSurfaceMeta *meta,
const gchar *type,
GValue *dest);
};
GType gst_surface_meta_api_get_type (void);
#define GST_SURFACE_META_API_TYPE (gst_surface_meta_api_get_type())
const GstMetaInfo *gst_surface_meta_get_info (void);
#define GST_SURFACE_META_INFO (gst_surface_meta_get_info())
#define gst_buffer_get_surface_meta(b) \
((GstSurfaceMeta*)gst_buffer_get_meta((b),GST_SURFACE_META_API_TYPE))
#define gst_buffer_add_surface_meta(b) \
((GstSurfaceMeta*)gst_buffer_add_meta((b),GST_SURFACE_META_INFO,NULL))
GstSurfaceConverter *gst_surface_meta_create_converter (GstSurfaceMeta *meta,
const gchar *type,
GValue *dest);
G_END_DECLS
#endif

View file

@ -1,539 +0,0 @@
/* GStreamer
*
* Copyright (C) 2011 Intel
* Copyright (C) 2011 Collabora Ltd.
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
*
* video-context.c: Video Context interface and helpers
*
*
* 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 "videocontext.h"
/**
* SECTION:gstvideocontext
* @short_description: Interface to handle video library context
*
* The Video Context interface enable sharing video context (such as display
* name, X11 Display, VA-API Display, etc) between neighboor elements and the
* application.
* <note>
* The GstVideoContext interface is unstable API and may change in future.
* One can define GST_USE_UNSTABLE_API to acknowledge and avoid this warning.
* </note>
*
* <refsect2>
* <title>For Element</title>
* <para>
* This interface shall be implement by group of elements that need to share
* a specific video context (like VDPAU, LibVA, OpenGL elements) or by video
* sink in order to let the application select appropriate display information
* (like the X11 display name) when those sink are auto-plugged.
* </para>
* <para>
* Along with implementing the interface, elements will need to query
* neighboor elements or send message to the application when preparing
* the context (see gst_video_context_prepare()). They also need to reply
* to the neighboors element queries, so the context can be shared without
* the application help.
* </para>
* <para>
* Elements that are guarantied to have both upstream and downstream
* neighboors element implementing the #GstVideoContext (like the gloverlay
* element in gst-plugins-opengl) is not required to also implement the
* interface. Relying on neighboors query shall be sufficient (see
* gst_video_context_run_query()).
* </para>
* <para>
* The query is an application query with a structure name set to
* "prepare-video-context" and an array of supported video context types set
* in the field named "types". This query shall be send downstream and
* upstream, iterating the pads in order to find neighboors regardless of a
* static (sink to src) or a dynamic (src to sink) activation. Element should
* used the helpers method gst_video_context_prepare() (or
* gst_video_context_run_query() if no GstVideoContext interface) to
* correctly execute the query . The result is set using the query helper
* functions, the structures fields name being "video-context-type" as
* string and "video-context" as a #GValue.
* </para>
* <para>
* If the query is not handled by any neighboor, the element should ask the
* application using the "prepare-video-context" message. The application
* may then use the interface to set the video context information. If no
* context was set, the element shall create one using default configuration.
* Elements with multiple src or sink pad shall implement proper locking to
* prevent the race of parallel queries being replied.
* </para>
* <para>
* Well known video-context are: "x11-display-name" a string representing the
* X11 display to use, "x11-display" the X11 Display structure, "va-display",
* the VADisplay structure and more.
* </para>
* </refsect2>
*
* <refsect2>
* <title>For Application</title>
* <para>
* In the case there is no neighboor element with video context to share,
* the element will first turn toward the application, by sending a
* "prepare-video-context" message. This message is sent along with a list
* of supported display types. The application can optionally reply to this
* message by calling appropriate setter through the #GstVideoContext
* interface. If the application supports more then one video context type,
* it should choose the first one to occure in the supported list. It's
* important to remember that the message is delivered from the streaming
* thread, and appropriate locking should be considered. If the application
* does not have a video context to share, the element will simply allocate
* one base on default settings. Usually, only applications using OpenGL
* base sink, or running on special X11 display need to share a video context.
* <note>
* Applications sharing X11 Display structure should always initialize the
* X11 threading support using XInitThreads() as GStreamer will need to
* manipulate the display from a separeate threads.
* </note>
* </para>
* <refsect2>
* <title>Example using ClutterVideoGstVideoSink</title>
* <para>
* This example is for user of ClutterGstVideoSink element, the
* ClutterGstPlayer object transparently handle this.
* </para>
* |[
* #if CLUTTER_WINDOWING_X11
* static GstBusSyncReply
* on_sync_message (GstBus * bus, GstMessage * message, gpointer user_data)
* {
* Display *display = user_data;
* GstVideoContext *context;
* const gchar **types;
*
* if (gst_video_context_message_parse_prepare (message, &types, &context)) {
* gint i;
*
* for (i = 0; types[i]; i++) {
*
* if (!strcmp(types[i], "x11-display")) {
* gst_video_context_set_context_pointer (context, "x11-display", display);
* }
* else if (!strcmp(types[i], "x11-display-name")) {
* gst_video_context_set_context_string (context, "x11-display-name",
* DisplayString (display));
* } else {
* continue;
* }
*
* gst_message_unref (message);
* return GST_BUS_DROP;
* }
* }
*
* return GST_BUS_PASS;
* }
* #endif
*
* gint
* main (gint argc, gchar **argv)
* {
* GstBin *pipeline;
* GstBus *bus;
*
* ...
*
* bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
*
* #if CLUTTER_WINDOWING_X11
* gst_bus_set_sync_handler (priv->bus, on_sync_message,
* clutter_x11_get_default_display (), NULL);
* #endif
*
* gst_object_unref (GST_OBJECT (priv->bus));
*
* ...
* }
* ]|
* </refsect2>
* </refsect2>
*/
G_DEFINE_INTERFACE (GstVideoContext, gst_video_context_iface, G_TYPE_INVALID);
static inline GstStructure *
gst_video_context_new_structure (const gchar ** types)
{
return gst_structure_new ("prepare-video-context",
"types", G_TYPE_STRV, types, NULL);
}
static gboolean
gst_video_context_pad_query (const GValue * item, GValue * value,
gpointer user_data)
{
GstPad *pad = g_value_get_object (item);
GstQuery *query = user_data;
gboolean res;
res = gst_pad_peer_query (pad, query);
if (res) {
g_value_set_boolean (value, TRUE);
return FALSE;
}
return TRUE;
}
static void
gst_video_context_iface_default_init (GstVideoContextInterface * iface)
{
/* default virtual functions */
iface->set_context = NULL;
}
/**
* gst_video_context_set_context:
* @context: an element implementing #GstVideoContext
* @type: the type of display being set
* @value: a #GValue containing the context
*
* This is a wrapper for the set_context() virtual method. It is suggested to
* use one of the helpers to avoid having to manipulate #GValue
*/
void
gst_video_context_set_context (GstVideoContext * context, const gchar * type,
const GValue * value)
{
g_return_if_fail (GST_IS_VIDEO_CONTEXT (context));
g_return_if_fail (GST_VIDEO_CONTEXT_GET_IFACE (context)->set_context);
GST_VIDEO_CONTEXT_GET_IFACE (context)->set_context (context, type, value);
}
/**
* gst_video_context_set_context_string:
* @context: an element implementing #GstVideoContext
* @type: the type of display being set
* @string: a string representing the video context
*
* This helper is commonly used for setting video context represented by a
* string like the X11 display name ("x11-display-name")/
*/
void
gst_video_context_set_context_string (GstVideoContext * context,
const gchar * type, const gchar * string)
{
GValue value = { 0 };
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, string);
gst_video_context_set_context (context, type, &value);
g_value_unset (&value);
}
/**
* gst_video_context_set_context_pointer:
* @context: an element implementing #GstVideoContext
* @type: the type of display being set
* @pointer: a pointer to the video context
*
* This helper is used for setting video context using a pointer, typically to
* a structure like the X11 Display ("x11-display") or the VADisplay
* ("vaapi-display").
* <note>
* Users of X11 Display should ensure that XInitThreads() was called before
* opening the display.
* </note>
*/
void
gst_video_context_set_context_pointer (GstVideoContext * context,
const gchar * type, gpointer pointer)
{
GValue value = { 0 };
g_value_init (&value, G_TYPE_POINTER);
g_value_set_pointer (&value, pointer);
gst_video_context_set_context (context, type, &value);
g_value_unset (&value);
}
/**
* gst_video_context_set_context_object:
* @context: an element implementing #GstVideoContext
* @type: the type of display being set
* @object: a #GObject resenting the display
*
* This is for video context that are #GObject, this helper allow taking
* benifit of the #GObject refcounting. It is particularly handy for element
* to have refcounting as the order in which element will stop using the
* display is not defined.
*/
void
gst_video_context_set_context_object (GstVideoContext * context,
const gchar * type, GObject * object)
{
GValue value = { 0 };
g_return_if_fail (G_IS_OBJECT (object));
g_value_init (&value, G_TYPE_OBJECT);
g_value_set_object (&value, object);
gst_video_context_set_context (context, type, &value);
g_value_unset (&value);
}
/**
* gst_video_context_prepare:
* @context: an element implementing #GstVideoContext interface
* @types: an array of supported types, prefered first
*
* This method run "prepare-video-context" custom query dowstream, and
* upstream. If * the query has a reply, it sets the context value using
* gst_video_context_set_context(). Otherwise, it sends a
* "prepare-video-context" message to the application. The element can then
* continue video context initialization.
*/
void
gst_video_context_prepare (GstVideoContext * context, const gchar ** types)
{
GstQuery *query = gst_video_context_query_new (types);
/* Check neighborhood, if found call GstVideoContext */
if (gst_video_context_run_query (GST_ELEMENT (context), query)) {
const gchar *type = NULL;
const GValue *value;
gst_video_context_query_parse_value (query, &type, &value);
gst_video_context_set_context (context, type, value);
} else {
/* If no neighbor replyed, query the application */
GstMessage *message;
GstStructure *structure;
structure = gst_video_context_new_structure (types);
message = gst_message_new_element (GST_OBJECT (context), structure);
gst_element_post_message (GST_ELEMENT (context), message);
}
gst_query_unref (query);
}
/**
* gst_video_context_message_parse_prepare:
* @message: a #GstMessage
* @types: return value for supported types
* @context: return value for the element the implements #GstVideoContext
*
* This helper shall be used by application to simply handling of the
* "prepare-video-context" message.
*
* Rerturns: #FALSE is the message was not valid "prepare-video-context"
* element message, otherwise #TRUE with @types and @context set.
*/
gboolean
gst_video_context_message_parse_prepare (GstMessage * message,
const gchar *** types, GstVideoContext ** context)
{
GstObject *src = GST_MESSAGE_SRC (message);
const GstStructure *structure;
const GValue *value;
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
return FALSE;
if (!gst_message_has_name (message, "prepare-video-context"))
return FALSE;
if (!GST_IS_VIDEO_CONTEXT (src))
return FALSE;
structure = gst_message_get_structure (message);
value = gst_structure_get_value (structure, "types");
if (!G_VALUE_HOLDS (value, G_TYPE_STRV))
return FALSE;
if (types)
*types = g_value_get_boxed (value);
if (context)
*context = GST_VIDEO_CONTEXT (src);
return TRUE;
}
/**
* gst_video_context_query_new:
* @types: a string array of video context types
*
* Create a new custom #GstQuery with structure name "prepare-video-context".
*/
GstQuery *
gst_video_context_query_new (const gchar ** types)
{
GstStructure *structure = gst_video_context_new_structure (types);
return gst_query_new_custom (GST_QUERY_CUSTOM, structure);
}
/**
* gst_video_context_run_query:
* @element: a #GstElement
* @query: a #GstQuery
*
* This helper runs the query on each downstream, then upstream pads in an
* element. This is called by gst_video_context_prepare(). This method is only
* used directly within elements that are required to have two neighboors
* elements with appropriate video context. This would be the case of
* specialized filters that only manipulate non-raw buffers (e.g.
* gldeinterlace). Those elements do not have to implement #GstVideoContext
* interface.
*/
gboolean
gst_video_context_run_query (GstElement * element, GstQuery * query)
{
GstIterator *it;
GstIteratorFoldFunction func = gst_video_context_pad_query;
GValue res = { 0 };
g_value_init (&res, G_TYPE_BOOLEAN);
g_value_set_boolean (&res, FALSE);
/* Ask downstream neighbor (mainly static pipeline case) */
it = gst_element_iterate_src_pads (element);
while (gst_iterator_fold (it, func, &res, query) == GST_ITERATOR_RESYNC)
gst_iterator_resync (it);
gst_iterator_free (it);
/* If none, ask upstream neighbor (auto-plugged case) */
if (!g_value_get_boolean (&res)) {
it = gst_element_iterate_sink_pads (element);
while (gst_iterator_fold (it, func, &res, query) == GST_ITERATOR_RESYNC)
gst_iterator_resync (it);
gst_iterator_free (it);
}
return g_value_get_boolean (&res);
}
/**
* gst_video_context_query_get_supported_types:
* @query: a #GstQuery
*
* Returns: An array of supported video context types
*/
const gchar **
gst_video_context_query_get_supported_types (GstQuery * query)
{
const GstStructure *structure = gst_query_get_structure (query);
const GValue *value = gst_structure_get_value (structure, "types");
if (G_VALUE_HOLDS (value, G_TYPE_STRV))
return g_value_get_boxed (value);
return NULL;
}
/**
* gst_video_context_query_parse_value:
* @query: a #GstQuery
* @type: return video context type
* @value: return video context #GValue
*
* Helper to extract the video context type and value from a #GstQuery.
*/
void
gst_video_context_query_parse_value (GstQuery * query, const gchar ** type,
const GValue ** value)
{
const GstStructure *structure = gst_query_get_structure (query);
if (type)
*type = gst_structure_get_string (structure, "video-context-type");
if (value)
*value = gst_structure_get_value (structure, "video-context");
}
/**
* gst_video_context_query_set_value:
* @query: a #GstQuery
* @type: the video context type
* @value: a #GValue set with video context
*
* Helper to set the video context as a #GValue inside the #GstQuery.
*/
void
gst_video_context_query_set_value (GstQuery * query, const gchar * type,
GValue * value)
{
GstStructure *structure = gst_query_writable_structure (query);
gst_structure_set (structure, "video-context-type", G_TYPE_STRING, type,
"video-context", G_TYPE_VALUE, value, NULL);
}
/**
* gst_video_context_query_set_string:
* @query: a #GstQuery
* @type: the video context type
* @value: a string representing the video context
*
* Helper to set the video context as a string inside the #GstQuery.
*/
void
gst_video_context_query_set_string (GstQuery * query, const gchar * type,
const gchar * value)
{
GstStructure *structure = gst_query_writable_structure (query);
gst_structure_set (structure, "video-context-type", G_TYPE_STRING, type,
"video-context", G_TYPE_STRING, value, NULL);
}
/**
* gst_video_context_query_set_pointer:
* @query: a #GstQuery
* @type: the video context type
* @value: a #gpointer representing the video context
*
* Helper to set the video context as a #gpointer inside the #GstQuery.
*/
void
gst_video_context_query_set_pointer (GstQuery * query, const gchar * type,
gpointer value)
{
GstStructure *structure = gst_query_writable_structure (query);
gst_structure_set (structure, "video-context-type", G_TYPE_STRING, type,
"video-context", G_TYPE_POINTER, value, NULL);
}
/**
* gst_video_context_query_set_object:
* @query: a #GstQuery
* @type: the video context type
* @value: a #GObject representing the video context
*
* Helper to set the video context as a #GObject inside the #GstQuery.
*/
void
gst_video_context_query_set_object (GstQuery * query, const gchar * type,
GObject * value)
{
GstStructure *structure = gst_query_writable_structure (query);
gst_structure_set (structure, "video-context-type", G_TYPE_STRING, type,
"video-context", G_TYPE_OBJECT, value, NULL);
}

View file

@ -1,117 +0,0 @@
/* GStreamer
*
* Copyright (C) 2011 Intel
* Copyright (C) 2011 Collabora Ltd.
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
*
* video-context.h: Video Context interface and helpers
*
*
* 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_VIDEO_CONTEXT_H__
#define __GST_VIDEO_CONTEXT_H__
#ifndef GST_USE_UNSTABLE_API
#warning "The GstVideoContext interface is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_VIDEO_CONTEXT (gst_video_context_iface_get_type ())
#define GST_VIDEO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_CONTEXT, GstVideoContext))
#define GST_IS_VIDEO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_CONTEXT))
#define GST_VIDEO_CONTEXT_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_VIDEO_CONTEXT, GstVideoContextInterface))
/**
* GstVideoContext:
*
* Opaque #GstVideoContext data structure.
*/
typedef struct _GstVideoContext GstVideoContext;
typedef struct _GstVideoContextInterface GstVideoContextInterface;
/**
* GstVideoContextInterface:
* @parent: parent interface type.
* @set_context: vmethod to set video context.
*
* #GstVideoContextInterface interface.
*/
struct _GstVideoContextInterface
{
GTypeInterface parent;
/* virtual functions */
void (*set_context) (GstVideoContext * context,
const gchar * type,
const GValue * value);
};
GType gst_video_context_iface_get_type (void);
/* virtual class method and associated helpers */
void gst_video_context_set_context (GstVideoContext * context,
const gchar * type,
const GValue * value);
void gst_video_context_set_context_string (GstVideoContext * context,
const gchar * type,
const gchar * value);
void gst_video_context_set_context_pointer (GstVideoContext * context,
const gchar * type,
gpointer value);
void gst_video_context_set_context_object (GstVideoContext * context,
const gchar * type,
GObject * value);
/* message helpers */
void gst_video_context_prepare (GstVideoContext *context,
const gchar ** types);
gboolean gst_video_context_message_parse_prepare (GstMessage * message,
const gchar *** types,
GstVideoContext ** ctx);
/* query helpers */
GstQuery * gst_video_context_query_new (const gchar ** types);
gboolean gst_video_context_run_query (GstElement *element,
GstQuery *query);
const gchar ** gst_video_context_query_get_supported_types (GstQuery * query);
void gst_video_context_query_parse_value (GstQuery * query,
const gchar ** type,
const GValue ** value);
void gst_video_context_query_set_value (GstQuery * query,
const gchar * type,
GValue * value);
void gst_video_context_query_set_string (GstQuery * query,
const gchar * type,
const gchar * value);
void gst_video_context_query_set_pointer (GstQuery * query,
const gchar * type,
gpointer value);
void gst_video_context_query_set_object (GstQuery * query,
const gchar * type,
GObject * value);
G_END_DECLS
#endif /* __GST_VIDEO_CONTEXT_H__ */

View file

@ -3,14 +3,12 @@
pcverfiles = \
gstreamer-plugins-bad-@GST_API_VERSION@.pc \
gstreamer-codecparsers-@GST_API_VERSION@.pc \
gstreamer-insertbin-@GST_API_VERSION@.pc \
gstreamer-basevideo-@GST_API_VERSION@.pc
gstreamer-insertbin-@GST_API_VERSION@.pc
pcverfiles_uninstalled = \
gstreamer-plugins-bad-@GST_API_VERSION@-uninstalled.pc \
gstreamer-codecparsers-@GST_API_VERSION@-uninstalled.pc \
gstreamer-insertbin-@GST_API_VERSION@-uninstalled.pc \
gstreamer-basevideo-@GST_API_VERSION@-uninstalled.pc
gstreamer-insertbin-@GST_API_VERSION@-uninstalled.pc
if HAVE_EGL
pcverfiles += gstreamer-egl-@GST_API_VERSION@.pc
@ -37,7 +35,6 @@ pcinfiles = \
gstreamer-plugins-bad.pc.in gstreamer-plugins-bad-uninstalled.pc.in \
gstreamer-codecparsers.pc.in gstreamer-codecparsers-uninstalled.pc.in \
gstreamer-insertbin.pc.in gstreamer-insertbin-uninstalled.pc.in \
gstreamer-basevideo.pc.in gstreamer-basevideo-uninstalled.pc.in \
gstreamer-egl.pc.in gstreamer-egl-uninstalled.pc.in
DISTCLEANFILES = $(pcinfiles:.in=)

View file

@ -1,12 +0,0 @@
prefix=
exec_prefix=
libdir=${pcfiledir}/../gst-libs/gst/video
includedir=${pcfiledir}/../gst-libs
Name: GStreamer base video, Uninstalled
Description: Base class, interface and utilities for video elements, Uninstalled
Requires: gstreamer-@GST_API_VERSION@ gstreamer-base-@GST_API_VERSION@
Version: @VERSION@
Libs: -L${libdir} ${libdir}/libgstbasevideo-@GST_API_VERSION@.la
Cflags: -I${includedir}

View file

@ -1,12 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/gstreamer-@GST_API_VERSION@
Name: GStreamer base video
Description: Base class, interface and utilities for video elements
Requires: gstreamer-@GST_API_VERSION@ gstreamer-base-@GST_API_VERSION@
Version: @VERSION@
Libs: -L${libdir} -lgstbasevideo-@GST_API_VERSION@
Cflags: -I${includedir}