mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
gst/: Set codec_data on caps for avidemuxer.
Original commit message from CVS: * gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps_with_data), (gst_riff_create_audio_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_auds_with_data), (gst_riff_read_strf_auds): * gst-libs/gst/riff/riff-read.h: * gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query), (gst_avi_demux_add_stream): Set codec_data on caps for avidemuxer.
This commit is contained in:
parent
b84c3f900f
commit
1d15366460
5 changed files with 112 additions and 15 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2004-07-13 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst-libs/gst/riff/riff-media.c:
|
||||
(gst_riff_create_audio_caps_with_data),
|
||||
(gst_riff_create_audio_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_auds_with_data), (gst_riff_read_strf_auds):
|
||||
* gst-libs/gst/riff/riff-read.h:
|
||||
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
|
||||
(gst_avi_demux_add_stream):
|
||||
Set codec_data on caps for avidemuxer.
|
||||
|
||||
2004-07-12 David Schleef <ds@schleef.org>
|
||||
|
||||
* configure.ac: Fix test for Objective C
|
||||
|
|
|
@ -330,10 +330,11 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
|||
}
|
||||
|
||||
GstCaps *
|
||||
gst_riff_create_audio_caps (guint16 codec_id,
|
||||
gst_riff_strh * strh, gst_riff_strf_auds * strf, char **codec_name)
|
||||
gst_riff_create_audio_caps_with_data (guint16 codec_id,
|
||||
gst_riff_strh * strh, gst_riff_strf_auds * strf,
|
||||
GstBuffer * strf_data, GstBuffer * strd_data, char **codec_name)
|
||||
{
|
||||
gboolean block_align = FALSE;
|
||||
gboolean block_align = FALSE, rate_chan = TRUE;
|
||||
GstCaps *caps = NULL;
|
||||
gint rate_min = 8000, rate_max = 96000;
|
||||
gint channels_max = 2;
|
||||
|
@ -426,31 +427,70 @@ gst_riff_create_audio_caps (guint16 codec_id,
|
|||
if (codec_name)
|
||||
*codec_name = g_strdup ("AC3");
|
||||
break;
|
||||
case GST_RIFF_WAVE_FORMAT_WMAV1:
|
||||
case GST_RIFF_WAVE_FORMAT_WMAV2:
|
||||
{
|
||||
gint version = codec_id == GST_RIFF_WAVE_FORMAT_WMAV1 ? 1 : 2;
|
||||
|
||||
block_align = TRUE;
|
||||
|
||||
caps = gst_caps_new_simple ("audio/x-wma",
|
||||
"wmaversion", G_TYPE_INT, version, NULL);
|
||||
|
||||
if (codec_name)
|
||||
*codec_name = g_strdup_printf ("WMA Version %d", version);
|
||||
|
||||
if (strf != NULL) {
|
||||
gst_caps_set_simple (caps,
|
||||
"bitrate", G_TYPE_INT, strf->av_bps * 8, NULL);
|
||||
} else {
|
||||
gst_caps_set_simple (caps,
|
||||
"bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL);
|
||||
}
|
||||
if (strf_data) {
|
||||
gst_caps_set_simple (caps,
|
||||
"codec_data", GST_TYPE_BUFFER, strf_data, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
GST_WARNING ("Unknown audio tag 0x%04x", codec_id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strf != NULL) {
|
||||
gst_caps_set_simple (caps,
|
||||
"rate", G_TYPE_INT, strf->rate,
|
||||
"channels", G_TYPE_INT, strf->channels, NULL);
|
||||
if (block_align)
|
||||
if (rate_chan) {
|
||||
gst_caps_set_simple (caps,
|
||||
"rate", G_TYPE_INT, strf->rate,
|
||||
"channels", G_TYPE_INT, strf->channels, NULL);
|
||||
}
|
||||
if (block_align) {
|
||||
gst_caps_set_simple (caps,
|
||||
"block_align", G_TYPE_INT, strf->blockalign, NULL);
|
||||
}
|
||||
} else {
|
||||
gst_caps_set_simple (caps,
|
||||
"rate", GST_TYPE_INT_RANGE, rate_min, rate_max,
|
||||
"channels", GST_TYPE_INT_RANGE, 1, channels_max, NULL);
|
||||
if (block_align)
|
||||
if (rate_chan) {
|
||||
gst_caps_set_simple (caps,
|
||||
"rate", GST_TYPE_INT_RANGE, rate_min, rate_max,
|
||||
"channels", GST_TYPE_INT_RANGE, 1, channels_max, NULL);
|
||||
}
|
||||
if (block_align) {
|
||||
gst_caps_set_simple (caps,
|
||||
"block_align", GST_TYPE_INT_RANGE, 1, 8192, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
GstCaps *
|
||||
gst_riff_create_audio_caps (guint16 codec_id,
|
||||
gst_riff_strh * strh, gst_riff_strf_auds * strf, char **codec_name)
|
||||
{
|
||||
return gst_riff_create_audio_caps_with_data (codec_id,
|
||||
strh, strf, NULL, NULL, codec_name);
|
||||
}
|
||||
|
||||
GstCaps *
|
||||
gst_riff_create_iavs_caps (guint32 codec_fcc,
|
||||
gst_riff_strh * strh, gst_riff_strf_iavs * strf, char **codec_name)
|
||||
|
@ -533,6 +573,8 @@ gst_riff_create_audio_template_caps (void)
|
|||
GST_RIFF_WAVE_FORMAT_MULAW,
|
||||
GST_RIFF_WAVE_FORMAT_ADPCM,
|
||||
GST_RIFF_WAVE_FORMAT_DVI_ADPCM,
|
||||
GST_RIFF_WAVE_FORMAT_WMAV1,
|
||||
GST_RIFF_WAVE_FORMAT_WMAV2,
|
||||
/* FILL ME */
|
||||
0
|
||||
};
|
||||
|
|
|
@ -57,6 +57,13 @@ gst_riff_create_video_caps_with_data (guint32 codec_fcc,
|
|||
GstBuffer * strd_data,
|
||||
char ** codec_name);
|
||||
|
||||
GstCaps *
|
||||
gst_riff_create_audio_caps_with_data (guint16 codec_id,
|
||||
gst_riff_strh * strh,
|
||||
gst_riff_strf_auds * strf,
|
||||
GstBuffer * strf_data,
|
||||
GstBuffer * strd_data,
|
||||
char ** codec_name);
|
||||
/*
|
||||
* Create template caps (includes all known types).
|
||||
*/
|
||||
|
|
|
@ -551,8 +551,8 @@ gst_riff_read_strf_vids_with_data (GstRiffRead * riff,
|
|||
strf->size, GST_BUFFER_SIZE (buf));
|
||||
strf->size = GST_BUFFER_SIZE (buf);
|
||||
} else if (strf->size < GST_BUFFER_SIZE (buf)) {
|
||||
*extradata = gst_buffer_create_sub (buf, strf->size,
|
||||
GST_BUFFER_SIZE (buf) - strf->size);
|
||||
*extradata = gst_buffer_create_sub (buf, strf->size + 2,
|
||||
GST_BUFFER_SIZE (buf) - strf->size - 2);
|
||||
}
|
||||
|
||||
/* debug */
|
||||
|
@ -582,7 +582,6 @@ gst_riff_read_strf_vids_with_data (GstRiffRead * riff,
|
|||
/*
|
||||
* Obsolete, use gst_riff_read_strf_vids_with_data ().
|
||||
*/
|
||||
|
||||
gboolean
|
||||
gst_riff_read_strf_vids (GstRiffRead * riff, gst_riff_strf_vids ** header)
|
||||
{
|
||||
|
@ -597,7 +596,8 @@ gst_riff_read_strf_vids (GstRiffRead * riff, gst_riff_strf_vids ** header)
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header)
|
||||
gst_riff_read_strf_auds_with_data (GstRiffRead * riff,
|
||||
gst_riff_strf_auds ** header, GstBuffer ** extradata)
|
||||
{
|
||||
guint32 tag;
|
||||
GstBuffer *buf;
|
||||
|
@ -629,6 +629,17 @@ gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header)
|
|||
strf->size = GUINT16_FROM_LE (strf->size);
|
||||
#endif
|
||||
|
||||
/* size checking */
|
||||
*extradata = NULL;
|
||||
if (strf->size > GST_BUFFER_SIZE (buf)) {
|
||||
g_warning ("strf_auds header gave %d bytes data, only %d available",
|
||||
strf->size, GST_BUFFER_SIZE (buf));
|
||||
strf->size = GST_BUFFER_SIZE (buf);
|
||||
} else if (strf->size < GST_BUFFER_SIZE (buf)) {
|
||||
*extradata = gst_buffer_create_sub (buf, strf->size + 2,
|
||||
GST_BUFFER_SIZE (buf) - strf->size - 2);
|
||||
}
|
||||
|
||||
/* debug */
|
||||
GST_INFO ("strf tag found in context auds:");
|
||||
GST_INFO (" format %d", strf->format);
|
||||
|
@ -637,6 +648,8 @@ gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header)
|
|||
GST_INFO (" av_bps %d", strf->av_bps);
|
||||
GST_INFO (" blockalign %d", strf->blockalign);
|
||||
GST_INFO (" size %d", strf->size); /* wordsize, not extrasize! */
|
||||
if (*extradata)
|
||||
GST_INFO (" %d bytes extra_data", GST_BUFFER_SIZE (*extradata));
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
|
@ -645,6 +658,22 @@ gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Obsolete, use gst_riff_read_strf_auds_with_data ().
|
||||
*/
|
||||
gboolean
|
||||
gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header)
|
||||
{
|
||||
GstBuffer *data = NULL;
|
||||
gboolean ret;
|
||||
|
||||
ret = gst_riff_read_strf_auds_with_data (riff, header, &data);
|
||||
if (data)
|
||||
gst_buffer_unref (data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_riff_read_strf_iavs (GstRiffRead * riff, gst_riff_strf_iavs ** header)
|
||||
{
|
||||
|
|
|
@ -98,6 +98,10 @@ gboolean gst_riff_read_strf_vids_with_data
|
|||
GstBuffer **extradata);
|
||||
gboolean gst_riff_read_strf_auds (GstRiffRead *riff,
|
||||
gst_riff_strf_auds **header);
|
||||
gboolean gst_riff_read_strf_auds_with_data
|
||||
(GstRiffRead *riff,
|
||||
gst_riff_strf_auds **header,
|
||||
GstBuffer **extradata);
|
||||
gboolean gst_riff_read_strf_iavs (GstRiffRead *riff,
|
||||
gst_riff_strf_iavs **header);
|
||||
gboolean gst_riff_read_info (GstRiffRead *riff);
|
||||
|
|
Loading…
Reference in a new issue