1 /* GStreamer encoding bin
2 * Copyright (C) 2016 Jan Schmidt <jan@centricular.com>
3 * (C) 2020 Thibault saunier <tsaunier@igalia.com>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24
25 #include <string.h>
26 #include "gstencodingelements.h"
27 #include "gstencodebasebin.h"
28 #include "gstencodebin2.h"
29
30
31 /**
32 * SECTION:element-encodebin2
33 *
34 * Encodebin2 is an updated version of #encodebin which has a request srcpad
35 * instead of having an always source pad. This makes the element more flexible
36 * and allows supporting muxing sinks for example.
37 *
38 * Based on the profile that was set (via the #GstEncodeBaseBin:profile
39 * property), EncodeBin will internally select and configure the required
40 * elements (encoders, muxers, but also audio and video converters) so that you
41 * can provide it raw or pre-encoded streams of data in input and have your
42 * encoded/muxed/converted stream in output.
43 *
44 * Since: 1.20
45 */
46
47 enum
48 {
49 PROP_0,
50 };
51
52 static GstStaticPadTemplate muxer_src_template =
53 GST_STATIC_PAD_TEMPLATE ("src_%u", GST_PAD_SRC, GST_PAD_SOMETIMES,
54 GST_STATIC_CAPS_ANY);
55
56 struct _GstEncodeBin2
57 {
58 GstEncodeBaseBin parent;
59 };
60
61 G_DEFINE_TYPE (GstEncodeBin2, gst_encode_bin2, GST_TYPE_ENCODE_BASE_BIN);
62 GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (encodebin2, "encodebin2", GST_RANK_NONE,
63 gst_encode_bin2_get_type (), encoding_element_init (plugin));
64
65 static void
gst_encode_bin2_class_init(GstEncodeBin2Class * klass)66 gst_encode_bin2_class_init (GstEncodeBin2Class * klass)
67 {
68 GstElementClass *gstelement_klass = (GstElementClass *) klass;
69
70 gst_element_class_add_static_pad_template (gstelement_klass,
71 &muxer_src_template);
72 }
73
74 static void
gst_encode_bin2_init(GstEncodeBin2 * encode_bin)75 gst_encode_bin2_init (GstEncodeBin2 * encode_bin)
76 {
77 }
78