1 /* GStreamer encoding bin 2 * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk> 3 * (C) 2009 Nokia Corporation 4 * (C) 2016 Jan Schmidt <jan@centricular.com> 5 * (C) 2020 Thibault saunier <tsaunier@igalia.com> 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Library General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Library General Public License for more details. 16 * 17 * You should have received a copy of the GNU Library General Public 18 * License along with this library; if not, write to the 19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 20 * Boston, MA 02110-1301, USA. 21 */ 22 23 #pragma once 24 25 #include <gst/gst.h> 26 #include <gst/pbutils/pbutils.h> 27 28 #define GST_TYPE_ENCODE_BASE_BIN (gst_encode_base_bin_get_type()) 29 #define GST_ENCODE_BASE_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODE_BASE_BIN,GstEncodeBin)) 30 #define GST_ENCODE_BASE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ENCODE_BASE_BIN,GstEncodeBinClass)) 31 #define GST_IS_ENCODE_BASE_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODE_BASE_BIN)) 32 #define GST_IS_ENCODE_BASE_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ENCODE_BASE_BIN)) 33 #define GST_ENCODE_BASE_BIN_GET_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_ENCODE_BASE_BIN, GstEncodeBaseBinClass)) 34 35 typedef struct _GstEncodeBaseBin GstEncodeBaseBin; 36 typedef struct _GstEncodeBaseBinClass GstEncodeBaseBinClass; 37 38 typedef enum 39 { 40 GST_ENCODEBIN_FLAG_NO_AUDIO_CONVERSION = (1 << 0), 41 GST_ENCODEBIN_FLAG_NO_VIDEO_CONVERSION = (1 << 1) 42 } GstEncodeBaseBinFlags; 43 44 struct _GstEncodeBaseBin 45 { 46 GstBin parent; 47 48 /* the profile field is only valid if it could be entirely setup */ 49 GstEncodingProfile *profile; 50 51 GList *streams; /* List of StreamGroup, not sorted */ 52 53 GstElement *muxer; 54 /* Ghostpad with changing target */ 55 GstPad *srcpad; 56 57 /* TRUE if in PAUSED/PLAYING */ 58 gboolean active; 59 60 /* available muxers, encoders and parsers */ 61 GList *muxers; 62 GList *formatters; 63 GList *encoders; 64 GList *parsers; 65 66 /* Increasing counter for unique pad name */ 67 guint last_pad_id; 68 69 /* Cached caps for identification */ 70 GstCaps *raw_video_caps; 71 GstCaps *raw_audio_caps; 72 /* GstCaps *raw_text_caps; */ 73 74 guint queue_buffers_max; 75 guint queue_bytes_max; 76 guint64 queue_time_max; 77 78 guint64 tolerance; 79 gboolean avoid_reencoding; 80 81 GstEncodeBaseBinFlags flags; 82 }; 83 84 struct _GstEncodeBaseBinClass 85 { 86 GstBinClass parent; 87 88 /* Action Signals */ 89 GstPad *(*request_pad) (GstEncodeBaseBin * encodebin, GstCaps * caps); 90 GstPad *(*request_profile_pad) (GstEncodeBaseBin * encodebin, 91 const gchar * profilename); 92 }; 93 94 GType gst_encode_base_bin_get_type(void); 95 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstEncodeBaseBin, gst_object_unref)