g_free (function_name);
- if (demux->index) {
+ if (demux->index && demux->times && demux->filepositions) {
/* If an index was found, insert associations */
for (i = 0; i < MIN (demux->times->len, demux->filepositions->len); i++) {
guint64 time, fileposition;
gst_element_add_pad (GST_ELEMENT (demux),
gst_object_ref (demux->audio_pad));
- if ((demux->has_audio & (demux->audio_pad != NULL)) &&
- (demux->has_video & (demux->video_pad != NULL))) {
+ if ((demux->has_audio && !demux->audio_pad) ||
+ (demux->has_video && !demux->video_pad)) {
+ GST_DEBUG_OBJECT (demux, "we are still waiting for a stream to come up "
+ "before we can emit no more pads");
+ } else {
GST_DEBUG_OBJECT (demux, "emitting no more pads");
gst_element_no_more_pads (GST_ELEMENT (demux));
}
}
/* Push taglist if present */
- if ((demux->has_audio & (demux->audio_pad != NULL)) &&
- (demux->has_video & (demux->video_pad != NULL)) &&
- demux->taglist && demux->push_tags) {
- GST_DEBUG_OBJECT (demux, "pushing tags out");
- gst_element_found_tags (GST_ELEMENT (demux), demux->taglist);
- demux->taglist = gst_tag_list_new ();
- demux->push_tags = FALSE;
+ if ((demux->has_audio && !demux->audio_pad) ||
+ (demux->has_video && !demux->video_pad)) {
+ GST_DEBUG_OBJECT (demux, "we are still waiting for a stream to come up "
+ "before we can push tags");
+ } else {
+ if (demux->taglist && demux->push_tags) {
+ GST_DEBUG_OBJECT (demux, "pushing tags out");
+ gst_element_found_tags (GST_ELEMENT (demux), demux->taglist);
+ demux->taglist = gst_tag_list_new ();
+ demux->push_tags = FALSE;
+ }
}
/* Create buffer from pad */
demux->tag_data_size - codec_data, GST_PAD_CAPS (demux->audio_pad),
&buffer);
if (G_UNLIKELY (ret != GST_FLOW_OK)) {
- GST_WARNING_OBJECT (demux, "failed allocating a %d bytes buffer",
- demux->tag_data_size);
+ GST_WARNING_OBJECT (demux, "failed allocating a %" G_GUINT64_FORMAT
+ " bytes buffer: %s", demux->tag_data_size, gst_flow_get_name (ret));
if (ret == GST_FLOW_NOT_LINKED) {
demux->audio_linked = FALSE;
}
gst_element_add_pad (GST_ELEMENT (demux),
gst_object_ref (demux->video_pad));
- if ((demux->has_audio & (demux->audio_pad != NULL)) &&
- (demux->has_video & (demux->video_pad != NULL))) {
+ if ((demux->has_audio && !demux->audio_pad) ||
+ (demux->has_video && !demux->video_pad)) {
+ GST_DEBUG_OBJECT (demux, "we are still waiting for a stream to come up "
+ "before we can emit no more pads");
+ } else {
GST_DEBUG_OBJECT (demux, "emitting no more pads");
gst_element_no_more_pads (GST_ELEMENT (demux));
}
}
/* Push taglist if present */
- if ((demux->has_audio & (demux->audio_pad != NULL)) &&
- (demux->has_video & (demux->video_pad != NULL)) &&
- demux->taglist && demux->push_tags) {
- GST_DEBUG_OBJECT (demux, "pushing tags out");
- gst_element_found_tags (GST_ELEMENT (demux), demux->taglist);
- demux->taglist = gst_tag_list_new ();
- demux->push_tags = FALSE;
+ if ((demux->has_audio && !demux->audio_pad) ||
+ (demux->has_video && !demux->video_pad)) {
+ GST_DEBUG_OBJECT (demux, "we are still waiting for a stream to come up "
+ "before we can push tags");
+ } else {
+ if (demux->taglist && demux->push_tags) {
+ GST_DEBUG_OBJECT (demux, "pushing tags out");
+ gst_element_found_tags (GST_ELEMENT (demux), demux->taglist);
+ demux->taglist = gst_tag_list_new ();
+ demux->push_tags = FALSE;
+ }
}
/* Create buffer from pad */
demux->tag_data_size - codec_data, GST_PAD_CAPS (demux->video_pad),
&buffer);
if (G_UNLIKELY (ret != GST_FLOW_OK)) {
- GST_WARNING_OBJECT (demux, "failed allocating a %d bytes buffer",
- demux->tag_data_size);
+ GST_WARNING_OBJECT (demux, "failed allocating a %" G_GUINT64_FORMAT
+ " bytes buffer: %s", demux->tag_data_size, gst_flow_get_name (ret));
if (ret == GST_FLOW_NOT_LINKED) {
demux->video_linked = FALSE;
}