goto ERROR;
}
- MEDIADEMUXER_SET_STATE(temp->queue, GST_STATE_PAUSED, ERROR);
MEDIADEMUXER_LINK_PAD(pad, queue_sink_pad, ERROR);
+ MEDIADEMUXER_SYNC_STATE_WITH_PARENT(temp->queue, ERROR);
temp->appsink = gst_element_factory_make("appsink", NULL);
if (!temp->appsink) {
gst_app_sink_set_max_buffers((GstAppSink *) temp->appsink, (guint) 0);
gst_app_sink_set_drop((GstAppSink *) temp->appsink, true);
- MEDIADEMUXER_SET_STATE(temp->appsink, GST_STATE_PAUSED, ERROR);
queue_src_pad = gst_element_get_static_pad(temp->queue, "src");
if (!queue_src_pad) {
MD_E("sink pad of video parse(%s) not available", GST_ELEMENT_NAME(parse_element));
goto ERROR;
}
- MEDIADEMUXER_SET_STATE(parse_element, GST_STATE_PAUSED, ERROR);
/* Link demuxer pad with sink pad of parse element */
MEDIADEMUXER_LINK_PAD(queue_src_pad, parse_sink_pad, ERROR);
+ MEDIADEMUXER_SYNC_STATE_WITH_PARENT(parse_element, ERROR);
+
if (strstr(temp->caps_string, "h264")) {
outcaps = gst_caps_new_simple("video/x-h264", "stream-format", G_TYPE_STRING, "byte-stream", NULL);
gst_element_link_filtered(parse_element, temp->appsink, outcaps);
goto ERROR;
}
MEDIADEMUXER_LINK_PAD(queue_src_pad, id3_sinkpad, ERROR);
- MEDIADEMUXER_SET_STATE(id3tag, GST_STATE_PAUSED, ERROR);
+ MEDIADEMUXER_SYNC_STATE_WITH_PARENT(id3tag, ERROR);
id3_srcpad = gst_element_get_static_pad(id3tag, "src");
if (!id3_srcpad) {
MD_E("fail to get id3demux src pad.\n");
MD_E("sink pad of audio parse(%s) not available", GST_ELEMENT_NAME(parse_element));
goto ERROR;
}
- MEDIADEMUXER_SET_STATE(parse_element, GST_STATE_PAUSED, ERROR);
/* Link demuxer pad with sink pad of parse element */
if (id3tag)
else
MEDIADEMUXER_LINK_PAD(queue_src_pad, parse_sink_pad, ERROR);
+ MEDIADEMUXER_SYNC_STATE_WITH_PARENT(parse_element, ERROR);
+
/* Link src pad with appSink element */
gst_element_link(parse_element, temp->appsink);
} else {
} else {
MEDIADEMUXER_LINK_PAD(queue_src_pad, apppad, ERROR);
}
+
+ MEDIADEMUXER_SYNC_STATE_WITH_PARENT(temp->appsink, ERROR);
/* gst_pad_link(pad, fpad) */
if (*head == NULL) {
*head = temp;
G_CALLBACK(__gst_on_pad_added), gst_handle);
g_signal_connect(gst_handle->demux, "no-more-pads",
G_CALLBACK(__gst_no_more_pad), gst_handle);
- gst_bin_add_many(GST_BIN(gst_handle->pipeline),
- gst_handle->demux, NULL);
+ if (!gst_bin_add(GST_BIN(gst_handle->pipeline), gst_handle->demux)) {
+ gst_object_unref(gst_handle->demux);
+ MD_E("fail add demuxer(%s) in pipeline",
+ GST_ELEMENT_NAME(gst_handle->demux));
+ goto ERROR;
+ }
+
pad = gst_element_get_static_pad(gst_handle->typefind, "src");
if (!pad) {
MD_E("fail to get typefind src pad.\n");
}
gst_pad_unlink(pad, fake_pad);
MEDIADEMUXER_LINK_PAD(pad, demuxer_pad, ERROR);
- MEDIADEMUXER_SET_STATE(gst_handle->demux,
- GST_STATE_PAUSED, ERROR);
+
+ MEDIADEMUXER_SYNC_STATE_WITH_PARENT(gst_handle->demux, ERROR);
if (pad)
gst_object_unref(pad);
if (demuxer_pad)