cogl-gst: Add some documentation

Adds documentation comments to CoglGstVideoSink and makes it generate
a separate manual to contain it.

One thing that I wasn't able to figure out with this was how to get
the documentation to have correct references to the main Cogl docs.
You can pass arguments to gtkdoc-fixxref to point to other manuals,
but presumably this needs the installed locations and when the
Cogl-Gst documentation is generated the Cogl docs may not have been
installed yet.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 5acdf8db47311893a9cf9ea04a66a287b657b8b0)
This commit is contained in:
Neil Roberts 2013-04-24 19:43:00 +01:00 committed by Lionel Landwerlin
parent c50b302fc4
commit 5f86563c86
8 changed files with 485 additions and 0 deletions

13
.gitignore vendored
View File

@ -60,6 +60,19 @@ depcomp
/doc/reference/cogl2/cogl2-docs.xml /doc/reference/cogl2/cogl2-docs.xml
/doc/reference/cogl2/*.stamp /doc/reference/cogl2/*.stamp
/doc/reference/cogl2/*.bak /doc/reference/cogl2/*.bak
/doc/reference/cogl-gst/cogl-gst-*.txt
!/doc/reference/cogl-gst/cogl-gst-sections.txt
/doc/reference/cogl-gst/html
/doc/reference/cogl-gst/tmpl
/doc/reference/cogl-gst/xml
/doc/reference/cogl-gst/cogl-gst.args
/doc/reference/cogl-gst/cogl-gst.hierarchy
/doc/reference/cogl-gst/cogl-gst.interfaces
/doc/reference/cogl-gst/cogl-gst.prerequisites
/doc/reference/cogl-gst/cogl-gst.signals
/doc/reference/cogl-gst/cogl-gst-docs.xml
/doc/reference/cogl-gst/*.stamp
/doc/reference/cogl-gst/*.bak
/examples/cogl-crate /examples/cogl-crate
/examples/cogl-gles2-context /examples/cogl-gles2-context
/examples/cogl-gles2-gears /examples/cogl-gles2-gears

View File

@ -37,6 +37,46 @@
#include <gst/base/gstbasesink.h> #include <gst/base/gstbasesink.h>
#include <cogl/cogl.h> #include <cogl/cogl.h>
/**
* SECTION:cogl-gst-video-sink
* @short_description: A video sink for integrating a GStreamer
* pipeline with a Cogl pipeline.
*
* #CoglGstVideoSink is a subclass of #GstBaseSink which can be used to
* create a #CoglPipeline for rendering the frames of the video.
*
* To create a basic video player, an application can create a
* #GstPipeline as normal using gst_pipeline_new() and set the
* sink on it to one created with cogl_gst_video_sink_new(). The
* application can then listen for the #CoglGstVideoSink::new-frame
* signal which will be emitted whenever there are new textures ready
* for rendering. For simple rendering, the application can just call
* cogl_gst_video_sink_get_pipeline() in the signal handler and use
* the returned pipeline to paint the new frame.
*
* An application is also free to do more advanced rendering by
* customizing the pipeline. In that case it should listen for the
* #CoglGstVideoSink::pipeline-ready signal which will be emitted as
* soon as the sink has determined enough information about the video
* to know how it should be rendered. In the handler for this signal,
* the application can either make modifications to a copy of the
* pipeline returned by cogl_gst_video_sink_get_pipeline() or it can
* create its own pipeline from scratch and ask the sink to configure
* it with cogl_gst_video_sink_setup_pipeline(). If a custom pipeline
* is created using one of these methods then the application should
* call cogl_gst_video_sink_attach_frame() on the pipeline before
* rendering in order to update the textures on the pipeline's layers.
*
* If the %COGL_FEATURE_ID_GLSL feature is available then the pipeline
* used by the sink will have a shader snippet with a function in it
* called cogl_gst_sample_video0 which takes a single vec2 argument.
* This can be used by custom snippets set the by the application to
* sample from the video. The vec2 argument represents the normalised
* coordinates within the video.
*
* Since: 1.16
*/
G_BEGIN_DECLS G_BEGIN_DECLS
#define COGL_GST_TYPE_VIDEO_SINK cogl_gst_video_sink_get_type() #define COGL_GST_TYPE_VIDEO_SINK cogl_gst_video_sink_get_type()
@ -77,53 +117,234 @@ typedef struct _CoglGstVideoSink CoglGstVideoSink;
typedef struct _CoglGstVideoSinkClass CoglGstVideoSinkClass; typedef struct _CoglGstVideoSinkClass CoglGstVideoSinkClass;
typedef struct _CoglGstVideoSinkPrivate CoglGstVideoSinkPrivate; typedef struct _CoglGstVideoSinkPrivate CoglGstVideoSinkPrivate;
/**
* CoglGstVideoSink:
*
* The #CoglGstVideoSink structure contains only private data and
* should be accessed using the provided API.
*
* Since: 1.16
*/
struct _CoglGstVideoSink struct _CoglGstVideoSink
{ {
/*< private >*/
GstBaseSink parent; GstBaseSink parent;
CoglGstVideoSinkPrivate *priv; CoglGstVideoSinkPrivate *priv;
}; };
/**
* CoglGstVideoSinkClass:
* @new_frame: handler for the #CoglGstVideoSink::new-frame signal
* @pipeline_ready: handler for the #CoglGstVideoSink::pipeline-ready signal
*
* Since: 1.16
*/
/**
* CoglGstVideoSink::new-frame:
* @sink: the #CoglGstVideoSink
*
* The sink will emit this signal whenever there are new textures
* available for a new frame of the video. After this signal is
* emitted, an application can call cogl_gst_video_sink_get_pipeline()
* to get a pipeline suitable for rendering the frame. If the
* application is using a custom pipeline it can alternatively call
* cogl_gst_video_sink_attach_frame() to attach the textures.
*
* Since: 1.16
*/
/**
* CoglGstVideoSink::pipeline-ready:
* @sink: the #CoglGstVideoSink
*
* The sink will emit this signal as soon as it has gathered enough
* information from the video to configure a pipeline. If the
* application wants to do some customized rendering, it can setup its
* pipeline after this signal is emitted. The application's pipeline
* will typically either be a copy of the one returned by
* cogl_gst_video_sink_get_pipeline() or it can be a completely custom
* pipeline which is setup using cogl_gst_video_sink_setup_pipeline().
*
* Note that it is an error to call either of those functions before
* this signal is emitted. The #CoglGstVideoSink::new-frame signal
* will only be emitted after the pipeline is ready so the application
* could also create its pipeline in the handler for that.
*
* Since: 1.16
*/
struct _CoglGstVideoSinkClass struct _CoglGstVideoSinkClass
{ {
/*< private >*/
GstBaseSinkClass parent_class; GstBaseSinkClass parent_class;
/*< public >*/
void (* new_frame) (CoglGstVideoSink *sink); void (* new_frame) (CoglGstVideoSink *sink);
void (* pipeline_ready) (CoglGstVideoSink *sink); void (* pipeline_ready) (CoglGstVideoSink *sink);
/*< private >*/
void *_padding_dummy[8]; void *_padding_dummy[8];
}; };
GType GType
cogl_gst_video_sink_get_type (void) G_GNUC_CONST; cogl_gst_video_sink_get_type (void) G_GNUC_CONST;
/**
* cogl_gst_video_sink_new:
* @ctx: The #CoglContext
*
* Creates a new #CoglGstVideoSink which will create resources for use
* with the given context.
*
* Return value: a new #CoglGstVideoSink
* Since: 1.16
*/
CoglGstVideoSink * CoglGstVideoSink *
cogl_gst_video_sink_new (CoglContext *ctx); cogl_gst_video_sink_new (CoglContext *ctx);
/**
* cogl_gst_video_sink_get_pipeline:
* @vt: The #CoglGstVideoSink
*
* Returns a pipeline suitable for rendering the current frame of the
* given video sink. The pipeline will already have the textures for
* the frame attached. For simple rendering, an application will
* typically call this function immediately before it paints the
* video. It can then just paint a rectangle using the returned
* pipeline.
*
* An application is free to make a copy of this
* pipeline and modify it for custom rendering.
*
* Note: it is considered an error to call this function before the
* #CoglGstVideoSink::pipeline-ready signal is emitted.
*
* Return value: the pipeline for rendering the current frame
* Since: 1.16
*/
CoglPipeline * CoglPipeline *
cogl_gst_video_sink_get_pipeline (CoglGstVideoSink *vt); cogl_gst_video_sink_get_pipeline (CoglGstVideoSink *vt);
/**
* cogl_gst_video_sink_set_context:
* @vt: The #CoglGstVideoSink
* @ctx: The #CoglContext for the sink to use
*
* Sets the #CoglContext that the video sink should use for creating
* any resources. This function would normally only be used if the
* sink was constructed via gst_element_factory_make() instead of
* cogl_gst_video_sink_new().
*
* Since: 1.16
*/
void void
cogl_gst_video_sink_set_context (CoglGstVideoSink *vt, cogl_gst_video_sink_set_context (CoglGstVideoSink *vt,
CoglContext *ctx); CoglContext *ctx);
/**
* cogl_gst_video_sink_get_free_layer:
* @sink: The #CoglGstVideoSink
*
* This can be used when doing specialised rendering of the video by
* customizing the pipeline. #CoglGstVideoSink may use up to three
* private layers on the pipeline in order to attach the textures of
* the video frame. This function will return the index of the next
* available unused layer after the sink's internal layers. This can
* be used by the application to add additional layers, for example to
* blend in another color in the fragment processing.
*
* Return value: the index of the next available layer after the
* sink's internal layers.
* Since: 1.16
*/
int int
cogl_gst_video_sink_get_free_layer (CoglGstVideoSink *sink); cogl_gst_video_sink_get_free_layer (CoglGstVideoSink *sink);
/**
* cogl_gst_video_sink_attach_frame:
* @sink: The #CoglGstVideoSink
* @pln: A #CoglPipeline
*
* Updates the given pipeline with the textures for the current frame.
* This can be used if the application wants to customize the
* rendering using its own pipeline. Typically this would be called in
* response to the #CoglGstVideoSink::new-frame signal which is
* emitted whenever the new textures are available. The application
* would then make a copy of its template pipeline and call this to
* set the textures.
*
* Return value: the next free layer after the sink's internal private
* layers. This is the same value that is returned by
* cogl_gst_video_sink_get_free_layer().
* Since: 1.16
*/
int int
cogl_gst_video_sink_attach_frame (CoglGstVideoSink *sink, cogl_gst_video_sink_attach_frame (CoglGstVideoSink *sink,
CoglPipeline *pln); CoglPipeline *pln);
/**
* cogl_gst_video_sink_set_first_layer:
* @sink: The #CoglGstVideoSink
* @first_layer: The new first layer
*
* Sets the index of the first layer that the sink will use for its
* rendering. This is useful if the application wants to have custom
* layers that appear before the layers added by the sink. In that
* case by default the sink's layers will be modulated with the result
* of the application's layers that come before @first_layer.
*
* Note that if this function is called then the name of the function
* to call in the shader snippets to sample the video will also
* change. For example, if @first_layer is three then the function
* will be cogl_gst_sample_video3.
*
* Since: 1.16
*/
void void
cogl_gst_video_sink_set_first_layer (CoglGstVideoSink *sink, cogl_gst_video_sink_set_first_layer (CoglGstVideoSink *sink,
int first_layer); int first_layer);
/**
* cogl_gst_video_sink_set_default_sample:
* @sink: The #CoglGstVideoSink
* @default_sample: Whether to add the default sampling
*
* By default the pipeline generated by
* cogl_gst_video_sink_setup_pipeline() and
* cogl_gst_video_sink_get_pipeline() will have a layer with a shader
* snippet that automatically samples the video. If the application
* wants to sample the video in a completely custom way using its own
* shader snippet it can set @default_sample to %FALSE to avoid this
* default snippet being added. In that case the application's snippet
* can call cogl_gst_sample_video0 to sample the texture itself.
*
* Since: 1.16
*/
void void
cogl_gst_video_sink_set_default_sample (CoglGstVideoSink *sink, cogl_gst_video_sink_set_default_sample (CoglGstVideoSink *sink,
CoglBool default_sample); CoglBool default_sample);
/**
* cogl_gst_video_sink_setup_pipeline:
* @sink: The #CoglGstVideoSink
* @pipeline: A #CoglPipeline
*
* Configures the given pipeline so that will be able to render the
* video for the @sink. This should only be used if the application
* wants to perform some custom rendering using its own pipeline.
* Typically an application will call this in response to the
* #CoglGstVideoSink::pipeline-ready signal.
*
* Note: it is considered an error to call this function before the
* #CoglGstVideoSink::pipeline-ready signal is emitted.
*
* Since: 1.16
*/
void void
cogl_gst_video_sink_setup_pipeline (CoglGstVideoSink *sink, cogl_gst_video_sink_setup_pipeline (CoglGstVideoSink *sink,
CoglPipeline *pipeline); CoglPipeline *pipeline);
G_END_DECLS G_END_DECLS
#endif #endif

