mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
gst/realmedia/rmdemux.c: Send discont event before pushing first buffer.
Original commit message from CVS: * gst/realmedia/rmdemux.c: (gst_rmdemux_sink_event), (gst_rmdemux_change_state), (gst_rmdemux_chain), (gst_rmdemux_get_stream_by_id), (gst_rmdemux_send_event), (gst_rmdemux_add_stream): Send discont event before pushing first buffer.
This commit is contained in:
parent
2b48c36b85
commit
26770dc8af
2 changed files with 48 additions and 8 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2005-07-18 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/realmedia/rmdemux.c: (gst_rmdemux_sink_event),
|
||||||
|
(gst_rmdemux_change_state), (gst_rmdemux_chain),
|
||||||
|
(gst_rmdemux_get_stream_by_id), (gst_rmdemux_send_event),
|
||||||
|
(gst_rmdemux_add_stream):
|
||||||
|
Send discont event before pushing first buffer.
|
||||||
|
|
||||||
2005-07-17 Philippe Khalaf <burger@speedy.org>
|
2005-07-17 Philippe Khalaf <burger@speedy.org>
|
||||||
|
|
||||||
* gst/fdsrc/gstfdsrc.c:
|
* gst/fdsrc/gstfdsrc.c:
|
||||||
|
|
|
@ -143,6 +143,7 @@ static void gst_rmdemux_dispose (GObject * object);
|
||||||
static GstElementStateReturn gst_rmdemux_change_state (GstElement * element);
|
static GstElementStateReturn gst_rmdemux_change_state (GstElement * element);
|
||||||
static GstFlowReturn gst_rmdemux_chain (GstPad * pad, GstBuffer * buffer);
|
static GstFlowReturn gst_rmdemux_chain (GstPad * pad, GstBuffer * buffer);
|
||||||
static gboolean gst_rmdemux_sink_event (GstPad * pad, GstEvent * event);
|
static gboolean gst_rmdemux_sink_event (GstPad * pad, GstEvent * event);
|
||||||
|
static gboolean gst_rmdemux_send_event (GstRMDemux * rmdemux, GstEvent * event);
|
||||||
|
|
||||||
static void gst_rmdemux_parse__rmf (GstRMDemux * rmdemux, const void *data,
|
static void gst_rmdemux_parse__rmf (GstRMDemux * rmdemux, const void *data,
|
||||||
int length);
|
int length);
|
||||||
|
@ -257,6 +258,7 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
"Realmedia stream demuxer",
|
"Realmedia stream demuxer",
|
||||||
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|
||||||
|
|
||||||
|
|
||||||
static gboolean gst_rmdemux_sink_event (GstPad * pad, GstEvent * event)
|
static gboolean gst_rmdemux_sink_event (GstPad * pad, GstEvent * event)
|
||||||
{
|
{
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
|
@ -282,8 +284,12 @@ static GstElementStateReturn
|
||||||
gst_rmdemux_change_state (GstElement * element)
|
gst_rmdemux_change_state (GstElement * element)
|
||||||
{
|
{
|
||||||
GstRMDemux *rmdemux = GST_RMDEMUX (element);
|
GstRMDemux *rmdemux = GST_RMDEMUX (element);
|
||||||
|
gint transition;
|
||||||
|
GstElementStateReturn res;
|
||||||
|
|
||||||
switch (GST_STATE_TRANSITION (element)) {
|
transition = GST_STATE_TRANSITION (element);
|
||||||
|
|
||||||
|
switch (transition) {
|
||||||
case GST_STATE_NULL_TO_READY:
|
case GST_STATE_NULL_TO_READY:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_READY_TO_PAUSED:
|
case GST_STATE_READY_TO_PAUSED:
|
||||||
|
@ -292,6 +298,11 @@ gst_rmdemux_change_state (GstElement * element)
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
||||||
|
|
||||||
|
switch (transition) {
|
||||||
case GST_STATE_PLAYING_TO_PAUSED:
|
case GST_STATE_PLAYING_TO_PAUSED:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PAUSED_TO_READY:
|
case GST_STATE_PAUSED_TO_READY:
|
||||||
|
@ -303,10 +314,7 @@ gst_rmdemux_change_state (GstElement * element)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
return res;
|
||||||
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
|
||||||
|
|
||||||
return GST_STATE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
|
@ -455,6 +463,10 @@ gst_rmdemux_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
if (!rmdemux->have_pads) {
|
if (!rmdemux->have_pads) {
|
||||||
gst_element_no_more_pads (GST_ELEMENT (rmdemux));
|
gst_element_no_more_pads (GST_ELEMENT (rmdemux));
|
||||||
rmdemux->have_pads = TRUE;
|
rmdemux->have_pads = TRUE;
|
||||||
|
|
||||||
|
gst_rmdemux_send_event (rmdemux,
|
||||||
|
gst_event_new_discontinuous (1.0, GST_FORMAT_TIME, (gint64) 0,
|
||||||
|
(gint64) - 1, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The actual header is only 8 bytes */
|
/* The actual header is only 8 bytes */
|
||||||
|
@ -533,9 +545,10 @@ static GstRMDemuxStream *
|
||||||
gst_rmdemux_get_stream_by_id (GstRMDemux * rmdemux, int id)
|
gst_rmdemux_get_stream_by_id (GstRMDemux * rmdemux, int id)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GstRMDemuxStream *stream;
|
|
||||||
|
|
||||||
for (i = 0; i < rmdemux->n_streams; i++) {
|
for (i = 0; i < rmdemux->n_streams; i++) {
|
||||||
|
GstRMDemuxStream *stream;
|
||||||
|
|
||||||
stream = rmdemux->streams[i];
|
stream = rmdemux->streams[i];
|
||||||
if (stream->id == id) {
|
if (stream->id == id) {
|
||||||
return stream;
|
return stream;
|
||||||
|
@ -545,6 +558,23 @@ gst_rmdemux_get_stream_by_id (GstRMDemux * rmdemux, int id)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_rmdemux_send_event (GstRMDemux * rmdemux, GstEvent * event)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < rmdemux->n_streams; i++) {
|
||||||
|
GstRMDemuxStream *stream;
|
||||||
|
|
||||||
|
stream = rmdemux->streams[i];
|
||||||
|
gst_event_ref (event);
|
||||||
|
gst_pad_push_event (stream->pad, event);
|
||||||
|
}
|
||||||
|
gst_event_unref (event);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
{
|
{
|
||||||
|
@ -666,8 +696,6 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
"height", G_TYPE_INT, (int) stream->height, NULL);
|
"height", G_TYPE_INT, (int) stream->height, NULL);
|
||||||
}
|
}
|
||||||
rmdemux->n_audio_streams++;
|
rmdemux->n_audio_streams++;
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING_OBJECT (rmdemux, "not adding stream of type %d",
|
GST_WARNING_OBJECT (rmdemux, "not adding stream of type %d",
|
||||||
stream->subtype);
|
stream->subtype);
|
||||||
|
@ -691,6 +719,10 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
rmdemux);
|
rmdemux);
|
||||||
gst_element_add_pad (GST_ELEMENT (rmdemux), stream->pad);
|
gst_element_add_pad (GST_ELEMENT (rmdemux), stream->pad);
|
||||||
|
|
||||||
|
gst_pad_push_event (stream->pad,
|
||||||
|
gst_event_new_discontinuous (1.0, GST_FORMAT_TIME, (gint64) 0,
|
||||||
|
(gint64) - 1, NULL));
|
||||||
|
|
||||||
/* If there's some extra data then send it as the first packet */
|
/* If there's some extra data then send it as the first packet */
|
||||||
if (stream->extra_data_size > 0) {
|
if (stream->extra_data_size > 0) {
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
|
Loading…
Reference in a new issue