summaryrefslogtreecommitdiffstats
path: root/gst/mpegdemux/gstmpegtsdemux.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/mpegdemux/gstmpegtsdemux.c')
-rw-r--r--gst/mpegdemux/gstmpegtsdemux.c102
1 files changed, 52 insertions, 50 deletions
diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c
index 8de7cc75..0a6f28a5 100644
--- a/gst/mpegdemux/gstmpegtsdemux.c
+++ b/gst/mpegdemux/gstmpegtsdemux.c
@@ -48,37 +48,17 @@
#include <string.h>
#include <stdlib.h>
-#ifdef USE_LIBOIL
#include <liboil/liboil.h>
-#endif
#include "gstmpegdefs.h"
#include "gstmpegtsdemux.h"
#include "flutspatinfo.h"
#include "flutspmtinfo.h"
-#ifndef GST_CHECK_VERSION
-#define GST_CHECK_VERSION(major,minor,micro) \
- (GST_VERSION_MAJOR > (major) || \
- (GST_VERSION_MAJOR == (major) && GST_VERSION_MINOR > (minor)) || \
- (GST_VERSION_MAJOR == (major) && GST_VERSION_MINOR == (minor) && \
- GST_VERSION_MICRO >= (micro)))
-#endif
-
-#ifndef GST_BUFFER_IS_DISCONT
-#define GST_BUFFER_IS_DISCONT(buffer) \
- (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT))
-#endif
-
GST_DEBUG_CATEGORY_STATIC (gstmpegtsdemux_debug);
#define GST_CAT_DEFAULT (gstmpegtsdemux_debug)
/* elementfactory information */
-#ifdef USE_LIBOIL
-#define LONGNAME "The Fluendo MPEG Transport stream demuxer (liboil build)"
-#else
-#define LONGNAME "The Fluendo MPEG Transport stream demuxer"
-#endif
#ifndef __always_inline
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
@@ -95,7 +75,7 @@ GST_DEBUG_CATEGORY_STATIC (gstmpegtsdemux_debug);
#endif
static GstElementDetails mpegts_demux_details = {
- LONGNAME,
+ "The Fluendo MPEG Transport stream demuxer",
"Codec/Demuxer",
"Demultiplexes MPEG2 Transport Streams",
"Wim Taymans <wim@fluendo.com>"
@@ -139,7 +119,10 @@ enum
"mpegversion = (int) { 1, 2, 4 }, " \
"systemstream = (boolean) FALSE; " \
"video/x-h264;" \
- "video/x-dirac" \
+ "video/x-dirac;" \
+ "video/x-wmv," \
+ "wmvversion = (int) 3, " \
+ "format = (fourcc) WVC1" \
)
#define AUDIO_CAPS \
@@ -153,8 +136,9 @@ enum
"dynamic_range = (int) [ 0, 255 ], " \
"emphasis = (boolean) { FALSE, TRUE }, " \
"mute = (boolean) { FALSE, TRUE }; " \
- "audio/x-ac3;" \
- "audio/x-dts" \
+ "audio/x-ac3; audio/x-eac3;" \
+ "audio/x-dts;" \
+ "audio/x-private1-lpcm" \
)
/* Can also use the subpicture pads for text subtitles? */
@@ -212,6 +196,7 @@ static gboolean gst_mpegts_demux_sink_setcaps (GstPad * pad, GstCaps * caps);
static GstClock *gst_mpegts_demux_provide_clock (GstElement * element);
static gboolean gst_mpegts_demux_src_pad_query (GstPad * pad, GstQuery * query);
+static const GstQueryType *gst_mpegts_demux_src_pad_query_type (GstPad * pad);
static GstStateChangeReturn gst_mpegts_demux_change_state (GstElement * element,
GstStateChange transition);
@@ -355,9 +340,7 @@ gst_mpegts_demux_init (GstMpegTSDemux * demux)
demux->pcr[1] = -1;
demux->cache_duration = GST_CLOCK_TIME_NONE;
demux->base_pts = GST_CLOCK_TIME_NONE;
-#ifdef USE_LIBOIL
oil_init ();
-#endif
}
static void
@@ -402,7 +385,10 @@ gst_mpegts_demux_reset (GstMpegTSDemux * demux)
gst_section_filter_uninit (&stream->section_filter);
break;
}
-
+ if (stream->pes_buffer) {
+ gst_buffer_unref (stream->pes_buffer);
+ stream->pes_buffer = NULL;
+ }
g_free (stream);
demux->streams[i] = NULL;
}
@@ -577,6 +563,7 @@ gst_mpegts_stream_is_video (GstMpegTSStream * stream)
case ST_VIDEO_MPEG2:
case ST_VIDEO_MPEG4:
case ST_VIDEO_H264:
+ case ST_VIDEO_VC1:
return TRUE;
case ST_VIDEO_DIRAC:
return gst_mpegts_is_dirac_stream (stream);
@@ -673,10 +660,18 @@ gst_mpegts_demux_fill_stream (GstMpegTSStream * stream, guint8 id,
caps = gst_caps_new_simple ("video/x-dirac", NULL);
}
break;
- case ST_PS_AUDIO_AC3:
+ case ST_VIDEO_VC1:
+ template = klass->video_template;
+ name = g_strdup_printf ("video_%04x", stream->PID);
+ caps = gst_caps_new_simple ("video/x-wmv",
+ "wmvversion", G_TYPE_INT, 3,
+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('W', 'V', 'C', '1'),
+ NULL);
+ break;
+ case ST_BD_AUDIO_AC3:
template = klass->audio_template;
name = g_strdup_printf ("audio_%04x", stream->PID);
- caps = gst_caps_new_simple ("audio/x-ac3", NULL);
+ caps = gst_caps_new_simple ("audio/x-eac3", NULL);
break;
case ST_PS_AUDIO_DTS:
template = klass->audio_template;
@@ -688,6 +683,11 @@ gst_mpegts_demux_fill_stream (GstMpegTSStream * stream, guint8 id,
name = g_strdup_printf ("audio_%04x", stream->PID);
caps = gst_caps_new_simple ("audio/x-lpcm", NULL);
break;
+ case ST_BD_AUDIO_LPCM:
+ template = klass->audio_template;
+ name = g_strdup_printf ("audio_%04x", stream->PID);
+ caps = gst_caps_new_simple ("audio/x-private1-lpcm", NULL);
+ break;
case ST_PS_DVD_SUBPICTURE:
template = klass->subpicture_template;
name = g_strdup_printf ("subpicture_%04x", stream->PID);
@@ -713,6 +713,8 @@ gst_mpegts_demux_fill_stream (GstMpegTSStream * stream, guint8 id,
gst_caps_unref (caps);
gst_pad_set_query_function (stream->pad,
GST_DEBUG_FUNCPTR (gst_mpegts_demux_src_pad_query));
+ gst_pad_set_query_type_function (stream->pad,
+ GST_DEBUG_FUNCPTR (gst_mpegts_demux_src_pad_query_type));
gst_pad_set_event_function (stream->pad,
GST_DEBUG_FUNCPTR (gst_mpegts_demux_src_event));
g_free (name);
@@ -855,10 +857,6 @@ gst_mpegts_demux_send_tags_for_stream (GstMpegTSDemux * demux,
}
}
-#ifndef GST_FLOW_IS_SUCCESS
-#define GST_FLOW_IS_SUCCESS(ret) ((ret) >= GST_FLOW_OK)
-#endif
-
static GstFlowReturn
gst_mpegts_demux_combine_flows (GstMpegTSDemux * demux,
GstMpegTSStream * stream, GstFlowReturn ret)
@@ -1537,11 +1535,7 @@ gst_mpegts_stream_parse_private_section (GstMpegTSStream * stream,
/* just dump this down the pad */
if (gst_pad_alloc_buffer (stream->pad, 0, datalen, NULL, &buffer) ==
GST_FLOW_OK) {
-#ifdef USE_LIBOIL
oil_memcpy (buffer->data, data, datalen);
-#else
- memcpy (buffer->data, data, datalen);
-#endif
gst_pad_push (stream->pad, buffer);
}
@@ -2104,11 +2098,7 @@ gst_mpegts_stream_pes_buffer_push (GstMpegTSStream * stream,
stream->pes_buffer_used = 0;
}
out_data = GST_BUFFER_DATA (stream->pes_buffer) + stream->pes_buffer_used;
-#ifdef USE_LIBOIL
oil_memcpy (out_data, in_data, in_size);
-#else
- memcpy (out_data, in_data, in_size);
-#endif
stream->pes_buffer_used += in_size;
done:
return ret;
@@ -2136,11 +2126,7 @@ gst_mpegts_demux_push_fragment (GstMpegTSStream * stream,
{
GstFlowReturn ret;
GstBuffer *es_buf = gst_buffer_new_and_alloc (in_size);
-#ifdef USE_LIBOIL
oil_memcpy (GST_BUFFER_DATA (es_buf), in_data, in_size);
-#else
- memcpy (GST_BUFFER_DATA (es_buf), in_data, in_size);
-#endif
ret = gst_pes_filter_push (&stream->filter, es_buf);
/* If PES filter return ok then PES fragment buffering
@@ -2280,11 +2266,7 @@ gst_mpegts_demux_parse_stream (GstMpegTSDemux * demux, GstMpegTSStream * stream,
/* FIXME: try to use data directly instead of creating a buffer and
pushing in into adapter at section filter */
sec_buf = gst_buffer_new_and_alloc (datalen);
-#ifdef USE_LIBOIL
oil_memcpy (GST_BUFFER_DATA (sec_buf), data, datalen);
-#else
- memcpy (GST_BUFFER_DATA (sec_buf), data, datalen);
-#endif
if (gst_section_filter_push (&stream->section_filter,
payload_unit_start_indicator, continuity_counter, sec_buf)) {
GST_DEBUG_OBJECT (demux, "section finished");
@@ -2701,6 +2683,19 @@ gst_mpegts_demux_provide_clock (GstElement * element)
return NULL;
}
+static const GstQueryType *
+gst_mpegts_demux_src_pad_query_type (GstPad * pad)
+{
+ static const GstQueryType types[] = {
+ GST_QUERY_LATENCY,
+ GST_QUERY_DURATION,
+ GST_QUERY_SEEKING,
+ 0
+ };
+
+ return types;
+}
+
static gboolean
gst_mpegts_demux_src_pad_query (GstPad * pad, GstQuery * query)
{
@@ -2800,11 +2795,18 @@ gst_mpegts_demux_src_pad_query (GstPad * pad, GstQuery * query)
goto beach;
}
+ /* We can't say anything about seekability if we didn't
+ * have a second PCR yet because the bitrate is calculated
+ * from this
+ */
+ if (demux->bitrate == -1 && demux->pcr[1] == -1)
+ goto beach;
+
/* We can seek if upstream supports BYTES seeks and we
* have a bitrate
*/
peerquery = gst_query_new_seeking (GST_FORMAT_BYTES);
- res = gst_pad_peer_query (demux->sinkpad, query);
+ res = gst_pad_peer_query (demux->sinkpad, peerquery);
if (!res || demux->bitrate == -1) {
gst_query_set_seeking (query, fmt, FALSE, -1, -1);
} else {