gst/: Modifications for disapearance of GST_PAD_IS_USABLE()

Original commit message from CVS:
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_chain_raw):
* gst/realmedia/rmdemux.c: (gst_rmdemux_chain),
(gst_rmdemux_add_stream), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_parse_packet):
Modifications for disapearance of GST_PAD_IS_USABLE()
This commit is contained in:
Edward Hervey 2005-11-21 10:32:55 +00:00
parent eae0c80f16
commit 7cd253d5e1
3 changed files with 37 additions and 32 deletions

View file

@ -1,3 +1,11 @@
2005-11-21 Edward Hervey <edward@fluendo.com>
* gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_chain_raw):
* gst/realmedia/rmdemux.c: (gst_rmdemux_chain),
(gst_rmdemux_add_stream), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_parse_packet):
Modifications for disapearance of GST_PAD_IS_USABLE()
2005-11-18 Michael Smith <msmith@fluendo.com>
* gst/iec958/ac3iec.c: (ac3iec_init), (ac3iec_chain_dvd):

View file

@ -442,9 +442,6 @@ gst_dvdlpcmdec_chain_raw (GstPad * pad, GstBuffer * buf)
if (dvdlpcmdec->rate == 0)
goto not_negotiated;
if (!GST_PAD_IS_USABLE (dvdlpcmdec->srcpad))
goto disabled;
/* We don't currently do anything at all regarding emphasis, mute or
* dynamic_range - I'm not sure what they're for */
switch (dvdlpcmdec->width) {
@ -561,13 +558,6 @@ not_negotiated:
ret = GST_FLOW_NOT_NEGOTIATED;
goto done;
}
disabled:
{
GST_DEBUG_OBJECT (dvdlpcmdec, "Discarding buffer on disabled pad");
gst_buffer_unref (buf);
ret = GST_FLOW_NOT_LINKED;
goto done;
}
buffer_alloc_failed:
{
GST_ELEMENT_ERROR (dvdlpcmdec, RESOURCE, FAILED, (NULL),

View file

@ -139,8 +139,8 @@ static void gst_rmdemux_parse__rmf (GstRMDemux * rmdemux, const void *data,
int length);
static void gst_rmdemux_parse_prop (GstRMDemux * rmdemux, const void *data,
int length);
static void gst_rmdemux_parse_mdpr (GstRMDemux * rmdemux, const void *data,
int length);
static GstFlowReturn gst_rmdemux_parse_mdpr (GstRMDemux * rmdemux,
const void *data, int length);
static guint gst_rmdemux_parse_indx (GstRMDemux * rmdemux, const void *data,
int length);
static void gst_rmdemux_parse_data (GstRMDemux * rmdemux, const void *data,
@ -1010,7 +1010,7 @@ gst_rmdemux_chain (GstPad * pad, GstBuffer * buffer)
goto unlock;
data = gst_adapter_peek (rmdemux->adapter, rmdemux->size);
gst_rmdemux_parse_mdpr (rmdemux, data, rmdemux->size);
ret = gst_rmdemux_parse_mdpr (rmdemux, data, rmdemux->size);
gst_adapter_flush (rmdemux->adapter, rmdemux->size);
rmdemux->state = RMDEMUX_STATE_HEADER;
@ -1189,9 +1189,10 @@ gst_rmdemux_send_event (GstRMDemux * rmdemux, GstEvent * event)
return ret;
}
void
GstFlowReturn
gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
{
GstFlowReturn ret = GST_FLOW_OK;
int version = 0;
if (stream->subtype == GST_RMDEMUX_STREAM_VIDEO) {
@ -1321,7 +1322,7 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
} else {
GST_WARNING_OBJECT (rmdemux, "not adding stream of type %d",
stream->subtype);
return;
goto beach;
}
GST_PAD_ELEMENT_PRIVATE (stream->pad) = stream;
@ -1356,23 +1357,26 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
if (stream->extra_data_size > 0) {
GstBuffer *buffer;
if (gst_pad_alloc_buffer (stream->pad, GST_BUFFER_OFFSET_NONE,
stream->extra_data_size, stream->caps, &buffer) != GST_FLOW_OK) {
if ((ret = gst_pad_alloc_buffer
(stream->pad, GST_BUFFER_OFFSET_NONE, stream->extra_data_size,
stream->caps, &buffer))
!= GST_FLOW_OK) {
GST_WARNING_OBJECT (rmdemux, "failed to alloc extra_data src "
"buffer for stream %d", stream->id);
return;
goto beach;
}
memcpy (GST_BUFFER_DATA (buffer), stream->extra_data,
stream->extra_data_size);
if (GST_PAD_IS_USABLE (stream->pad)) {
GST_DEBUG_OBJECT (rmdemux, "Pushing extra_data of size %d to pad",
stream->extra_data_size);
gst_pad_push (stream->pad, buffer);
}
GST_DEBUG_OBJECT (rmdemux, "Pushing extra_data of size %d to pad",
stream->extra_data_size);
ret = gst_pad_push (stream->pad, buffer);
}
}
beach:
return ret;
}
G_GNUC_UNUSED static void
@ -1457,7 +1461,7 @@ gst_rmdemux_parse_prop (GstRMDemux * rmdemux, const void *data, int length)
GST_LOG_OBJECT (rmdemux, "flags: 0x%04x", RMDEMUX_GUINT16_GET (data + 38));
}
static void
static GstFlowReturn
gst_rmdemux_parse_mdpr (GstRMDemux * rmdemux, const void *data, int length)
{
GstRMDemuxStream *stream;
@ -1609,7 +1613,7 @@ gst_rmdemux_parse_mdpr (GstRMDemux * rmdemux, const void *data, int length)
break;
}
gst_rmdemux_add_stream (rmdemux, stream);
return gst_rmdemux_add_stream (rmdemux, stream);
}
static guint
@ -1687,6 +1691,7 @@ gst_rmdemux_parse_packet (GstRMDemux * rmdemux, const void *data,
GstRMDemuxStream *stream;
GstBuffer *buffer;
guint16 packet_size;
GstFlowReturn ret = GST_FLOW_OK;
id = RMDEMUX_GUINT16_GET (data);
rmdemux->cur_timestamp = RMDEMUX_GUINT32_GET (data + 2) * GST_MSECOND;
@ -1710,27 +1715,29 @@ gst_rmdemux_parse_packet (GstRMDemux * rmdemux, const void *data,
if (!stream) {
GST_WARNING_OBJECT (rmdemux, "No stream for stream id %d in parsing "
"data packet", id);
return GST_FLOW_OK;
goto beach;
}
if ((rmdemux->offset + packet_size) > stream->seek_offset &&
stream && stream->pad && GST_PAD_IS_USABLE (stream->pad)) {
if (gst_pad_alloc_buffer (stream->pad, GST_BUFFER_OFFSET_NONE,
packet_size, stream->caps, &buffer) != GST_FLOW_OK) {
stream && stream->pad) {
if ((ret = gst_pad_alloc_buffer (stream->pad, GST_BUFFER_OFFSET_NONE,
packet_size, stream->caps, &buffer)) != GST_FLOW_OK) {
GST_WARNING_OBJECT (rmdemux, "failed to alloc src buffer for stream %d",
id);
return GST_FLOW_ERROR;
return ret;
}
memcpy (GST_BUFFER_DATA (buffer), (guint8 *) data, packet_size);
GST_BUFFER_TIMESTAMP (buffer) = rmdemux->cur_timestamp;
GST_DEBUG_OBJECT (rmdemux, "Pushing buffer of size %d to pad", packet_size);
return gst_pad_push (stream->pad, buffer);
ret = gst_pad_push (stream->pad, buffer);
} else {
GST_DEBUG_OBJECT (rmdemux,
"Stream %d is skipping: seek_offset=%d, offset=%d, packet_size",
stream->id, stream->seek_offset, rmdemux->offset, packet_size);
return GST_FLOW_OK;
}
beach:
return ret;
}