gst/: Add MS RLE support. I added some functions to read out strf chunks into strf chunks and the data behind it. Thi...

Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* gst-libs/gst/riff/riff-media.c:
(gst_riff_create_video_caps_with_data),
(gst_riff_create_video_caps), (gst_riff_create_audio_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst-libs/gst/riff/riff-read.c:
(gst_riff_read_strf_vids_with_data), (gst_riff_read_strf_vids):
* gst-libs/gst/riff/riff-read.h:
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
Add MS RLE support. I added some functions to read out strf chunks
into strf chunks and the data behind it. This is usually color
palettes (as in RLE, but also in 8-bit RGB). Also use those during
caps creation. Lastly, add ADPCM (similar to wavparse - which
should eventually be rifflib based).
* gst/matroska/matroska-demux.c: (gst_matroska_demux_class_init),
(gst_matroska_demux_init), (gst_matroska_demux_reset):
* gst/matroska/matroska-demux.h:
Remove placeholders for some prehistoric tagging system. Didn't add
support for any tag system really anyway.
* gst/qtdemux/qtdemux.c:
Add support for audio/x-m4a (MPEG-4) through spider.
* gst/wavparse/gstwavparse.c: (gst_wavparse_parse_fmt),
(gst_wavparse_loop):
ADPCM support (#135862). Increase max. buffer size because we
cannot split buffers for ADPCM (screws references) and I've seen
files with 2048 byte chunks. 4096 seems safe for now.
This commit is contained in:
Ronald S. Bultje 2004-04-16 01:20:44 +00:00
parent 9369abcfa0
commit 26fe995a13
6 changed files with 64 additions and 51 deletions

View file

@ -1,3 +1,35 @@
2004-04-15 Ronald Bultje <rbultje@ronald.bitfreak.net>
reviewed by: <delete if not using a buddy>
* gst-libs/gst/riff/riff-media.c:
(gst_riff_create_video_caps_with_data),
(gst_riff_create_video_caps), (gst_riff_create_audio_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst-libs/gst/riff/riff-read.c:
(gst_riff_read_strf_vids_with_data), (gst_riff_read_strf_vids):
* gst-libs/gst/riff/riff-read.h:
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
Add MS RLE support. I added some functions to read out strf chunks
into strf chunks and the data behind it. This is usually color
palettes (as in RLE, but also in 8-bit RGB). Also use those during
caps creation. Lastly, add ADPCM (similar to wavparse - which
should eventually be rifflib based).
* gst/matroska/matroska-demux.c: (gst_matroska_demux_class_init),
(gst_matroska_demux_init), (gst_matroska_demux_reset):
* gst/matroska/matroska-demux.h:
Remove placeholders for some prehistoric tagging system. Didn't add
support for any tag system really anyway.
* gst/qtdemux/qtdemux.c:
Add support for audio/x-m4a (MPEG-4) through spider.
* gst/wavparse/gstwavparse.c: (gst_wavparse_parse_fmt),
(gst_wavparse_loop):
ADPCM support (#135862). Increase max. buffer size because we
cannot split buffers for ADPCM (screws references) and I've seen
files with 2048 byte chunks. 4096 seems safe for now.
2004-04-15 Thomas Vander Stichele <thomas at apestaart dot org>
* configure.ac: bump nano to 1

View file

@ -742,6 +742,7 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
GstRiffRead *riff = GST_RIFF_READ (avi);
guint32 tag;
gst_riff_strh *strh;
GstBuffer *extradata = NULL, *initdata = NULL;
gchar *name = NULL, *padname = NULL;
GstCaps *caps = NULL;
GstPadTemplate *templ = NULL;
@ -775,7 +776,7 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
}
switch (strh->type) {
case GST_RIFF_FCC_vids:
if (!gst_riff_read_strf_vids (riff, &strf.vids))
if (!gst_riff_read_strf_vids_with_data (riff, &strf.vids, &extradata))
return FALSE;
break;
case GST_RIFF_FCC_auds:
@ -802,6 +803,13 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
}
switch (tag) {
case GST_RIFF_TAG_strd:
if (initdata)
gst_buffer_unref (initdata);
if (!gst_riff_read_data (riff, &tag, &initdata))
return FALSE;
break;
case GST_RIFF_TAG_strn:
if (name)
g_free (name);
@ -814,7 +822,6 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
GST_FOURCC_ARGS (tag));
/* fall-through */
case GST_RIFF_TAG_strd: /* what is this? */
case GST_RIFF_TAG_JUNK:
if (!gst_riff_read_skip (riff))
return FALSE;
@ -836,8 +843,8 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
padname = g_strdup_printf ("video_%02d", avi->num_v_streams);
templ = gst_element_class_get_pad_template (klass, "video_%02d");
caps = gst_riff_create_video_caps (strf.vids->compression, strh,
strf.vids, &codec_name);
caps = gst_riff_create_video_caps_with_data (strf.vids->compression,
strh, strf.vids, extradata, initdata, &codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
codec_name, NULL);
gst_element_found_tags (GST_ELEMENT (avi), list);
@ -920,6 +927,12 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
/* auto-negotiates */
gst_element_add_pad (GST_ELEMENT (avi), pad);
/* clean something up */
if (initdata)
gst_buffer_unref (initdata);
if (extradata)
gst_buffer_unref (extradata);
return TRUE;
skip_stream:

View file

@ -79,10 +79,6 @@ gst_matroska_demux_change_state (GstElement * element);
static void gst_matroska_demux_set_clock (GstElement * element,
GstClock * clock);
/* gobject bla bla */
static void gst_matroska_demux_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
/* caps functions */
static GstCaps *gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext
* videocontext,
@ -154,23 +150,12 @@ gst_matroska_demux_base_init (GstMatroskaDemuxClass * klass)
static void
gst_matroska_demux_class_init (GstMatroskaDemuxClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
g_object_class_install_property (gobject_class, ARG_METADATA,
g_param_spec_boxed ("metadata", "Metadata", "Metadata",
GST_TYPE_STRUCTURE, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_STREAMINFO,
g_param_spec_boxed ("streaminfo", "Streaminfo", "Streaminfo",
GST_TYPE_STRUCTURE, G_PARAM_READABLE));
parent_class = g_type_class_ref (GST_TYPE_EBML_READ);
gobject_class->get_property = gst_matroska_demux_get_property;
gstelement_class->change_state = gst_matroska_demux_change_state;
gstelement_class->send_event = gst_matroska_demux_send_event;
gstelement_class->set_clock = gst_matroska_demux_set_clock;
@ -196,7 +181,6 @@ gst_matroska_demux_init (GstMatroskaDemux * demux)
for (i = 0; i < GST_MATROSKA_DEMUX_MAX_STREAMS; i++) {
demux->src[i] = NULL;
}
demux->streaminfo = demux->metadata = NULL;
demux->writing_app = demux->muxing_app = NULL;
demux->index = NULL;
@ -234,10 +218,6 @@ gst_matroska_demux_reset (GstElement * element)
demux->num_v_streams = 0;
/* reset media info */
gst_caps_replace (&demux->metadata, NULL);
gst_caps_replace (&demux->streaminfo, NULL);
g_free (demux->writing_app);
demux->writing_app = NULL;
g_free (demux->muxing_app);
@ -2514,28 +2494,6 @@ gst_matroska_demux_change_state (GstElement * element)
return GST_STATE_SUCCESS;
}
static void
gst_matroska_demux_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstMatroskaDemux *demux;
g_return_if_fail (GST_IS_MATROSKA_DEMUX (object));
demux = GST_MATROSKA_DEMUX (object);
switch (prop_id) {
case ARG_STREAMINFO:
g_value_set_boxed (value, demux->streaminfo);
break;
case ARG_METADATA:
g_value_set_boxed (value, demux->metadata);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
gboolean
gst_matroska_demux_plugin_init (GstPlugin * plugin)
{

View file

@ -66,8 +66,6 @@ typedef struct _GstMatroskaDemux {
GstClock *clock;
/* metadata */
GstCaps *metadata;
GstCaps *streaminfo;
gchar *muxing_app, *writing_app;
gint64 created;

View file

@ -123,10 +123,10 @@ enum
};
static GstStaticPadTemplate gst_qtdemux_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_SOMETIMES,
GST_STATIC_CAPS ("video/quicktime")
GST_STATIC_CAPS ("video/quicktime; audio/x-m4a")
);
static GstStaticPadTemplate gst_qtdemux_videosrc_template =

View file

@ -80,6 +80,10 @@ static GstStaticPadTemplate src_template_factory =
"rate = (int) [ 8000, 48000 ], "
"channels = (int) [ 1, 2 ]; "
"audio/x-mulaw, "
"rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ];"
"audio/x-adpcm, "
"layout = (string) microsoft, "
"block_align = (int) [ 1, 8192 ], "
"rate = (int) [ 8000, 48000 ], " "channels = (int) [ 1, 2 ]")
);
@ -621,6 +625,14 @@ gst_wavparse_parse_fmt (GstWavParse * wavparse, guint size)
"channels", G_TYPE_INT, wavparse->channels, NULL);
break;
case GST_RIFF_WAVE_FORMAT_ADPCM:
caps = gst_caps_new_simple ("audio/x-adpcm",
"layout", G_TYPE_STRING, "microsoft",
"block_align", G_TYPE_INT, wavparse->bps,
"rate", G_TYPE_INT, wavparse->rate,
"channels", G_TYPE_INT, wavparse->channels, NULL);
break;
case GST_RIFF_WAVE_FORMAT_MPEGL12:
case GST_RIFF_WAVE_FORMAT_MPEGL3:{
int layer = (wavparse->format == GST_RIFF_WAVE_FORMAT_MPEGL12) ? 2 : 3;
@ -716,7 +728,7 @@ gst_wavparse_loop (GstElement * element)
Does anyone care about streaming wavs?
FIXME: Should we have a decent buffer size? */
#define MAX_BUFFER_SIZE 1024
#define MAX_BUFFER_SIZE 4096
if (wavparse->dataleft > 0) {
desired = MIN (wavparse->dataleft, MAX_BUFFER_SIZE);