ext/ffmpeg/gstffmpegcodecmap.c: block_align and bitrate caps property were lost for wma use codec_data instead of fla...

Original commit message from CVS:
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_with_codecid):
block_align and bitrate caps property were lost for wma
use codec_data instead of flag1 and flag2
This commit is contained in:
Jeremy Simon 2004-05-11 16:07:14 +00:00
parent c0e70cc4bc
commit f9536f9af1
2 changed files with 51 additions and 33 deletions

View file

@ -1,3 +1,10 @@
2004-05-11 Jeremy Simon <jesimon@libertysurf.fr>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_with_codecid):
block_align and bitrate caps property were lost for wma
use codec_data instead of flag1 and flag2
2004-05-11 Benjamin Otte <in7y118@public.uni-hamburg.de> 2004-05-11 Benjamin Otte <in7y118@public.uni-hamburg.de>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps): * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_formatid_to_caps):

View file

@ -295,7 +295,18 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
do { do {
gint version = (codec_id == CODEC_ID_WMV1) ? 1 : 2; gint version = (codec_id == CODEC_ID_WMV1) ? 1 : 2;
/* encode-FIXME: bitrate */ if (context)
{
GstBuffer *buffer;
buffer = gst_buffer_new_and_alloc (context->extradata_size);
memcpy (GST_BUFFER_DATA (buffer), context->extradata, context->extradata_size);
caps = GST_FF_VID_CAPS_NEW ("video/x-wmv",
"wmvversion", G_TYPE_INT, version,
"codec_data", GST_TYPE_BUFFER, buffer, NULL);
}
else
caps = GST_FF_VID_CAPS_NEW ("video/x-wmv", caps = GST_FF_VID_CAPS_NEW ("video/x-wmv",
"wmvversion", G_TYPE_INT, version, NULL); "wmvversion", G_TYPE_INT, version, NULL);
} while (0); } while (0);
@ -332,12 +343,26 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
do { do {
gint version = (codec_id == CODEC_ID_WMAV1) ? 1 : 2; gint version = (codec_id == CODEC_ID_WMAV1) ? 1 : 2;
if (context)
{
GstBuffer *buffer;
buffer = gst_buffer_new_and_alloc (context->extradata_size);
memcpy (GST_BUFFER_DATA (buffer), context->extradata, context->extradata_size);
caps = GST_FF_AUD_CAPS_NEW ("audio/x-wma",
"wmaversion", G_TYPE_INT, version,
"codec_data", GST_TYPE_BUFFER, buffer,
"block_align", G_TYPE_INT, context->block_align,
"bitrate", G_TYPE_INT, context->bit_rate, NULL);
}
else
{
caps = GST_FF_AUD_CAPS_NEW ("audio/x-wma", caps = GST_FF_AUD_CAPS_NEW ("audio/x-wma",
"wmaversion", G_TYPE_INT, version, "wmaversion", G_TYPE_INT, version,
"flags1", GST_TYPE_INT_RANGE, G_MININT, G_MAXINT,
"flags2", GST_TYPE_INT_RANGE, G_MININT, G_MAXINT,
"block_align", GST_TYPE_INT_RANGE, 0, G_MAXINT, "block_align", GST_TYPE_INT_RANGE, 0, G_MAXINT,
"bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL); "bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL);
}
} while (0); } while (0);
break; break;
@ -1121,31 +1146,17 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
case CODEC_ID_WMAV1: case CODEC_ID_WMAV1:
case CODEC_ID_WMAV2: case CODEC_ID_WMAV2:
do { do {
gint flags1, flags2; const GValue *value;
const GstBuffer *buf;
if (gst_structure_get_int (str, "flags1", &flags1) || if ((value = gst_structure_get_value (str, "codec_data"))) {
gst_structure_get_int (str, "flags2", &flags2)) { if (GST_BUFFER_SIZE (buf) != 0)
/* {
* Rebuild context data from flags1 & flags2 buf = g_value_get_boxed (value);
* see wmadec in ffmpeg/libavcodec/wmadec.c context->extradata = av_mallocz (GST_BUFFER_SIZE (buf));
*/ memcpy (context->extradata, GST_BUFFER_DATA (buf),
switch (codec_id) { GST_BUFFER_SIZE (buf));
case CODEC_ID_WMAV1: context->extradata_size = GST_BUFFER_SIZE (buf);
context->extradata = (guint8 *) av_mallocz (4);
((guint8 *) context->extradata)[0] = flags1;
((guint8 *) context->extradata)[2] = flags2;
context->extradata_size = 4;
break;
case CODEC_ID_WMAV2:
context->extradata = (guint8 *) av_mallocz (6);
((guint8 *) context->extradata)[0] = flags1;
((guint8 *) context->extradata)[1] = flags1 >> 8;
((guint8 *) context->extradata)[2] = flags1 >> 16;
((guint8 *) context->extradata)[3] = flags1 >> 24;
((guint8 *) context->extradata)[4] = flags2;
((guint8 *) context->extradata)[5] = flags2 >> 8;
context->extradata_size = 6;
break;
} }
} }
} while (0); } while (0);