#define DEFAULT_AVOID_REENCODING FALSE
+GST_DEBUG_CATEGORY_STATIC(gst_transcodebin_debug);
+#define GST_CAT_DEFAULT gst_transcodebin_debug
+
G_DEFINE_TYPE (GstTranscodeBin, gst_transcode_bin, GST_TYPE_BIN);
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (transcodebin, "transcodebin", GST_RANK_NONE,
GST_TYPE_TRANSCODE_BIN, transcodebin_element_init (plugin));
TranscodingStream *res = NULL;
GST_OBJECT_LOCK (self);
+ GST_DEBUG_OBJECT (self,
+ "Looking for stream %s in %u existing transcoding streams",
+ stream_id, self->transcoding_streams->len);
for (i = 0; i < self->transcoding_streams->len; i = i + 1) {
TranscodingStream *s = self->transcoding_streams->pdata[i];
done:
GST_OBJECT_UNLOCK (self);
+ GST_DEBUG_OBJECT (self, "Look-up result: %p", res);
return res;
}
TranscodingStream *res = NULL;
GstPad *encodebin_pad = get_encodebin_pad_from_stream (self, stream);
+ GST_DEBUG_OBJECT (self,
+ "Encodebin pad for stream %" GST_PTR_FORMAT " : %" GST_PTR_FORMAT, stream,
+ encodebin_pad);
if (encodebin_pad) {
GST_INFO_OBJECT (self,
"Going to transcode stream %s (encodebin pad: %" GST_PTR_FORMAT ")",
}
}
+static void
+query_upstream_selectable (GstTranscodeBin * self, GstPad * pad)
+{
+ GstQuery *query;
+ gboolean result;
+
+ /* Query whether upstream can handle stream selection or not */
+ query = gst_query_new_selectable ();
+ result = GST_PAD_IS_SINK (pad) ? gst_pad_peer_query (pad, query)
+ : gst_pad_query (pad, query);
+ if (result) {
+ GST_FIXME_OBJECT (self,
+ "We force `transcodebin` to upstream selection"
+ " mode if *any* of the inputs is. This means things might break if"
+ " there's a mix");
+ gst_query_parse_selectable (query, &self->upstream_selected);
+ GST_DEBUG_OBJECT (pad, "Upstream is selectable : %d",
+ self->upstream_selected);
+ } else {
+ self->upstream_selected = FALSE;
+ GST_DEBUG_OBJECT (pad, "Upstream does not handle SELECTABLE query");
+ }
+ gst_query_unref (query);
+}
+
static GstPadProbeReturn
wait_stream_start_probe (GstPad * pad,
GstPadProbeInfo * info, GstTranscodeBin * self)
GST_INFO_OBJECT (self,
"Got pad %" GST_PTR_FORMAT " with stream:: %" GST_PTR_FORMAT, pad,
info->data);
+ query_upstream_selectable (self, pad);
gst_transcode_bin_link_encodebin_pad (self, pad, info->data);
return GST_PAD_PROBE_REMOVE;
gst_event_parse_stream_start (sstart_event, &stream_id);
GST_INFO_OBJECT (self, "Got pad %" GST_PTR_FORMAT " with stream ID: %s",
pad, stream_id);
+ query_upstream_selectable (self, pad);
gst_transcode_bin_link_encodebin_pad (self, pad, sstart_event);
return;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_STREAM_START:
- {
- GstQuery *q = gst_query_new_selectable ();
-
- /* Query whether upstream can handle stream selection or not */
- if (gst_pad_peer_query (sinkpad, q)) {
- GST_FIXME_OBJECT (self, "We force `transcodebin` to upstream selection"
- " mode if *any* of the inputs is. This means things might break if"
- " there's a mix");
- gst_query_parse_selectable (q, &self->upstream_selected);
- GST_DEBUG_OBJECT (sinkpad, "Upstream is selectable : %d",
- self->upstream_selected);
- } else {
- self->upstream_selected = FALSE;
- GST_DEBUG_OBJECT (sinkpad, "Upstream does not handle SELECTABLE query");
- }
- gst_query_unref (q);
-
+ query_upstream_selectable (self, sinkpad);
break;
- }
default:
break;
}
object_class->get_property = gst_transcode_bin_get_property;
object_class->set_property = gst_transcode_bin_set_property;
+ GST_DEBUG_CATEGORY_INIT (gst_transcodebin_debug, "transcodebin", 0,
+ "Transcodebin element");
+
gstelement_klass = (GstElementClass *) klass;
gstelement_klass->change_state =
GST_DEBUG_FUNCPTR (gst_transcode_bin_change_state);