2003-06-22 03:59:01 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* Copyright (C) <2003> David A. Schleef <ds@schleef.org>
|
2004-10-03 11:50:11 +00:00
|
|
|
* Copyright (C) <2004> Stephane Loeuillet <gstreamer@leroutier.net>
|
2003-06-22 03:59:01 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2003-06-22 03:59:01 +00:00
|
|
|
#include "rmdemux.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <zlib.h>
|
|
|
|
|
2004-04-20 21:05:40 +00:00
|
|
|
#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)
|
2003-06-22 03:59:01 +00:00
|
|
|
|
|
|
|
typedef struct _GstRMDemuxIndex GstRMDemuxIndex;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
struct _GstRMDemuxStream
|
|
|
|
{
|
2003-06-22 03:59:01 +00:00
|
|
|
guint32 subtype;
|
|
|
|
guint32 fourcc;
|
2004-10-04 16:10:41 +00:00
|
|
|
guint32 subid;
|
2003-06-22 03:59:01 +00:00
|
|
|
int id;
|
|
|
|
GstCaps *caps;
|
|
|
|
GstPad *pad;
|
|
|
|
int n_samples;
|
|
|
|
int timescale;
|
|
|
|
|
|
|
|
int sample_index;
|
|
|
|
GstRMDemuxIndex *index;
|
|
|
|
int index_length;
|
|
|
|
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
double rate;
|
|
|
|
int n_channels;
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
struct _GstRMDemuxIndex
|
|
|
|
{
|
2003-06-22 03:59:01 +00:00
|
|
|
int unknown;
|
|
|
|
guint32 offset;
|
|
|
|
int timestamp;
|
|
|
|
int frame;
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
enum GstRMDemuxState
|
|
|
|
{
|
2003-06-22 03:59:01 +00:00
|
|
|
RMDEMUX_STATE_NULL,
|
|
|
|
RMDEMUX_STATE_HEADER,
|
|
|
|
RMDEMUX_STATE_HEADER_SEEKING,
|
|
|
|
RMDEMUX_STATE_SEEKING,
|
|
|
|
RMDEMUX_STATE_PLAYING,
|
|
|
|
RMDEMUX_STATE_SEEKING_EOS,
|
2004-05-21 22:39:29 +00:00
|
|
|
RMDEMUX_STATE_EOS
|
2003-06-22 03:59:01 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
enum GstRMDemuxStreamType
|
|
|
|
{
|
2003-06-22 03:59:01 +00:00
|
|
|
GST_RMDEMUX_STREAM_UNKNOWN,
|
|
|
|
GST_RMDEMUX_STREAM_VIDEO,
|
|
|
|
GST_RMDEMUX_STREAM_AUDIO,
|
2004-05-21 22:39:29 +00:00
|
|
|
GST_RMDEMUX_STREAM_FILEINFO
|
2003-06-22 03:59:01 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstElementDetails gst_rmdemux_details = {
|
2003-10-28 20:52:41 +00:00
|
|
|
"RealMedia Demuxer",
|
2003-06-22 03:59:01 +00:00
|
|
|
"Codec/Demuxer",
|
|
|
|
"Demultiplex a RealMedia file into audio and video streams",
|
2003-11-02 21:52:09 +00:00
|
|
|
"David Schleef <ds@schleef.org>"
|
2003-06-22 03:59:01 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-06-22 03:59:01 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-06-22 03:59:01 +00:00
|
|
|
ARG_0
|
|
|
|
};
|
|
|
|
|
2003-12-22 01:47:08 +00:00
|
|
|
static GstStaticPadTemplate gst_rmdemux_sink_template =
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2004-10-03 01:37:11 +00:00
|
|
|
GST_STATIC_CAPS ("application/vnd.rn-realmedia")
|
2004-03-14 22:34:30 +00:00
|
|
|
);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2003-12-22 01:47:08 +00:00
|
|
|
static GstStaticPadTemplate gst_rmdemux_videosrc_template =
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("video_%02d",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_SOMETIMES,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2003-12-22 01:47:08 +00:00
|
|
|
static GstStaticPadTemplate gst_rmdemux_audiosrc_template =
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("audio_%02d",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_SOMETIMES,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (rmdemux_debug);
|
|
|
|
#define GST_CAT_DEFAULT rmdemux_debug
|
|
|
|
|
2003-06-22 03:59:01 +00:00
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void gst_rmdemux_class_init (GstRMDemuxClass * klass);
|
|
|
|
static void gst_rmdemux_base_init (GstRMDemuxClass * klass);
|
|
|
|
static void gst_rmdemux_init (GstRMDemux * rmdemux);
|
|
|
|
static GstElementStateReturn gst_rmdemux_change_state (GstElement * element);
|
|
|
|
static void gst_rmdemux_loop (GstElement * element);
|
|
|
|
static gboolean gst_rmdemux_handle_sink_event (GstRMDemux * rmdemux);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
|
|
|
//static GstCaps *gst_rmdemux_video_caps(GstRMDemux *rmdemux, guint32 fourcc);
|
|
|
|
//static GstCaps *gst_rmdemux_audio_caps(GstRMDemux *rmdemux, guint32 fourcc);
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void gst_rmdemux_parse__rmf (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
static void gst_rmdemux_parse_prop (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
static void gst_rmdemux_parse_mdpr (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
static void gst_rmdemux_parse_indx (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
static void gst_rmdemux_parse_data (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
static void gst_rmdemux_parse_cont (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
|
|
|
|
static void gst_rmdemux_dump__rmf (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
static void gst_rmdemux_dump_prop (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
static void gst_rmdemux_dump_mdpr (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
static void gst_rmdemux_dump_indx (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
static void gst_rmdemux_dump_data (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
static void gst_rmdemux_dump_cont (GstRMDemux * rmdemux, void *data,
|
|
|
|
int length);
|
|
|
|
|
|
|
|
static GstRMDemuxStream *gst_rmdemux_get_stream_by_id (GstRMDemux * rmdemux,
|
2003-06-24 08:05:12 +00:00
|
|
|
int id);
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GType
|
|
|
|
gst_rmdemux_get_type (void)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
static GType rmdemux_type = 0;
|
|
|
|
|
|
|
|
if (!rmdemux_type) {
|
|
|
|
static const GTypeInfo rmdemux_info = {
|
2004-03-14 22:34:30 +00:00
|
|
|
sizeof (GstRMDemuxClass),
|
|
|
|
(GBaseInitFunc) gst_rmdemux_base_init, NULL,
|
|
|
|
(GClassInitFunc) gst_rmdemux_class_init,
|
|
|
|
NULL, NULL, sizeof (GstRMDemux), 0,
|
|
|
|
(GInstanceInitFunc) gst_rmdemux_init,
|
2003-06-22 03:59:01 +00:00
|
|
|
};
|
2004-03-15 19:32:25 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
rmdemux_type =
|
2004-03-15 19:32:25 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT, "GstRMDemux", &rmdemux_info,
|
|
|
|
0);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
return rmdemux_type;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_base_init (GstRMDemuxClass * klass)
|
2003-11-02 21:52:09 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
2003-12-22 01:47:08 +00:00
|
|
|
gst_static_pad_template_get (&gst_rmdemux_sink_template));
|
2003-11-02 21:52:09 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2003-12-22 01:47:08 +00:00
|
|
|
gst_static_pad_template_get (&gst_rmdemux_videosrc_template));
|
2003-11-02 21:52:09 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2003-12-22 01:47:08 +00:00
|
|
|
gst_static_pad_template_get (&gst_rmdemux_audiosrc_template));
|
2003-11-02 21:52:09 +00:00
|
|
|
gst_element_class_set_details (element_class, &gst_rmdemux_details);
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_class_init (GstRMDemuxClass * klass)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2003-06-22 03:59:01 +00:00
|
|
|
|
|
|
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
|
|
|
|
|
|
|
gstelement_class->change_state = gst_rmdemux_change_state;
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (rmdemux_debug, "rmdemux",
|
|
|
|
0, "Demuxer for Realmedia streams");
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_init (GstRMDemux * rmdemux)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_FLAG_SET (rmdemux, GST_ELEMENT_EVENT_AWARE);
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
rmdemux->sinkpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&gst_rmdemux_sink_template), "sink");
|
2003-06-22 03:59:01 +00:00
|
|
|
gst_element_set_loop_function (GST_ELEMENT (rmdemux), gst_rmdemux_loop);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (rmdemux), rmdemux->sinkpad);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
2003-10-28 20:52:41 +00:00
|
|
|
if (!gst_library_load ("gstbytestream"))
|
|
|
|
return FALSE;
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2003-11-02 21:52:09 +00:00
|
|
|
return gst_element_register (plugin, "rmdemux",
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_RANK_PRIMARY, GST_TYPE_RMDEMUX);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"rmdemux",
|
|
|
|
"Realmedia stream demuxer",
|
|
|
|
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static gboolean gst_rmdemux_handle_sink_event (GstRMDemux * rmdemux)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
guint32 remaining;
|
|
|
|
GstEvent *event;
|
|
|
|
GstEventType type;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_bytestream_get_status (rmdemux->bs, &remaining, &event);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
|
2003-06-29 19:46:09 +00:00
|
|
|
GST_DEBUG ("rmdemux: event %p %d", event, type);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
switch (type) {
|
2003-06-22 03:59:01 +00:00
|
|
|
case GST_EVENT_EOS:
|
2004-10-04 16:10:41 +00:00
|
|
|
gst_pad_event_default (rmdemux->sinkpad, event);
|
2003-06-22 03:59:01 +00:00
|
|
|
return FALSE;
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
case GST_EVENT_INTERRUPT:
|
|
|
|
gst_event_unref (event);
|
|
|
|
return FALSE;
|
2003-06-22 03:59:01 +00:00
|
|
|
case GST_EVENT_FLUSH:
|
|
|
|
break;
|
|
|
|
case GST_EVENT_DISCONTINUOUS:
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_DEBUG ("discontinuous event");
|
2003-06-22 03:59:01 +00:00
|
|
|
//gst_bytestream_flush_fast(rmdemux->bs, remaining);
|
|
|
|
break;
|
|
|
|
default:
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_WARNING ("unhandled event %d", type);
|
2003-06-22 03:59:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_event_unref (event);
|
2003-06-22 03:59:01 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstElementStateReturn
|
|
|
|
gst_rmdemux_change_state (GstElement * element)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
2004-03-14 22:34:30 +00:00
|
|
|
GstRMDemux *rmdemux = GST_RMDEMUX (element);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
switch (GST_STATE_TRANSITION (element)) {
|
2003-06-22 03:59:01 +00:00
|
|
|
case GST_STATE_NULL_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_READY_TO_PAUSED:
|
2004-03-14 22:34:30 +00:00
|
|
|
rmdemux->bs = gst_bytestream_new (rmdemux->sinkpad);
|
2003-06-22 03:59:01 +00:00
|
|
|
rmdemux->state = RMDEMUX_STATE_HEADER;
|
|
|
|
/* FIXME */
|
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
|
|
|
case GST_STATE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_READY:
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_bytestream_destroy (rmdemux->bs);
|
2003-06-22 03:59:01 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_READY_TO_NULL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_loop (GstElement * element)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
2004-03-14 22:34:30 +00:00
|
|
|
GstRMDemux *rmdemux = GST_RMDEMUX (element);
|
2003-06-22 03:59:01 +00:00
|
|
|
guint8 *data;
|
|
|
|
guint32 length;
|
|
|
|
guint32 fourcc;
|
|
|
|
GstBuffer *buf;
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2003-06-22 03:59:01 +00:00
|
|
|
//int offset;
|
|
|
|
int cur_offset;
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2003-06-22 03:59:01 +00:00
|
|
|
//int size;
|
|
|
|
int ret;
|
|
|
|
int rlen;
|
|
|
|
|
|
|
|
/* FIXME _tell gets the offset wrong */
|
|
|
|
//cur_offset = gst_bytestream_tell(rmdemux->bs);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2003-06-22 03:59:01 +00:00
|
|
|
cur_offset = rmdemux->offset;
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_DEBUG ("loop at position %d, state %d", cur_offset, rmdemux->state);
|
2003-06-24 08:05:12 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
if (rmdemux->length == 0) {
|
|
|
|
rmdemux->length = gst_bytestream_length (rmdemux->bs);
|
2003-06-24 08:05:12 +00:00
|
|
|
}
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
switch (rmdemux->state) {
|
|
|
|
case RMDEMUX_STATE_HEADER:
|
|
|
|
{
|
|
|
|
do {
|
2004-03-15 19:32:25 +00:00
|
|
|
ret = gst_bytestream_peek_bytes (rmdemux->bs, &data, 16);
|
|
|
|
if (ret < 16) {
|
|
|
|
if (!gst_rmdemux_handle_sink_event (rmdemux)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
} while (1);
|
|
|
|
|
|
|
|
fourcc = RMDEMUX_FOURCC_GET (data + 0);
|
|
|
|
length = RMDEMUX_GUINT32_GET (data + 4);
|
|
|
|
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("fourcc " GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
|
|
|
|
GST_LOG ("length %08x", length);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2004-10-03 01:37:11 +00:00
|
|
|
rlen = MIN (length, 4096) - 8;
|
2004-03-14 22:34:30 +00:00
|
|
|
|
|
|
|
switch (fourcc) {
|
2004-03-15 19:32:25 +00:00
|
|
|
case GST_MAKE_FOURCC ('.', 'R', 'M', 'F'):
|
|
|
|
gst_bytestream_read (rmdemux->bs, &buf, length);
|
|
|
|
data = GST_BUFFER_DATA (buf);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
gst_rmdemux_dump__rmf (rmdemux, data + 8, rlen);
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_rmdemux_parse__rmf (rmdemux, data + 8, rlen);
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('P', 'R', 'O', 'P'):
|
|
|
|
gst_bytestream_read (rmdemux->bs, &buf, length);
|
|
|
|
data = GST_BUFFER_DATA (buf);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
gst_rmdemux_dump_prop (rmdemux, data + 8, rlen);
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_rmdemux_parse_prop (rmdemux, data + 8, rlen);
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('M', 'D', 'P', 'R'):
|
|
|
|
gst_bytestream_read (rmdemux->bs, &buf, length);
|
|
|
|
data = GST_BUFFER_DATA (buf);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
gst_rmdemux_dump_mdpr (rmdemux, data + 8, rlen);
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_rmdemux_parse_mdpr (rmdemux, data + 8, rlen);
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('I', 'N', 'D', 'X'):
|
|
|
|
gst_bytestream_read (rmdemux->bs, &buf, length);
|
|
|
|
data = GST_BUFFER_DATA (buf);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
gst_rmdemux_dump_indx (rmdemux, data + 8, rlen);
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_rmdemux_parse_indx (rmdemux, data + 8, rlen);
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('D', 'A', 'T', 'A'):
|
|
|
|
rmdemux->data_offset = rmdemux->offset + 10;
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
gst_rmdemux_dump_data (rmdemux, data + 8, rlen);
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_rmdemux_parse_data (rmdemux, data + 8, rlen);
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('C', 'O', 'N', 'T'):
|
|
|
|
gst_bytestream_read (rmdemux->bs, &buf, length);
|
|
|
|
data = GST_BUFFER_DATA (buf);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
gst_rmdemux_dump_cont (rmdemux, data + 8, rlen);
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_rmdemux_parse_cont (rmdemux, data + 8, rlen);
|
|
|
|
break;
|
|
|
|
default:
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_WARNING ("unknown fourcc " GST_FOURCC_FORMAT,
|
2004-03-15 19:32:25 +00:00
|
|
|
GST_FOURCC_ARGS (fourcc));
|
|
|
|
break;
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-10-04 16:10:41 +00:00
|
|
|
rmdemux->offset += length ? length : 8;
|
2004-03-14 22:34:30 +00:00
|
|
|
if (rmdemux->offset < rmdemux->length) {
|
2004-03-15 19:32:25 +00:00
|
|
|
ret = gst_bytestream_seek (rmdemux->bs, rmdemux->offset,
|
|
|
|
GST_SEEK_METHOD_SET);
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2004-03-15 19:32:25 +00:00
|
|
|
rmdemux->offset = rmdemux->data_offset + 8;
|
|
|
|
rmdemux->state = RMDEMUX_STATE_PLAYING;
|
|
|
|
ret = gst_bytestream_seek (rmdemux->bs, rmdemux->offset,
|
|
|
|
GST_SEEK_METHOD_SET);
|
2003-06-24 08:05:12 +00:00
|
|
|
|
2004-10-04 16:10:41 +00:00
|
|
|
GST_DEBUG ("no more pads to come");
|
|
|
|
gst_element_no_more_pads (element);
|
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
break;
|
2003-06-24 08:05:12 +00:00
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
case RMDEMUX_STATE_SEEKING_EOS:
|
|
|
|
{
|
|
|
|
guint8 *data;
|
|
|
|
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
for (;;) {
|
|
|
|
ret = gst_bytestream_peek_bytes (rmdemux->bs, &data, 1);
|
|
|
|
if (ret < 1) {
|
|
|
|
if (!gst_rmdemux_handle_sink_event (rmdemux))
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
/* didn't expect this */
|
|
|
|
GST_WARNING ("expected EOS event");
|
|
|
|
break;
|
2004-03-15 19:32:25 +00:00
|
|
|
}
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
rmdemux->state = RMDEMUX_STATE_EOS;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case RMDEMUX_STATE_EOS:
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
g_warning ("spinning in EOS");
|
2004-03-14 22:34:30 +00:00
|
|
|
return;
|
|
|
|
case RMDEMUX_STATE_PLAYING:
|
|
|
|
{
|
|
|
|
int id, timestamp, unknown1;
|
|
|
|
GstRMDemuxStream *stream;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
|
|
|
|
do {
|
2004-03-15 19:32:25 +00:00
|
|
|
ret = gst_bytestream_peek_bytes (rmdemux->bs, &data, 10);
|
|
|
|
if (ret < 10) {
|
|
|
|
if (!gst_rmdemux_handle_sink_event (rmdemux)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
} while (1);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
length = RMDEMUX_GUINT32_GET (data + 0);
|
|
|
|
id = RMDEMUX_GUINT16_GET (data + 4);
|
|
|
|
timestamp = RMDEMUX_GUINT32_GET (data + 6);
|
|
|
|
unknown1 = RMDEMUX_GUINT16_GET (data + 10);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_DEBUG ("length %d stream id %d timestamp %d unknown %d",
|
2004-03-15 19:32:25 +00:00
|
|
|
length, id, timestamp, unknown1);
|
2003-06-24 08:05:12 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_bytestream_flush (rmdemux->bs, 12);
|
2003-06-24 08:05:12 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_bytestream_read (rmdemux->bs, &buffer, length - 12);
|
|
|
|
stream = gst_rmdemux_get_stream_by_id (rmdemux, id);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-10-04 16:10:41 +00:00
|
|
|
if (stream && stream->pad && GST_PAD_IS_USABLE (stream->pad)) {
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_pad_push (stream->pad, GST_DATA (buffer));
|
2004-10-04 16:10:41 +00:00
|
|
|
} else {
|
|
|
|
gst_buffer_unref (buffer);
|
2004-03-14 22:34:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rmdemux->chunk_index++;
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_DEBUG ("chunk_index %d n_chunks %d", rmdemux->chunk_index,
|
2004-03-15 19:32:25 +00:00
|
|
|
rmdemux->n_chunks);
|
2004-03-14 22:34:30 +00:00
|
|
|
if (rmdemux->chunk_index < rmdemux->n_chunks) {
|
2004-03-15 19:32:25 +00:00
|
|
|
rmdemux->offset += length;
|
|
|
|
ret = gst_bytestream_seek (rmdemux->bs, rmdemux->offset,
|
|
|
|
GST_SEEK_METHOD_SET);
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2004-03-15 19:32:25 +00:00
|
|
|
ret = gst_bytestream_seek (rmdemux->bs, 0, GST_SEEK_METHOD_END);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_DEBUG ("seek to end returned %d", ret);
|
2004-03-15 19:32:25 +00:00
|
|
|
rmdemux->state = RMDEMUX_STATE_SEEKING_EOS;
|
2004-03-14 22:34:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
/* unreached */
|
|
|
|
g_assert (0);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstRMDemuxStream *
|
|
|
|
gst_rmdemux_get_stream_by_id (GstRMDemux * rmdemux, int id)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
GstRMDemuxStream *stream;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
for (i = 0; i < rmdemux->n_streams; i++) {
|
2003-06-22 03:59:01 +00:00
|
|
|
stream = rmdemux->streams[i];
|
2004-03-14 22:34:30 +00:00
|
|
|
if (stream->id == id) {
|
2003-06-22 03:59:01 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
void
|
|
|
|
gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
2004-10-03 15:54:31 +00:00
|
|
|
int version = 0;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
if (stream->subtype == GST_RMDEMUX_STREAM_VIDEO) {
|
|
|
|
stream->pad =
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&gst_rmdemux_videosrc_template), g_strdup_printf ("video_%02d",
|
|
|
|
rmdemux->n_video_streams));
|
2004-10-03 11:50:11 +00:00
|
|
|
switch (stream->fourcc) {
|
2004-10-03 15:54:31 +00:00
|
|
|
case GST_RM_VDO_RV10:
|
|
|
|
version = 1;
|
|
|
|
break;
|
|
|
|
case GST_RM_VDO_RV20:
|
|
|
|
version = 2;
|
|
|
|
break;
|
|
|
|
case GST_RM_VDO_RV30:
|
|
|
|
version = 3;
|
|
|
|
break;
|
|
|
|
case GST_RM_VDO_RV40:
|
|
|
|
version = 4;
|
2004-10-03 11:50:11 +00:00
|
|
|
break;
|
|
|
|
default:
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_WARNING ("Unknown video FOURCC code");
|
2004-10-03 11:50:11 +00:00
|
|
|
}
|
2004-10-03 15:54:31 +00:00
|
|
|
if (version) {
|
|
|
|
stream->caps =
|
|
|
|
gst_caps_new_simple ("video/x-pn-realvideo", "rmversion", G_TYPE_INT,
|
2004-10-04 16:10:41 +00:00
|
|
|
(int) version, "rmsubid", GST_TYPE_FOURCC, stream->subid, NULL);
|
2004-10-03 15:54:31 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
if (stream->caps) {
|
2003-12-22 01:47:08 +00:00
|
|
|
gst_caps_set_simple (stream->caps,
|
2004-03-15 19:32:25 +00:00
|
|
|
"width", G_TYPE_INT, stream->width,
|
|
|
|
"height", G_TYPE_INT, stream->height, NULL);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
rmdemux->n_video_streams++;
|
2004-03-14 22:34:30 +00:00
|
|
|
} else if (stream->subtype == GST_RMDEMUX_STREAM_AUDIO) {
|
|
|
|
stream->pad =
|
2004-03-15 19:32:25 +00:00
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&gst_rmdemux_audiosrc_template), g_strdup_printf ("audio_%02d",
|
|
|
|
rmdemux->n_audio_streams));
|
2004-10-03 11:50:11 +00:00
|
|
|
switch (stream->fourcc) {
|
2004-10-03 15:54:31 +00:00
|
|
|
/* Older RealAudio Codecs */
|
|
|
|
case GST_RM_AUD_14_4:
|
|
|
|
version = 1;
|
2004-10-04 16:10:41 +00:00
|
|
|
break;
|
|
|
|
|
2004-10-03 15:54:31 +00:00
|
|
|
case GST_RM_AUD_28_8:
|
|
|
|
version = 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* DolbyNet (Dolby AC3, low bitrate) */
|
|
|
|
case GST_RM_AUD_DNET:
|
2004-10-04 18:27:54 +00:00
|
|
|
stream->caps =
|
|
|
|
gst_caps_new_simple ("audio/x-ac3", "rate", G_TYPE_INT,
|
|
|
|
(int) stream->rate, NULL);
|
2004-10-03 15:54:31 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* MPEG-4 based */
|
|
|
|
case GST_RM_AUD_RAAC:
|
|
|
|
case GST_RM_AUD_RACP:
|
|
|
|
stream->caps =
|
|
|
|
gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT,
|
|
|
|
(int) 4, NULL);
|
|
|
|
break;
|
|
|
|
|
2004-10-06 14:18:13 +00:00
|
|
|
/* Sony ATRAC3 */
|
|
|
|
case GST_RM_AUD_ATRC:
|
|
|
|
stream->caps = gst_caps_new_simple ("audio/x-vnd.sony.atrac3", NULL);
|
|
|
|
break;
|
|
|
|
|
2004-10-03 15:54:31 +00:00
|
|
|
/* RealAudio audio/RALF is lossless */
|
|
|
|
case GST_RM_AUD_COOK:
|
|
|
|
case GST_RM_AUD_RALF:
|
|
|
|
|
|
|
|
/* Sipro/ACELP-NET Voice Codec */
|
|
|
|
case GST_RM_AUD_SIPR:
|
|
|
|
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_WARNING ("Nothing known to decode this audio FOURCC code");
|
2004-10-03 11:50:11 +00:00
|
|
|
break;
|
2004-10-03 15:54:31 +00:00
|
|
|
|
2004-10-03 11:50:11 +00:00
|
|
|
default:
|
2004-10-04 16:10:41 +00:00
|
|
|
GST_WARNING ("Unknown audio FOURCC code " GST_FOURCC_FORMAT,
|
|
|
|
stream->fourcc);
|
|
|
|
break;
|
2004-10-03 11:50:11 +00:00
|
|
|
}
|
2004-10-03 15:54:31 +00:00
|
|
|
|
|
|
|
if (version) {
|
|
|
|
stream->caps =
|
|
|
|
gst_caps_new_simple ("audio/x-pn-realaudio", "raversion", G_TYPE_INT,
|
|
|
|
(int) version, NULL);
|
|
|
|
}
|
|
|
|
|
2004-10-03 11:50:11 +00:00
|
|
|
if (stream->caps) {
|
|
|
|
gst_caps_set_simple (stream->caps,
|
|
|
|
"rate", G_TYPE_INT, (int) stream->rate,
|
|
|
|
"channels", G_TYPE_INT, stream->n_channels, NULL);
|
|
|
|
}
|
2003-06-22 03:59:01 +00:00
|
|
|
rmdemux->n_audio_streams++;
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_WARNING ("not adding stream of type %d", stream->subtype);
|
2004-10-03 12:39:19 +00:00
|
|
|
return;
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2003-12-22 01:47:08 +00:00
|
|
|
GST_PAD_ELEMENT_PRIVATE (stream->pad) = stream;
|
2003-06-22 03:59:01 +00:00
|
|
|
rmdemux->streams[rmdemux->n_streams] = stream;
|
|
|
|
rmdemux->n_streams++;
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("n_streams is now %d", rmdemux->n_streams);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
if (stream->pad) {
|
2004-01-02 07:09:23 +00:00
|
|
|
gst_pad_use_explicit_caps (stream->pad);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-02-04 19:45:31 +00:00
|
|
|
GST_DEBUG ("setting caps: " GST_PTR_FORMAT, stream->caps);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_pad_set_explicit_caps (stream->pad, stream->caps);
|
2004-02-04 21:40:49 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("adding pad %p to rmdemux %p", stream->pad, rmdemux);
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (rmdemux), stream->pad);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstCaps *
|
|
|
|
gst_rmdemux_video_caps (GstRMDemux * rmdemux, guint32 fourcc)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstCaps *
|
|
|
|
gst_rmdemux_audio_caps (GstRMDemux * rmdemux, guint32 fourcc)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
re_hexdump_bytes (guint8 * ptr, int len, int offset)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
#if 0
|
2003-06-22 03:59:01 +00:00
|
|
|
guint8 *end = ptr + len;
|
|
|
|
int i;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
while (1) {
|
|
|
|
if (ptr >= end)
|
|
|
|
return;
|
|
|
|
g_print ("%08x: ", offset);
|
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
if (ptr + i >= end) {
|
2004-03-15 19:32:25 +00:00
|
|
|
g_print (" ");
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2004-03-15 19:32:25 +00:00
|
|
|
g_print ("%02x ", ptr[i]);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
if (ptr + i >= end) {
|
2004-03-15 19:32:25 +00:00
|
|
|
g_print (" ");
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2004-03-15 19:32:25 +00:00
|
|
|
g_print ("%c", g_ascii_isprint (ptr[i]) ? ptr[i] : '.');
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
g_print ("\n");
|
2003-06-22 03:59:01 +00:00
|
|
|
ptr += 16;
|
|
|
|
offset += 16;
|
|
|
|
}
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
#endif
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static int
|
|
|
|
re_dump_pascal_string (guint8 * ptr)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
int length;
|
|
|
|
|
|
|
|
length = ptr[0];
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_DEBUG ("string: %.*s", length, (char *) ptr + 1);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
|
|
|
return length + 1;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static char *
|
|
|
|
re_get_pascal_string (guint8 * ptr)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
int length;
|
|
|
|
|
|
|
|
length = ptr[0];
|
2004-03-14 22:34:30 +00:00
|
|
|
return g_strndup (ptr + 1, length);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static int
|
|
|
|
re_skip_pascal_string (guint8 * ptr)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
int length;
|
|
|
|
|
|
|
|
length = ptr[0];
|
|
|
|
|
|
|
|
return length + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_parse__rmf (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_dump__rmf (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("version: %d", RMDEMUX_GUINT16_GET (data + 0));
|
|
|
|
GST_LOG ("unknown: %d", RMDEMUX_GUINT32_GET (data + 2));
|
|
|
|
GST_LOG ("unknown: %d", RMDEMUX_GUINT32_GET (data + 6));
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_parse_prop (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
rmdemux->duration = RMDEMUX_GUINT32_GET (data + 22);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_dump_prop (GstRMDemux * rmdemux, void *data, int length)
|
|
|
|
{
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("version: %d", RMDEMUX_GUINT16_GET (data + 0));
|
|
|
|
GST_LOG ("max bitrate: %d", RMDEMUX_GUINT32_GET (data + 2));
|
|
|
|
GST_LOG ("avg bitrate: %d", RMDEMUX_GUINT32_GET (data + 6));
|
|
|
|
GST_LOG ("max packet size: %d", RMDEMUX_GUINT32_GET (data + 10));
|
|
|
|
GST_LOG ("avg packet size: %d", RMDEMUX_GUINT32_GET (data + 14));
|
|
|
|
GST_LOG ("number of packets: %d", RMDEMUX_GUINT32_GET (data + 18));
|
|
|
|
GST_LOG ("duration: %d", RMDEMUX_GUINT32_GET (data + 22));
|
|
|
|
GST_LOG ("preroll: %d", RMDEMUX_GUINT32_GET (data + 26));
|
|
|
|
GST_LOG ("offset of INDX section: 0x%08x", RMDEMUX_GUINT32_GET (data + 30));
|
|
|
|
GST_LOG ("offset of DATA section: 0x%08x", RMDEMUX_GUINT32_GET (data + 34));
|
|
|
|
GST_LOG ("n streams: %d", RMDEMUX_GUINT16_GET (data + 38));
|
|
|
|
GST_LOG ("flags: 0x%04x", RMDEMUX_GUINT16_GET (data + 40));
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_parse_mdpr (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
GstRMDemuxStream *stream;
|
|
|
|
char *stream1_type_string;
|
|
|
|
char *stream2_type_string;
|
|
|
|
int stream_type;
|
|
|
|
int offset;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
stream = g_new0 (GstRMDemuxStream, 1);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
stream->id = RMDEMUX_GUINT16_GET (data + 2);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
|
|
|
offset = 32;
|
|
|
|
stream_type = GST_RMDEMUX_STREAM_UNKNOWN;
|
2004-03-14 22:34:30 +00:00
|
|
|
stream1_type_string = re_get_pascal_string (data + offset);
|
|
|
|
offset += re_skip_pascal_string (data + offset);
|
|
|
|
stream2_type_string = re_get_pascal_string (data + offset);
|
|
|
|
offset += re_skip_pascal_string (data + offset);
|
2004-10-04 18:27:54 +00:00
|
|
|
|
|
|
|
/* stream1_type_string for audio and video stream is a "put_whatever_you_want" field :
|
|
|
|
observed values :
|
|
|
|
- "[The ]Video/Audio Stream" (File produced by an official Real encoder)
|
|
|
|
- "RealVideoPremierePlugIn-VIDEO/AUDIO" (File produced by Abobe Premiere)
|
|
|
|
|
|
|
|
so, we should not rely on it to know which stream type it is
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (strcmp (stream2_type_string, "video/x-pn-realvideo") == 0) {
|
2003-06-22 03:59:01 +00:00
|
|
|
stream_type = GST_RMDEMUX_STREAM_VIDEO;
|
2004-10-04 18:27:54 +00:00
|
|
|
} else if (strcmp (stream2_type_string, "audio/x-pn-realaudio") == 0) {
|
2003-06-22 03:59:01 +00:00
|
|
|
stream_type = GST_RMDEMUX_STREAM_AUDIO;
|
2004-03-14 22:34:30 +00:00
|
|
|
} else if (strcmp (stream1_type_string, "") == 0 &&
|
|
|
|
strcmp (stream2_type_string, "logical-fileinfo") == 0) {
|
2003-06-22 03:59:01 +00:00
|
|
|
stream_type = GST_RMDEMUX_STREAM_FILEINFO;
|
2004-03-14 22:34:30 +00:00
|
|
|
} else {
|
2003-06-22 03:59:01 +00:00
|
|
|
stream_type = GST_RMDEMUX_STREAM_UNKNOWN;
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_WARNING ("unknown stream type \"%s\",\"%s\"", stream1_type_string,
|
2004-03-15 19:32:25 +00:00
|
|
|
stream2_type_string);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
g_free (stream1_type_string);
|
|
|
|
g_free (stream2_type_string);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
stream->subtype = stream_type;
|
2004-03-14 22:34:30 +00:00
|
|
|
switch (stream_type) {
|
2004-10-03 15:54:31 +00:00
|
|
|
|
2003-06-22 03:59:01 +00:00
|
|
|
case GST_RMDEMUX_STREAM_VIDEO:
|
2004-10-03 11:50:11 +00:00
|
|
|
/* RV10/RV20/RV30/RV40 => video/x-pn-realvideo, version=1,2,3,4 */
|
2004-03-14 22:34:30 +00:00
|
|
|
stream->fourcc = RMDEMUX_FOURCC_GET (data + offset + 8);
|
2004-10-03 01:37:11 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
stream->width = RMDEMUX_GUINT16_GET (data + offset + 12);
|
|
|
|
stream->height = RMDEMUX_GUINT16_GET (data + offset + 14);
|
|
|
|
stream->rate = RMDEMUX_GUINT16_GET (data + offset + 16);
|
2004-10-04 16:10:41 +00:00
|
|
|
stream->subid = RMDEMUX_GUINT32_GET (data + offset + 30);
|
2003-06-22 03:59:01 +00:00
|
|
|
break;
|
2004-10-03 17:14:14 +00:00
|
|
|
case GST_RMDEMUX_STREAM_AUDIO:{
|
|
|
|
int audio_fourcc_offset;
|
|
|
|
|
2004-10-03 15:54:31 +00:00
|
|
|
/* .ra4/.ra5 */
|
2004-03-14 22:34:30 +00:00
|
|
|
stream->fourcc = RMDEMUX_FOURCC_GET (data + offset + 8);
|
2004-10-03 01:37:11 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
stream->rate = RMDEMUX_GUINT32_GET (data + offset + 48);
|
2004-10-03 15:54:31 +00:00
|
|
|
|
|
|
|
switch (stream->fourcc) {
|
|
|
|
case GST_RM_AUD_xRA4:
|
|
|
|
audio_fourcc_offset = 62;
|
|
|
|
break;
|
|
|
|
case GST_RM_AUD_xRA5:
|
|
|
|
audio_fourcc_offset = 66;
|
|
|
|
break;
|
|
|
|
default:
|
2004-10-03 17:14:14 +00:00
|
|
|
audio_fourcc_offset = 0;
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_WARNING ("Unknown audio stream format");
|
2004-10-03 15:54:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 14_4, 28_8, cook, dnet, sipr, raac, racp, ralf, atrc */
|
|
|
|
stream->fourcc = RMDEMUX_FOURCC_GET (data + offset + audio_fourcc_offset);
|
2003-06-22 03:59:01 +00:00
|
|
|
break;
|
2004-10-03 17:14:14 +00:00
|
|
|
}
|
2003-06-22 03:59:01 +00:00
|
|
|
case GST_RMDEMUX_STREAM_FILEINFO:
|
2004-03-14 22:34:30 +00:00
|
|
|
{
|
2004-10-03 01:37:11 +00:00
|
|
|
int element_nb;
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2004-10-03 01:37:11 +00:00
|
|
|
/* Length of this section */
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_DEBUG ("length2: 0x%08x", RMDEMUX_GUINT32_GET (data + offset));
|
2004-03-14 22:34:30 +00:00
|
|
|
offset += 4;
|
2004-10-03 01:37:11 +00:00
|
|
|
|
|
|
|
/* Unknown : 00 00 00 00 */
|
|
|
|
re_hexdump_bytes (data + offset, 4, offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* Number of variables that would follow (loop iterations) */
|
|
|
|
element_nb = RMDEMUX_GUINT32_GET (data + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
while (element_nb) {
|
|
|
|
/* Category Id : 00 00 00 XX 00 00 */
|
|
|
|
re_hexdump_bytes (data + offset, 6, offset);
|
2004-03-15 19:32:25 +00:00
|
|
|
offset += 6;
|
2004-10-03 01:37:11 +00:00
|
|
|
|
|
|
|
/* Variable Name */
|
2004-03-15 19:32:25 +00:00
|
|
|
offset += re_dump_pascal_string (data + offset);
|
2004-10-03 01:37:11 +00:00
|
|
|
|
|
|
|
/* Variable Value Type */
|
|
|
|
/* 00 00 00 00 00 => integer/boolean, preceded by length */
|
|
|
|
/* 00 00 00 02 00 => pascal string, preceded by length, no trailing \0 */
|
|
|
|
re_hexdump_bytes (data + offset, 5, offset);
|
2004-03-15 19:32:25 +00:00
|
|
|
offset += 5;
|
2004-10-03 01:37:11 +00:00
|
|
|
|
|
|
|
/* Variable Value */
|
2004-03-15 19:32:25 +00:00
|
|
|
offset += re_dump_pascal_string (data + offset);
|
2004-10-03 01:37:11 +00:00
|
|
|
|
|
|
|
element_nb--;
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
}
|
2003-06-22 03:59:01 +00:00
|
|
|
break;
|
|
|
|
case GST_RMDEMUX_STREAM_UNKNOWN:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_rmdemux_add_stream (rmdemux, stream);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_dump_mdpr (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
int offset = 0;
|
|
|
|
char *stream_type;
|
|
|
|
guint32 fourcc;
|
|
|
|
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("version: %d", RMDEMUX_GUINT16_GET (data + 0));
|
|
|
|
GST_LOG ("stream id: %d", RMDEMUX_GUINT16_GET (data + 2));
|
|
|
|
GST_LOG ("max bitrate: %d", RMDEMUX_GUINT32_GET (data + 4));
|
|
|
|
GST_LOG ("avg bitrate: %d", RMDEMUX_GUINT32_GET (data + 8));
|
|
|
|
GST_LOG ("max packet size: %d", RMDEMUX_GUINT32_GET (data + 12));
|
|
|
|
GST_LOG ("avg packet size: %d", RMDEMUX_GUINT32_GET (data + 16));
|
|
|
|
GST_LOG ("start time: %d", RMDEMUX_GUINT32_GET (data + 20));
|
|
|
|
GST_LOG ("preroll: %d", RMDEMUX_GUINT32_GET (data + 24));
|
|
|
|
GST_LOG ("duration: %d", RMDEMUX_GUINT32_GET (data + 28));
|
2003-06-22 03:59:01 +00:00
|
|
|
|
|
|
|
offset = 32;
|
2004-03-14 22:34:30 +00:00
|
|
|
stream_type = re_get_pascal_string (data + offset);
|
|
|
|
offset += re_dump_pascal_string (data + offset);
|
|
|
|
offset += re_dump_pascal_string (data + offset);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("length: 0x%08x", RMDEMUX_GUINT32_GET (data + offset));
|
2003-06-22 03:59:01 +00:00
|
|
|
offset += 4;
|
2004-10-03 01:37:11 +00:00
|
|
|
|
|
|
|
if (strstr (stream_type, "Video Stream")) {
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("unknown: 0x%08x", RMDEMUX_GUINT32_GET (data + offset + 0));
|
|
|
|
GST_LOG ("unknown: 0x%08x", RMDEMUX_GUINT32_GET (data + offset + 4));
|
2004-03-14 22:34:30 +00:00
|
|
|
fourcc = RMDEMUX_FOURCC_GET (data + offset + 8);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("fourcc: " GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
|
|
|
|
GST_LOG ("width: %d", RMDEMUX_GUINT16_GET (data + offset + 12));
|
|
|
|
GST_LOG ("height: %d", RMDEMUX_GUINT16_GET (data + offset + 14));
|
|
|
|
GST_LOG ("rate: %d", RMDEMUX_GUINT16_GET (data + offset + 16));
|
2004-10-04 16:10:41 +00:00
|
|
|
GST_LOG ("subid: 0x%08x", RMDEMUX_GUINT32_GET (data + offset + 30));
|
2003-06-22 03:59:01 +00:00
|
|
|
offset += 18;
|
2004-10-03 01:37:11 +00:00
|
|
|
} else if (strstr (stream_type, "Audio Stream")) {
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("unknown: 0x%08x", RMDEMUX_GUINT32_GET (data + offset + 0));
|
|
|
|
GST_LOG ("unknown: 0x%08x", RMDEMUX_GUINT32_GET (data + offset + 4));
|
2004-03-14 22:34:30 +00:00
|
|
|
fourcc = RMDEMUX_FOURCC_GET (data + offset + 8);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("fourcc: " GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
|
2004-03-14 22:34:30 +00:00
|
|
|
re_hexdump_bytes (data + offset + 12, 14, offset + 12);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("packet size 1: %d", RMDEMUX_GUINT16_GET (data + offset + 26));
|
2004-03-14 22:34:30 +00:00
|
|
|
re_hexdump_bytes (data + offset + 28, 14, offset + 28);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("packet size 2: %d", RMDEMUX_GUINT16_GET (data + offset + 42));
|
|
|
|
GST_LOG ("unknown: 0x%08x", RMDEMUX_GUINT32_GET (data + offset + 44));
|
|
|
|
GST_LOG ("rate1: %d", RMDEMUX_GUINT32_GET (data + offset + 48));
|
|
|
|
GST_LOG ("rate2: %d", RMDEMUX_GUINT32_GET (data + offset + 52));
|
2003-06-22 03:59:01 +00:00
|
|
|
offset += 56;
|
2004-03-14 22:34:30 +00:00
|
|
|
} else if (strcmp (stream_type, "") == 0) {
|
|
|
|
|
2004-10-03 01:37:11 +00:00
|
|
|
int element_nb;
|
|
|
|
|
|
|
|
/* Length of this section */
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("length2: 0x%08x", RMDEMUX_GUINT32_GET (data + offset));
|
2003-06-22 03:59:01 +00:00
|
|
|
offset += 4;
|
2004-10-03 01:37:11 +00:00
|
|
|
|
|
|
|
/* Unknown : 00 00 00 00 */
|
|
|
|
re_hexdump_bytes (data + offset, 4, offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/* Number of variables that would follow (loop iterations) */
|
|
|
|
element_nb = RMDEMUX_GUINT32_GET (data + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
while (element_nb) {
|
|
|
|
/* Category Id : 00 00 00 XX 00 00 */
|
2004-03-14 22:34:30 +00:00
|
|
|
re_hexdump_bytes (data + offset, 6, offset);
|
2003-06-22 03:59:01 +00:00
|
|
|
offset += 6;
|
2004-10-03 01:37:11 +00:00
|
|
|
|
|
|
|
/* Variable Name */
|
2004-03-14 22:34:30 +00:00
|
|
|
offset += re_dump_pascal_string (data + offset);
|
2004-10-03 01:37:11 +00:00
|
|
|
|
|
|
|
/* Variable Value Type */
|
|
|
|
/* 00 00 00 00 00 => integer/boolean, preceded by length */
|
|
|
|
/* 00 00 00 02 00 => pascal string, preceded by length, no trailing \0 */
|
2004-03-14 22:34:30 +00:00
|
|
|
re_hexdump_bytes (data + offset, 5, offset);
|
2003-06-22 03:59:01 +00:00
|
|
|
offset += 5;
|
2004-10-03 01:37:11 +00:00
|
|
|
|
|
|
|
/* Variable Value */
|
2004-03-14 22:34:30 +00:00
|
|
|
offset += re_dump_pascal_string (data + offset);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-10-03 01:37:11 +00:00
|
|
|
element_nb--;
|
|
|
|
}
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
re_hexdump_bytes (data + offset, length - offset, offset);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_parse_indx (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
int offset;
|
|
|
|
int n;
|
|
|
|
int i;
|
|
|
|
int id;
|
|
|
|
GstRMDemuxIndex *index;
|
|
|
|
GstRMDemuxStream *stream;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
n = RMDEMUX_GUINT16_GET (data + 4);
|
|
|
|
id = RMDEMUX_GUINT16_GET (data + 6);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
stream = gst_rmdemux_get_stream_by_id (rmdemux, id);
|
|
|
|
g_return_if_fail (stream != NULL);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
index = g_malloc (sizeof (GstRMDemuxIndex) * n);
|
2003-06-22 03:59:01 +00:00
|
|
|
stream->index = index;
|
|
|
|
stream->index_length = n;
|
|
|
|
|
|
|
|
offset = 12;
|
2004-03-14 22:34:30 +00:00
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
index[i].unknown = RMDEMUX_GUINT16_GET (data + offset + 0);
|
|
|
|
index[i].offset = RMDEMUX_GUINT32_GET (data + offset + 2);
|
|
|
|
index[i].timestamp = RMDEMUX_GUINT32_GET (data + offset + 6);
|
|
|
|
index[i].frame = RMDEMUX_GUINT32_GET (data + offset + 10);
|
2003-06-22 03:59:01 +00:00
|
|
|
|
|
|
|
offset += 14;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_dump_indx (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
int offset = 0;
|
|
|
|
int n;
|
|
|
|
int i;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
re_hexdump_bytes (data + 0, 4, 0);
|
|
|
|
n = RMDEMUX_GUINT16_GET (data + 4);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("n_entries: %d, stream_id: %d, offset to next INDX: 0x%08x",
|
|
|
|
n, RMDEMUX_GUINT16_GET (data + 6), RMDEMUX_GUINT32_GET (data + 8));
|
2003-06-22 03:59:01 +00:00
|
|
|
offset = 12;
|
2004-03-14 22:34:30 +00:00
|
|
|
for (i = 0; i < n; i++) {
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_DEBUG
|
|
|
|
("unknown: 0x%04x, offset: 0x%08x, timestamp: %d, frame index: %d",
|
|
|
|
RMDEMUX_GUINT16_GET (data + offset + 0),
|
|
|
|
RMDEMUX_GUINT32_GET (data + offset + 2),
|
|
|
|
RMDEMUX_GUINT32_GET (data + offset + 6),
|
|
|
|
RMDEMUX_GUINT32_GET (data + offset + 10));
|
2003-06-22 03:59:01 +00:00
|
|
|
offset += 14;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_parse_data (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
2004-03-14 22:34:30 +00:00
|
|
|
rmdemux->n_chunks = RMDEMUX_GUINT32_GET (data + 2);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_dump_data (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
int offset = 0;
|
|
|
|
int n;
|
|
|
|
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("version: %d, n_chunks: %d, unknown: 0x%08x",
|
|
|
|
RMDEMUX_GUINT16_GET (data + 0), RMDEMUX_GUINT32_GET (data + offset + 2),
|
|
|
|
RMDEMUX_GUINT32_GET (data + offset + 6));
|
2003-06-24 08:05:12 +00:00
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
re_hexdump_bytes (data + offset, 10, offset);
|
2003-06-22 03:59:01 +00:00
|
|
|
offset += 10;
|
2004-03-14 22:34:30 +00:00
|
|
|
while (offset < length) {
|
|
|
|
n = RMDEMUX_GUINT32_GET (data + offset);
|
gst/realmedia/rmdemux.c: Use debug category, fix EOS handling. filesrc ! rmdemux now works.
Original commit message from CVS:
* gst/realmedia/rmdemux.c: (gst_rmdemux_class_init),
(gst_rmdemux_init), (gst_rmdemux_handle_sink_event),
(gst_rmdemux_loop), (gst_rmdemux_add_stream), (re_hexdump_bytes),
(re_dump_pascal_string), (gst_rmdemux_dump__rmf),
(gst_rmdemux_dump_prop), (gst_rmdemux_parse_mdpr),
(gst_rmdemux_dump_mdpr), (gst_rmdemux_dump_indx),
(gst_rmdemux_dump_data):
Use debug category, fix EOS handling. filesrc ! rmdemux now
works.
2004-10-04 14:43:23 +00:00
|
|
|
GST_LOG ("length: %d, unknown: 0x%08x, unknown: %08x",
|
|
|
|
n, RMDEMUX_GUINT32_GET (data + offset + 4),
|
|
|
|
RMDEMUX_GUINT32_GET (data + offset + 8));
|
2003-06-22 03:59:01 +00:00
|
|
|
offset += 12;
|
2004-03-14 22:34:30 +00:00
|
|
|
re_hexdump_bytes (data + offset, n - 12, offset);
|
|
|
|
offset += n - 12;
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
2004-03-14 22:34:30 +00:00
|
|
|
g_print ("\n");
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_parse_cont (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
2004-10-04 18:27:54 +00:00
|
|
|
int offset = 0;
|
2003-06-22 03:59:01 +00:00
|
|
|
|
2004-10-04 18:27:54 +00:00
|
|
|
GST_DEBUG ("File Content : (CONT)");
|
|
|
|
offset += re_dump_pascal_string (data + offset + 3);
|
2003-06-22 03:59:01 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void
|
|
|
|
gst_rmdemux_dump_cont (GstRMDemux * rmdemux, void *data, int length)
|
2003-06-22 03:59:01 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|