1 /* GStreamer WebM muxer
2 * Copyright (c) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * SECTION:element-webmmux
23 * webmmux muxes VP8 video and Vorbis audio streams into a WebM file.
26 * <title>Example launch line</title>
28 * gst-launch-0.10 webmmux name=mux ! filesink location=newfile.webm \
29 * uridecodebin uri=file:///path/to/somefile.ogv name=demux \
30 * demux. ! ffmpegcolorspace ! vp8enc ! queue ! mux.video_0 \
31 * demux. ! progressreport ! audioconvert ! audiorate ! vorbisenc ! queue ! mux.audio_0
32 * ]| This pipeline re-encodes a video file of any format into a WebM file.
34 * gst-launch-0.10 webmmux name=mux ! filesink location=test.webm \
35 * videotestsrc num-buffers=250 ! video/x-raw-yuv,framerate=25/1 ! ffmpegcolorspace ! vp8enc ! queue ! mux.video_0 \
36 * audiotestsrc samplesperbuffer=44100 num-buffers=10 ! audio/x-raw-float,rate=44100 ! vorbisenc ! queue ! mux.audio_0
37 * ]| This pipeline muxes a test video and a sine wave into a WebM file.
47 #define COMMON_VIDEO_CAPS \
48 "width = (int) [ 16, 4096 ], " \
49 "height = (int) [ 16, 4096 ], " \
50 "framerate = (fraction) [ 0, MAX ]"
52 #define COMMON_AUDIO_CAPS \
53 "channels = (int) [ 1, MAX ], " \
54 "rate = (int) [ 1, MAX ]"
56 GST_BOILERPLATE (GstWebMMux, gst_webm_mux, GstMatroskaMux,
57 GST_TYPE_MATROSKA_MUX);
59 static GstStaticPadTemplate webm_src_templ = GST_STATIC_PAD_TEMPLATE ("src",
62 GST_STATIC_CAPS ("video/webm")
65 static GstStaticPadTemplate webm_videosink_templ =
66 GST_STATIC_PAD_TEMPLATE ("video_%d",
69 GST_STATIC_CAPS ("video/x-vp8, " COMMON_VIDEO_CAPS)
72 static GstStaticPadTemplate webm_audiosink_templ =
73 GST_STATIC_PAD_TEMPLATE ("audio_%d",
76 GST_STATIC_CAPS ("audio/x-vorbis, " COMMON_AUDIO_CAPS)
80 gst_webm_mux_base_init (gpointer g_class)
85 gst_webm_mux_class_init (GstWebMMuxClass * klass)
87 GstElementClass *gstelement_class = (GstElementClass *) klass;
89 gst_element_class_add_pad_template (gstelement_class,
90 gst_static_pad_template_get (&webm_videosink_templ));
91 gst_element_class_add_pad_template (gstelement_class,
92 gst_static_pad_template_get (&webm_audiosink_templ));
93 gst_element_class_add_pad_template (gstelement_class,
94 gst_static_pad_template_get (&webm_src_templ));
95 gst_element_class_set_details_simple (gstelement_class, "WebM muxer",
97 "Muxes video and audio streams into a WebM stream",
98 "GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
102 gst_webm_mux_init (GstWebMMux * mux, GstWebMMuxClass * g_class)
104 GST_MATROSKA_MUX (mux)->doctype = GST_MATROSKA_DOCTYPE_WEBM;