#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-
+* gst / realmedia / rmdemux.c (gst_rmdemux_add_stream), (gst_rmdemux_src_getcaps):Added getcaps
+ function
#include "rmdemux.h"
-
#include <string.h>
#include <zlib.h>
-
#define RMDEMUX_GUINT32_GET(a) GST_READ_UINT32_BE(a)
#define RMDEMUX_GUINT16_GET(a) GST_READ_UINT16_BE(a)
#define RMDEMUX_FOURCC_GET(a) GST_READ_UINT32_LE(a)
-
typedef struct _GstRMDemuxIndex GstRMDemuxIndex;
struct _GstRMDemuxStream
int length);
static void gst_rmdemux_parse_packet (GstRMDemux * rmdemux, const void *data,
guint16 version, guint16 length);
+static GstCaps *gst_rmdemux_src_getcaps (GstPad * pad);
static GstRMDemuxStream *gst_rmdemux_get_stream_by_id (GstRMDemux * rmdemux,
int id);
(&gst_rmdemux_sink_template), "sink");
gst_pad_set_event_function (rmdemux->sinkpad, gst_rmdemux_sink_event);
gst_pad_set_chain_function (rmdemux->sinkpad, gst_rmdemux_chain);
+
gst_element_add_pad (GST_ELEMENT (rmdemux), rmdemux->sinkpad);
rmdemux->adapter = gst_adapter_new ();
break;
case GST_STATE_READY_TO_PAUSED:
rmdemux->state = RMDEMUX_STATE_HEADER;
+ rmdemux->have_pads = FALSE;
break;
case GST_STATE_PAUSED_TO_PLAYING:
break;
return GST_STATE_SUCCESS;
}
+static GstCaps *
+gst_rmdemux_src_getcaps (GstPad * pad)
+{
+ guint n;
+ GstRMDemux *rmdemux = GST_RMDEMUX (GST_PAD_PARENT (pad));
+
+ GST_DEBUG_OBJECT (rmdemux, "getcaps");
+
+ for (n = 0; n < rmdemux->n_streams; n++) {
+ if (rmdemux->streams[n] != NULL && rmdemux->streams[n]->pad == pad) {
+ return gst_caps_copy (rmdemux->streams[n]->caps);
+ }
+ }
+
+ /* Base case */
+ return gst_caps_new_empty ();
+}
+
static GstFlowReturn
gst_rmdemux_chain (GstPad * pad, GstBuffer * buffer)
{
}
case RMDEMUX_STATE_HEADER_DATA:
{
+ /* If we haven't already done so then signal there are no more pads */
+ if (!rmdemux->have_pads) {
+ gst_element_no_more_pads (GST_ELEMENT (rmdemux));
+ rmdemux->have_pads = TRUE;
+ }
+
/* The actual header is only 8 bytes */
rmdemux->size = 8;
if (gst_adapter_available (rmdemux->adapter) < rmdemux->size)
gst_rmdemux_parse_data (rmdemux, data, rmdemux->size);
gst_adapter_flush (rmdemux->adapter, rmdemux->size);
+
rmdemux->state = RMDEMUX_STATE_DATA_PACKET;
break;
}
gst_pad_set_caps (stream->pad, stream->caps);
gst_caps_unref (stream->caps);
+ gst_pad_set_getcaps_function (stream->pad, gst_rmdemux_src_getcaps);
+
GST_DEBUG_OBJECT (rmdemux, "adding pad %p to rmdemux %p", stream->pad,
rmdemux);
gst_element_add_pad (GST_ELEMENT (rmdemux), stream->pad);