mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
gst/realmedia/rmdemux.*: Make rmdemux handle any number of logical streams. Fixes #428698.
Original commit message from CVS: Patch by: René Stadler <mail at renestadler dot de> * gst/realmedia/rmdemux.c: (find_seek_offset_bytes), (find_seek_offset_time), (gst_rmdemux_reset), (gst_rmdemux_get_stream_by_id), (gst_rmdemux_send_event), (gst_rmdemux_add_stream), (gst_rmdemux_combine_flows): * gst/realmedia/rmdemux.h: Make rmdemux handle any number of logical streams. Fixes #428698.
This commit is contained in:
parent
f921ccb805
commit
47e79a2050
4 changed files with 47 additions and 39 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2007-04-12 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
Patch by: René Stadler <mail at renestadler dot de>
|
||||||
|
|
||||||
|
* gst/realmedia/rmdemux.c: (find_seek_offset_bytes),
|
||||||
|
(find_seek_offset_time), (gst_rmdemux_reset),
|
||||||
|
(gst_rmdemux_get_stream_by_id), (gst_rmdemux_send_event),
|
||||||
|
(gst_rmdemux_add_stream), (gst_rmdemux_combine_flows):
|
||||||
|
* gst/realmedia/rmdemux.h:
|
||||||
|
Make rmdemux handle any number of logical streams. Fixes #428698.
|
||||||
|
|
||||||
2007-04-05 Thomas Vander Stichele <thomas at apestaart dot org>
|
2007-04-05 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
submitted by: Mogens Jaeger <mogens@jaeger.tf>
|
submitted by: Mogens Jaeger <mogens@jaeger.tf>
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 57d4a1587556bd42c850601773c662211694c5a6
|
Subproject commit 9097e252e477e18182f08a032d8860bdee9a0416
|
|
@ -376,16 +376,15 @@ gst_rmdemux_validate_offset (GstRMDemux * rmdemux)
|
||||||
static gboolean
|
static gboolean
|
||||||
find_seek_offset_bytes (GstRMDemux * rmdemux, guint target)
|
find_seek_offset_bytes (GstRMDemux * rmdemux, guint target)
|
||||||
{
|
{
|
||||||
int i, n;
|
int i;
|
||||||
|
GSList *cur;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
if (target < 0)
|
if (target < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
for (n = 0; n < rmdemux->n_streams; n++) {
|
for (cur = rmdemux->streams; cur; cur = cur->next) {
|
||||||
GstRMDemuxStream *stream;
|
GstRMDemuxStream *stream = cur->data;
|
||||||
|
|
||||||
stream = rmdemux->streams[n];
|
|
||||||
|
|
||||||
/* Search backwards through this stream's index until we find the first
|
/* Search backwards through this stream's index until we find the first
|
||||||
* timestamp before our target time */
|
* timestamp before our target time */
|
||||||
|
@ -406,14 +405,14 @@ find_seek_offset_bytes (GstRMDemux * rmdemux, guint target)
|
||||||
static gboolean
|
static gboolean
|
||||||
find_seek_offset_time (GstRMDemux * rmdemux, GstClockTime time)
|
find_seek_offset_time (GstRMDemux * rmdemux, GstClockTime time)
|
||||||
{
|
{
|
||||||
int i, n;
|
int i, n_stream;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
GSList *cur;
|
||||||
GstClockTime earliest = GST_CLOCK_TIME_NONE;
|
GstClockTime earliest = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
for (n = 0; n < rmdemux->n_streams; n++) {
|
n_stream = 0;
|
||||||
GstRMDemuxStream *stream;
|
for (cur = rmdemux->streams; cur; cur = cur->next, n_stream++) {
|
||||||
|
GstRMDemuxStream *stream = cur->data;
|
||||||
stream = rmdemux->streams[n];
|
|
||||||
|
|
||||||
/* Search backwards through this stream's index until we find the first
|
/* Search backwards through this stream's index until we find the first
|
||||||
* timestamp before our target time */
|
* timestamp before our target time */
|
||||||
|
@ -433,7 +432,7 @@ find_seek_offset_time (GstRMDemux * rmdemux, GstClockTime time)
|
||||||
GST_DEBUG_OBJECT (rmdemux,
|
GST_DEBUG_OBJECT (rmdemux,
|
||||||
"We're looking for %" GST_TIME_FORMAT
|
"We're looking for %" GST_TIME_FORMAT
|
||||||
" and we found that stream %d has the latest index at %"
|
" and we found that stream %d has the latest index at %"
|
||||||
GST_TIME_FORMAT, GST_TIME_ARGS (rmdemux->segment.start), n,
|
GST_TIME_FORMAT, GST_TIME_ARGS (rmdemux->segment.start), n_stream,
|
||||||
GST_TIME_ARGS (earliest));
|
GST_TIME_ARGS (earliest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -675,22 +674,24 @@ gst_rmdemux_src_query_types (GstPad * pad)
|
||||||
static void
|
static void
|
||||||
gst_rmdemux_reset (GstRMDemux * rmdemux)
|
gst_rmdemux_reset (GstRMDemux * rmdemux)
|
||||||
{
|
{
|
||||||
guint n;
|
GSList *cur;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (rmdemux);
|
GST_OBJECT_LOCK (rmdemux);
|
||||||
rmdemux->running = FALSE;
|
rmdemux->running = FALSE;
|
||||||
GST_OBJECT_UNLOCK (rmdemux);
|
GST_OBJECT_UNLOCK (rmdemux);
|
||||||
|
|
||||||
for (n = 0; n < rmdemux->n_streams; ++n) {
|
for (cur = rmdemux->streams; cur; cur = cur->next) {
|
||||||
gst_rmdemux_stream_clear_cached_subpackets (rmdemux, rmdemux->streams[n]);
|
GstRMDemuxStream *stream = cur->data;
|
||||||
gst_element_remove_pad (GST_ELEMENT (rmdemux), rmdemux->streams[n]->pad);
|
|
||||||
if (rmdemux->streams[n]->subpackets)
|
gst_rmdemux_stream_clear_cached_subpackets (rmdemux, stream);
|
||||||
g_ptr_array_free (rmdemux->streams[n]->subpackets, TRUE);
|
gst_element_remove_pad (GST_ELEMENT (rmdemux), stream->pad);
|
||||||
g_free (rmdemux->streams[n]->index);
|
if (stream->subpackets)
|
||||||
g_free (rmdemux->streams[n]);
|
g_ptr_array_free (stream->subpackets, TRUE);
|
||||||
rmdemux->streams[n] = NULL;
|
g_free (stream->index);
|
||||||
|
g_free (stream);
|
||||||
}
|
}
|
||||||
rmdemux->n_streams = 0;
|
g_slist_free (rmdemux->streams);
|
||||||
|
rmdemux->streams = NULL;
|
||||||
rmdemux->n_audio_streams = 0;
|
rmdemux->n_audio_streams = 0;
|
||||||
rmdemux->n_video_streams = 0;
|
rmdemux->n_video_streams = 0;
|
||||||
|
|
||||||
|
@ -1203,12 +1204,11 @@ unlock:
|
||||||
static GstRMDemuxStream *
|
static GstRMDemuxStream *
|
||||||
gst_rmdemux_get_stream_by_id (GstRMDemux * rmdemux, int id)
|
gst_rmdemux_get_stream_by_id (GstRMDemux * rmdemux, int id)
|
||||||
{
|
{
|
||||||
int i;
|
GSList *cur;
|
||||||
|
|
||||||
for (i = 0; i < rmdemux->n_streams; i++) {
|
for (cur = rmdemux->streams; cur; cur = cur->next) {
|
||||||
GstRMDemuxStream *stream;
|
GstRMDemuxStream *stream = cur->data;
|
||||||
|
|
||||||
stream = rmdemux->streams[i];
|
|
||||||
if (stream->id == id) {
|
if (stream->id == id) {
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
@ -1220,10 +1220,10 @@ gst_rmdemux_get_stream_by_id (GstRMDemux * rmdemux, int id)
|
||||||
static void
|
static void
|
||||||
gst_rmdemux_send_event (GstRMDemux * rmdemux, GstEvent * event)
|
gst_rmdemux_send_event (GstRMDemux * rmdemux, GstEvent * event)
|
||||||
{
|
{
|
||||||
int i;
|
GSList *cur;
|
||||||
|
|
||||||
for (i = 0; i < rmdemux->n_streams; i++) {
|
for (cur = rmdemux->streams; cur; cur = cur->next) {
|
||||||
GstRMDemuxStream *stream = rmdemux->streams[i];
|
GstRMDemuxStream *stream = cur->data;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (rmdemux, "Pushing %s event on pad %s",
|
GST_DEBUG_OBJECT (rmdemux, "Pushing %s event on pad %s",
|
||||||
GST_EVENT_TYPE_NAME (event), GST_PAD_NAME (stream->pad));
|
GST_EVENT_TYPE_NAME (event), GST_PAD_NAME (stream->pad));
|
||||||
|
@ -1403,9 +1403,9 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_PAD_ELEMENT_PRIVATE (stream->pad) = stream;
|
GST_PAD_ELEMENT_PRIVATE (stream->pad) = stream;
|
||||||
rmdemux->streams[rmdemux->n_streams] = stream;
|
rmdemux->streams = g_slist_append (rmdemux->streams, stream);
|
||||||
rmdemux->n_streams++;
|
GST_LOG_OBJECT (rmdemux, "n_streams is now %d",
|
||||||
GST_LOG_OBJECT (rmdemux, "n_streams is now %d", rmdemux->n_streams);
|
g_slist_length (rmdemux->streams));
|
||||||
|
|
||||||
GST_LOG ("stream->pad = %p, stream_caps = %" GST_PTR_FORMAT, stream->pad,
|
GST_LOG ("stream->pad = %p, stream_caps = %" GST_PTR_FORMAT, stream->pad,
|
||||||
stream_caps);
|
stream_caps);
|
||||||
|
@ -1803,7 +1803,7 @@ static GstFlowReturn
|
||||||
gst_rmdemux_combine_flows (GstRMDemux * rmdemux, GstRMDemuxStream * stream,
|
gst_rmdemux_combine_flows (GstRMDemux * rmdemux, GstRMDemuxStream * stream,
|
||||||
GstFlowReturn ret)
|
GstFlowReturn ret)
|
||||||
{
|
{
|
||||||
gint i;
|
GSList *cur;
|
||||||
|
|
||||||
/* store the value */
|
/* store the value */
|
||||||
stream->last_flow = ret;
|
stream->last_flow = ret;
|
||||||
|
@ -1817,8 +1817,8 @@ gst_rmdemux_combine_flows (GstRMDemux * rmdemux, GstRMDemuxStream * stream,
|
||||||
if (ret != GST_FLOW_NOT_LINKED)
|
if (ret != GST_FLOW_NOT_LINKED)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
for (i = 0; i < rmdemux->n_streams; ++i) {
|
for (cur = rmdemux->streams; cur; cur = cur->next) {
|
||||||
GstRMDemuxStream *ostream = rmdemux->streams[i];
|
GstRMDemuxStream *ostream = cur->data;
|
||||||
|
|
||||||
ret = ostream->last_flow;
|
ret = ostream->last_flow;
|
||||||
/* some other return value (must be SUCCESS but we can return
|
/* some other return value (must be SUCCESS but we can return
|
||||||
|
|
|
@ -37,8 +37,6 @@ G_BEGIN_DECLS
|
||||||
#define GST_IS_RMDEMUX_CLASS(klass) \
|
#define GST_IS_RMDEMUX_CLASS(klass) \
|
||||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RMDEMUX))
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RMDEMUX))
|
||||||
|
|
||||||
#define GST_RMDEMUX_MAX_STREAMS 8
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
RMDEMUX_STATE_NULL,
|
RMDEMUX_STATE_NULL,
|
||||||
|
@ -83,8 +81,7 @@ struct _GstRMDemux {
|
||||||
/* pads */
|
/* pads */
|
||||||
GstPad *sinkpad;
|
GstPad *sinkpad;
|
||||||
|
|
||||||
GstRMDemuxStream *streams[GST_RMDEMUX_MAX_STREAMS];
|
GSList *streams;
|
||||||
int n_streams;
|
|
||||||
int n_video_streams;
|
int n_video_streams;
|
||||||
int n_audio_streams;
|
int n_audio_streams;
|
||||||
GstAdapter *adapter;
|
GstAdapter *adapter;
|
||||||
|
|
Loading…
Reference in a new issue