matroska: move webmmux into own source files

Makes things easier for gtk-doc.
This commit is contained in:
Tim-Philipp Müller 2010-05-21 12:47:03 +01:00
parent a0d89ac54e
commit 0e12bf83a3
6 changed files with 163 additions and 82 deletions

View file

@ -7,6 +7,7 @@ libgstmatroska_la_SOURCES = \
matroska-demux.c \
matroska-ids.c \
matroska-mux.c \
webm-mux.c \
lzo.c
noinst_HEADERS = \
@ -16,6 +17,7 @@ noinst_HEADERS = \
matroska-demux.h \
matroska-ids.h \
matroska-mux.h \
webm-mux.h \
lzo.h
libgstmatroska_la_CFLAGS = \
@ -34,4 +36,3 @@ libgstmatroska_la_LIBADD = \
$(LIBM)
libgstmatroska_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstmatroska_la_LIBTOOLFLAGS = --tag=disable-static

View file

@ -204,7 +204,6 @@ G_LOCK_DEFINE_STATIC (used_uids);
static void gst_matroska_mux_add_interfaces (GType type);
GType gst_matroska_mux_get_type (void);
GST_BOILERPLATE_FULL (GstMatroskaMux, gst_matroska_mux, GstElement,
GST_TYPE_ELEMENT, gst_matroska_mux_add_interfaces);
@ -2814,80 +2813,3 @@ gst_matroska_mux_get_property (GObject * object,
break;
}
}
#define parent_class webm_parent_class
GType gst_webm_mux_get_type (void);
typedef GstMatroskaMux GstWebMMux;
typedef GstMatroskaMuxClass GstWebMMuxClass;
#define GST_TYPE_WEBM_MUX \
(gst_webm_mux_get_type ())
#define GST_WEBM_MUX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WEBM_MUX, GstWebMMux))
#define GST_WEBM_MUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WEBM_MUX, GstWebMMuxClass))
#define GST_IS_WEBM_MUX(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WEBM_MUX))
#define GST_IS_WEBM_MUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WEBM_MUX))
GST_BOILERPLATE (GstWebMMux, gst_webm_mux, GstMatroskaMux,
GST_TYPE_MATROSKA_MUX);
static GstStaticPadTemplate webm_src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/webm")
);
static GstStaticPadTemplate webm_videosink_templ =
GST_STATIC_PAD_TEMPLATE ("video_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("video/x-vp8, " COMMON_VIDEO_CAPS)
);
static GstStaticPadTemplate webm_audiosink_templ =
GST_STATIC_PAD_TEMPLATE ("audio_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("audio/x-vorbis, " COMMON_AUDIO_CAPS)
);
static void
gst_webm_mux_base_init (gpointer g_class)
{
}
static void
gst_webm_mux_class_init (GstWebMMuxClass * klass)
{
GstElementClass *gstelement_class = (GstElementClass *) klass;
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&webm_videosink_templ));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&webm_audiosink_templ));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&webm_src_templ));
gst_element_class_set_details_simple (gstelement_class, "WebM muxer",
"Codec/Muxer",
"Muxes video/audio/subtitle streams into a WebM stream",
"GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
}
static void
gst_webm_mux_init (GstWebMMux * mux, GstWebMMuxClass * g_class)
{
mux->doctype = GST_MATROSKA_DOCTYPE_WEBM;
}
gboolean
gst_matroska_mux_plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "matroskamux",
GST_RANK_PRIMARY, GST_TYPE_MATROSKA_MUX) &&
gst_element_register (plugin, "webmmux",
GST_RANK_PRIMARY, GST_TYPE_WEBM_MUX);
}

View file

@ -128,7 +128,7 @@ typedef struct _GstMatroskaMuxClass {
GstElementClass parent;
} GstMatroskaMuxClass;
gboolean gst_matroska_mux_plugin_init (GstPlugin *plugin);
GType gst_matroska_mux_get_type (void);
G_END_DECLS

View file