View File

@ -516,6 +516,10 @@ AS_IF([test "x$enable_cogl_gst" = "xyes"],
dnl define location of gstreamer plugin directory dnl define location of gstreamer plugin directory
plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
AC_SUBST(plugindir) AC_SUBST(plugindir)
dnl For the gtk doc generation
GSTREAMER_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-1.0`"
AC_SUBST(GSTREAMER_PREFIX)
] ]
) )
@ -1441,6 +1445,8 @@ doc/reference/cogl/Makefile
doc/reference/cogl/cogl-docs.xml doc/reference/cogl/cogl-docs.xml
doc/reference/cogl-2.0-experimental/Makefile doc/reference/cogl-2.0-experimental/Makefile
doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-docs.xml
doc/reference/cogl-gst/Makefile
doc/reference/cogl-gst/cogl-gst-docs.xml
examples/Makefile examples/Makefile
tests/Makefile tests/Makefile
tests/config.env tests/config.env

View File

@ -1 +1,5 @@
SUBDIRS = cogl cogl-2.0-experimental SUBDIRS = cogl cogl-2.0-experimental
if BUILD_COGL_GST
SUBDIRS += cogl-gst
endif

View File

@ -0,0 +1,106 @@
## Process this file with automake to produce Makefile.in
# We require automake 1.6 at least.
AUTOMAKE_OPTIONS = 1.6
# This is a blank Makefile.am for using gtk-doc.
# Copy this to your project's API docs directory and modify the variables to
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
# of using the various options.
# The name of the module, e.g. 'glib'.
DOC_MODULE=cogl-gst
# The top-level SGML file. You can change this if you want to.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml
# The directory containing the source code. Relative to $(srcdir).
# gtk-doc will search all .c & .h files beneath here for inline comments
# documenting the functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk
DOC_SOURCE_DIR=../../../cogl-gst
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=--type-init-func="gst_init(NULL, NULL)"
# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS=--deprecated-guards="COGL_DISABLE_DEPRECATED"
# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=cogl_gst
# Extra options to supply to gtkdoc-mktmpl
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
MKTMPL_OPTIONS=
# Extra options to supply to gtkdoc-fixref. Not normally needed.
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
FIXXREF_OPTIONS=\
--extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \
--extra-dir=$(GDKPIXBUF_PREFIX)/share/gtk-doc/html/gdk-pixbuf \
--extra-dir=$(GSTREAMER_PREFIX)/share/gtk-doc/html/gstreamer-1.0 \
--extra-dir=$(GSTREAMER_PREFIX)/share/gtk-doc/html/gstreamer-libs-1.0
# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
HFILE_GLOB=\
$(top_srcdir)/cogl/*.h \
$(top_builddir)/cogl/*.h \
$(top_srcdir)/cogl/winsys/*.h \
$(top_srcdir)/cogl-gst/*.h
CFILE_GLOB=$(top_srcdir)/cogl-gst/*.c
IGNORE_HFILES=\
$(NULL)
EXTRA_HFILES=
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
HTML_IMAGES=\
$(NULL)
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
content_files=\
$(NULL)
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
# e.g. expand_content_files=running.sgml
expand_content_files=\
$(NULL)
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
# signals and properties.
# e.g. AM_CPPFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
AM_CPPFLAGS=\
-I$(top_srcdir) \
-I$(top_builddir)/cogl \
-DCOGL_ENABLE_EXPERIMENTAL_API \
$(COGL_DEP_CFLAGS) \
$(COGL_GST_DEP_CFLAGS)
GTKDOC_LIBS=\
$(top_builddir)/cogl/libcogl2.la \
$(top_builddir)/cogl-gst/libcogl-gst.la \
$(COGL_DEP_LIBS) \
$(COGL_GST_DEP_LIBS)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
if BUILD_GTK_DOC
include $(top_srcdir)/gtk-doc.make
else
EXTRA_DIST =
endif
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST += $(HTML_IMAGES) $(content_files)

View File

@ -0,0 +1,105 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version "@VERSION@">
]>
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
<title>Cogl GST 2.0 Reference Manual</title>
<releaseinfo>for Cogl &version;</releaseinfo>
<copyright>
<year>2013</year>
<holder>Intel Corporation</holder>
</copyright>
<legalnotice>
<para>
Permission is granted to copy, distribute and/or modify this
document under the terms of the <citetitle>GNU Free
Documentation License</citetitle>, Version 1.1 or any later
version published by the Free Software Foundation with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. You may obtain a copy of the <citetitle>GNU Free
Documentation License</citetitle> from the Free Software
Foundation by visiting <ulink type="http"
url="http://www.fsf.org">their Web site</ulink> or by writing
to:
<address>
The Free Software Foundation, Inc.,
<street>59 Temple Place</street> - Suite 330,
<city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>,
<country>USA</country>
</address>
</para>
</legalnotice>
</bookinfo>
<chapter>
<title>Cogl GST - a library for integrating GStreamer with Cogl</title>
<section id="cogl-gst-intro">
<title>About Cogl GST</title>
<para>Cogl GST is a small library which provides a GStreamer
sink which can manage a CoglPipeline to render a video within a
Cogl scene.</para>
</section>
<section id="cogl-gst-general-apis">
<title>General APIs</title>
<xi:include href="xml/cogl-gst-video-sink.xml"/>
</section>
</chapter>
<chapter id="coglglossary">
<title>Glossaries</title>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</chapter>
<index>
<title>Index of all symbols</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<appendix id="license">
<title>License</title>
<para>
This library is free software; you can redistribute it and/or
modify it under the terms of the <citetitle>GNU Library General
Public License</citetitle> as published by the Free Software
Foundation; either version 2 of the License, or (at your option)
any later version.
</para>
<para>
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
<citetitle>GNU Library General Public License</citetitle> for
more details.
</para>
<para>
You may obtain a copy of the <citetitle>GNU Library General
Public License</citetitle> from the Free Software Foundation by
visiting <ulink type="http" url="http://www.fsf.org">their Web
site</ulink> or by writing to:
<address>
Free Software Foundation, Inc.
<street>59 Temple Place</street> - Suite 330
<city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>
<country>USA</country>
</address>
</para>
</appendix>
</book>

View File

@ -0,0 +1,28 @@
<SECTION>
<FILE>cogl-gst-video-sink</FILE>
<TITLE>CoglGstVideoSink</TITLE>
<SUBSECTION>
CoglGstVideoSink
CoglGstVideoSinkClass
cogl_gst_video_sink_new
cogl_gst_video_sink_set_context
cogl_gst_video_sink_get_pipeline
cogl_gst_video_sink_attach_frame
cogl_gst_video_sink_setup_pipeline
cogl_gst_video_sink_get_free_layer
cogl_gst_video_sink_set_first_layer
cogl_gst_video_sink_set_default_sample
<SUBSECTION Standard>
COGL_GST_IS_VIDEO_SINK
COGL_GST_IS_VIDEO_SINK_CLASS
COGL_GST_VIDEO_SINK
COGL_GST_VIDEO_SINK_CLASS
COGL_GST_TYPE_VIDEO_SINK
COGL_GST_VIDEO_SINK_GET_CLASS
<SUBSECTION Private>
CoglGstVideoSinkPrivate
cogl_gst_video_sink_get_type
</SECTION>

View File

@ -0,0 +1,2 @@
#include <cogl-gst/cogl-gst.h>
cogl_gst_video_sink_get_type