diff options
-rw-r--r-- | ext/libmms/gstmms.c | 14 | ||||
-rw-r--r-- | gst/mpegdemux/gstmpegdemux.c | 27 | ||||
-rw-r--r-- | gst/mpegdemux/gstmpegtsdemux.c | 8 | ||||
-rw-r--r-- | gst/mpegdemux/mpegtspacketizer.c | 12 |
4 files changed, 51 insertions, 10 deletions
diff --git a/ext/libmms/gstmms.c b/ext/libmms/gstmms.c index f04e410f..dc004e81 100644 --- a/ext/libmms/gstmms.c +++ b/ext/libmms/gstmms.c @@ -460,8 +460,18 @@ gst_mms_start (GstBaseSrc * bsrc) GST_DEBUG_OBJECT (mms, "Connect successful"); return TRUE; } else { - GST_ELEMENT_ERROR (mms, RESOURCE, OPEN_READ, - ("Could not connect to this stream"), (NULL)); + gchar *url, *location; + + GST_ERROR_OBJECT (mms, + "Could not connect to this stream, redirecting to rtsp"); + location = gst_uri_get_location (mms->uri_name); + url = g_strdup_printf ("rtsp://%s", location); + g_free (location); + + gst_element_post_message (GST_ELEMENT_CAST (mms), + gst_message_new_element (GST_OBJECT_CAST (mms), + gst_structure_new ("redirect", "new-location", G_TYPE_STRING, url, + NULL))); return FALSE; } diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c index 40f778f0..439bb563 100644 --- a/gst/mpegdemux/gstmpegdemux.c +++ b/gst/mpegdemux/gstmpegdemux.c @@ -790,6 +790,19 @@ gst_flups_demux_close_segment (GstFluPSDemux * demux) } } +static inline gboolean +have_open_streams (GstFluPSDemux * demux) +{ + gint id; + + for (id = 0; id < GST_FLUPS_DEMUX_MAX_STREAMS; id++) { + if (demux->streams[id]) + return TRUE; + } + + return FALSE; +} + static gboolean gst_flups_demux_sink_event (GstPad * pad, GstEvent * event) { @@ -861,10 +874,11 @@ gst_flups_demux_sink_event (GstPad * pad, GstEvent * event) } case GST_EVENT_EOS: GST_INFO_OBJECT (demux, "Received EOS"); - if (!gst_flups_demux_send_event (demux, event)) { - GST_WARNING_OBJECT (demux, "failed pushing EOS on streams"); + if (!gst_flups_demux_send_event (demux, event) + && !have_open_streams (demux)) { + GST_WARNING_OBJECT (demux, "EOS and no streams open"); GST_ELEMENT_ERROR (demux, STREAM, FAILED, - ("Internal data stream error."), ("Can't push EOS downstream")); + ("Internal data stream error."), ("No valid streams detected")); } break; case GST_EVENT_CUSTOM_DOWNSTREAM: @@ -2515,10 +2529,11 @@ pause: /* normal playback, send EOS to all linked pads */ gst_element_no_more_pads (GST_ELEMENT (demux)); GST_LOG_OBJECT (demux, "Sending EOS, at end of stream"); - if (!gst_flups_demux_send_event (demux, gst_event_new_eos ())) { - GST_WARNING_OBJECT (demux, "failed pushing EOS on streams"); + if (!gst_flups_demux_send_event (demux, gst_event_new_eos ()) + && !have_open_streams (demux)) { + GST_WARNING_OBJECT (demux, "EOS and no streams open"); GST_ELEMENT_ERROR (demux, STREAM, FAILED, - ("Internal data stream error."), ("Can't push EOS downstream")); + ("Internal data stream error."), ("No valid streams detected")); } } } else { diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c index 59b51a3a..4464cdf8 100644 --- a/gst/mpegdemux/gstmpegtsdemux.c +++ b/gst/mpegdemux/gstmpegtsdemux.c @@ -474,8 +474,8 @@ gst_mpegts_demux_sink_setcaps (GstPad * pad, GstCaps * caps) gboolean ret = FALSE; GstStructure *structure = NULL; gint expected_packetsize = - (demux-> - m2ts_mode ? MPEGTS_M2TS_TS_PACKETSIZE : MPEGTS_NORMAL_TS_PACKETSIZE); + (demux->m2ts_mode ? MPEGTS_M2TS_TS_PACKETSIZE : + MPEGTS_NORMAL_TS_PACKETSIZE); gint packetsize = expected_packetsize; structure = gst_caps_get_structure (caps, 0); @@ -1287,6 +1287,10 @@ gst_mpegts_stream_parse_pmt (GstMpegTSStream * stream, /* set as elementary */ ES_stream->PID_type = PID_TYPE_ELEMENTARY; /* set stream type */ + /* hack for ITV HD (sid 10510, video pid 3401 */ + if (program_number == 10510 && entry.PID == 3401 && + stream_type == ST_PRIVATE_DATA) + stream_type = ST_VIDEO_H264; ES_stream->stream_type = stream_type; ES_stream->flags &= ~MPEGTS_STREAM_FLAG_STREAM_TYPE_UNKNOWN; diff --git a/gst/mpegdemux/mpegtspacketizer.c b/gst/mpegdemux/mpegtspacketizer.c index 923283d7..1abbf1fe 100644 --- a/gst/mpegdemux/mpegtspacketizer.c +++ b/gst/mpegdemux/mpegtspacketizer.c @@ -502,6 +502,17 @@ mpegts_packetizer_parse_pmt (MpegTSPacketizer * packetizer, g_free (struct_name); if (stream_info_length) { + /* check for AC3 descriptor */ + GstMPEGDescriptor *desc = + gst_mpeg_descriptor_parse (data, stream_info_length); + if (desc != NULL) { + if (gst_mpeg_descriptor_find (desc, DESC_DVB_AC3)) { + gst_structure_set (stream_info, "has-ac3", G_TYPE_BOOLEAN, TRUE, + NULL); + } + gst_mpeg_descriptor_free (desc); + } + descriptors = g_value_array_new (0); if (!mpegts_packetizer_parse_descriptors (packetizer, &data, data + stream_info_length, descriptors)) { @@ -514,6 +525,7 @@ mpegts_packetizer_parse_pmt (MpegTSPacketizer * packetizer, gst_structure_set (stream_info, "descriptors", G_TYPE_VALUE_ARRAY, descriptors, NULL); g_value_array_free (descriptors); + } g_value_init (&stream_value, GST_TYPE_STRUCTURE); |