@ -26,13 +26,22 @@
#include "matroska-demux.h"
#include "matroska-mux.h"
#include "matroska-ids.h"
#include "webm-mux.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean ret;
gst_matroska_register_tags ();
return gst_matroska_demux_plugin_init (plugin) &&
gst_matroska_mux_plugin_init (plugin);
ret = gst_matroska_demux_plugin_init (plugin);
ret &= gst_element_register (plugin, "matroskamux", GST_RANK_PRIMARY,
GST_TYPE_MATROSKA_MUX);
ret &= gst_element_register (plugin, "webmmux", GST_RANK_PRIMARY,
GST_TYPE_WEBM_MUX);
return ret;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

100
gst/matroska/webm-mux.c Normal file
View file

@ -0,0 +1,100 @@
/* GStreamer WebM muxer
* Copyright (c) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:element-webmmux
*
* webmmux muxes VP8 video and Vorbis audio streams into a WebM file.
*
* <refsect2>
* <title>Example launch line</title>
* |[
* FIXME: add example pipeline
* ]| This pipeline muxes this and that into a WebM file.
* |[
* FIXME: add example pipeline
* ]| This pipeline muxes something else into a WebM file.
* </refsect2>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "webm-mux.h"
#define COMMON_VIDEO_CAPS \
"width = (int) [ 16, 4096 ], " \
"height = (int) [ 16, 4096 ], " \
"framerate = (fraction) [ 0, MAX ]"
#define COMMON_AUDIO_CAPS \
"channels = (int) [ 1, MAX ], " \
"rate = (int) [ 1, MAX ]"
GST_BOILERPLATE (GstWebMMux, gst_webm_mux, GstMatroskaMux,
GST_TYPE_MATROSKA_MUX);
static GstStaticPadTemplate webm_src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/webm")
);
static GstStaticPadTemplate webm_videosink_templ =
GST_STATIC_PAD_TEMPLATE ("video_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("video/x-vp8, " COMMON_VIDEO_CAPS)
);
static GstStaticPadTemplate webm_audiosink_templ =
GST_STATIC_PAD_TEMPLATE ("audio_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS ("audio/x-vorbis, " COMMON_AUDIO_CAPS)
);
static void
gst_webm_mux_base_init (gpointer g_class)
{
}
static void
gst_webm_mux_class_init (GstWebMMuxClass * klass)
{
GstElementClass *gstelement_class = (GstElementClass *) klass;
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&webm_videosink_templ));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&webm_audiosink_templ));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&webm_src_templ));
gst_element_class_set_details_simple (gstelement_class, "WebM muxer",
"Codec/Muxer",
"Muxes video/audio/subtitle streams into a WebM stream",
"GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
}
static void
gst_webm_mux_init (GstWebMMux * mux, GstWebMMuxClass * g_class)
{
GST_MATROSKA_MUX (mux)->doctype = GST_MATROSKA_DOCTYPE_WEBM;
}

49
gst/matroska/webm-mux.h Normal file
View file

@ -0,0 +1,49 @@
/* GStreamer WebM muxer
* Copyright (c) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_WEBM_MUX_H__
#define __GST_WEBM_MUX_H__
#include "matroska-mux.h"
#define GST_TYPE_WEBM_MUX \
(gst_webm_mux_get_type ())
#define GST_WEBM_MUX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WEBM_MUX, GstWebMMux))
#define GST_WEBM_MUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WEBM_MUX, GstWebMMuxClass))
#define GST_IS_WEBM_MUX(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WEBM_MUX))
#define GST_IS_WEBM_MUX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WEBM_MUX))
typedef struct _GstWebMMux GstWebMMux;
typedef struct _GstWebMMuxClass GstWebMMuxClass;
struct _GstWebMMux {
GstMatroskaMux matroskamux;
};
struct _GstWebMMuxClass {
GstMatroskaMuxClass matroskamuxclass;
};
GType gst_webm_mux_get_type (void);
#endif /* __GST_WEBM_MUX_H__ */