From f1d5413b0542d757d0ae8349e5955b85d9585e6c Mon Sep 17 00:00:00 2001 From: Jeremy Simon Date: Wed, 5 Nov 2003 23:19:38 +0000 Subject: [PATCH] Use caps properties to set additional data to ffmpeg context (for wma) Original commit message from CVS: Use caps properties to set additional data to ffmpeg context (for wma) --- ext/ffmpeg/gstffmpegcodecmap.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index a50710c..6a54f38 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c @@ -244,14 +244,22 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, case CODEC_ID_WMAV1: caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_wma1", "audio/x-wma", - "wmaversion", GST_PROPS_INT (1) + "wmaversion", GST_PROPS_INT (1), + "flags1", GST_PROPS_INT_RANGE (G_MININT, G_MAXINT), + "flags2", GST_PROPS_INT_RANGE (G_MININT, G_MAXINT), + "block_align", GST_PROPS_INT_RANGE (0, G_MAXINT), + "bitrate", GST_PROPS_INT_RANGE (0, G_MAXINT) ); break; case CODEC_ID_WMAV2: caps = GST_FF_AUD_CAPS_NEW ("ffmpeg_wma2", "audio/x-wma", - "wmaversion", GST_PROPS_INT (2) + "wmaversion", GST_PROPS_INT (2), + "flags1", GST_PROPS_INT_RANGE (G_MININT, G_MAXINT), + "flags2", GST_PROPS_INT_RANGE (G_MININT, G_MAXINT), + "block_align", GST_PROPS_INT_RANGE (0, G_MAXINT), + "bitrate", GST_PROPS_INT_RANGE (0, G_MAXINT) ); break; @@ -720,8 +728,29 @@ gst_ffmpeg_caps_to_smpfmt (GstCaps *caps, GST_PROPS_INT_TYPE)) { gst_caps_get_int (caps, "rate", &context->sample_rate); } + + if (gst_caps_has_property_typed (caps, "block_align", + GST_PROPS_INT_TYPE)) { + gst_caps_get_int (caps, "block_align", &context->block_align); + } + + if (gst_caps_has_property_typed (caps, "bitrate", + GST_PROPS_INT_TYPE)) { + gst_caps_get_int (caps, "bitrate", &context->bit_rate); + } + + if (gst_caps_has_property_typed (caps, "flags1", + GST_PROPS_INT_TYPE)) { + gst_caps_get_int (caps, "flags1", &context->wma_flags1); + } + + if (gst_caps_has_property_typed (caps, "flags2", + GST_PROPS_INT_TYPE)) { + gst_caps_get_int (caps, "flags2", &context->wma_flags2); + } } + /* Convert a GstCaps (video/raw) to a FFMPEG PixFmt * and other video properties in a AVCodecContext. * -- 2.7.4