From 5663c76bee33ab32d4f06c7091013b95eb1967a1 Mon Sep 17 00:00:00 2001 From: "alex%croczilla.com" Date: Wed, 17 Aug 2005 10:37:03 +0000 Subject: [PATCH] Add zapISpeexDecoder control interface. git-svn-id: svn://10.0.0.236/branches/ZAP_20050610_BRANCH@177941 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/zap/zmk/readme.txt | 2 + mozilla/zap/zmk/src/Makefile.in | 1 + mozilla/zap/zmk/src/zapISpeexDecoder.idl | 51 ++++++++++++++++++++++++ mozilla/zap/zmk/src/zapSpeexDecoder.cpp | 44 ++++++++++++++++++++ mozilla/zap/zmk/src/zapSpeexDecoder.h | 7 +++- 5 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 mozilla/zap/zmk/src/zapISpeexDecoder.idl diff --git a/mozilla/zap/zmk/readme.txt b/mozilla/zap/zmk/readme.txt index 3261e21c71f..f1da547733c 100644 --- a/mozilla/zap/zmk/readme.txt +++ b/mozilla/zap/zmk/readme.txt @@ -172,6 +172,8 @@ audio/speex stream with Filter for decoding speex streams as encoded using speex-encoder +Control interfaces: zapISpeexDecoder + Node parameters: -double "sample_rate" : 8000|16000|32000 (default:8000) diff --git a/mozilla/zap/zmk/src/Makefile.in b/mozilla/zap/zmk/src/Makefile.in index c299d781eac..9044e4d1e1e 100644 --- a/mozilla/zap/zmk/src/Makefile.in +++ b/mozilla/zap/zmk/src/Makefile.in @@ -56,6 +56,7 @@ XPIDLSRCS = zapIMediaGraph.idl \ zapIAudioDevice.idl \ zapIPortaudioDevice.idl \ zapISpeexEncoder.idl \ + zapISpeexDecoder.idl \ zapIRTPFrame.idl \ zapIUDPSocket.idl \ zapIUDPSocketPair.idl \ diff --git a/mozilla/zap/zmk/src/zapISpeexDecoder.idl b/mozilla/zap/zmk/src/zapISpeexDecoder.idl new file mode 100644 index 00000000000..b4a9908e07e --- /dev/null +++ b/mozilla/zap/zmk/src/zapISpeexDecoder.idl @@ -0,0 +1,51 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Mozilla SIP client project. + * + * The Initial Developer of the Original Code is 8x8 Inc. + * Portions created by the Initial Developer are Copyright (C) 2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alex Fritze (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +[scriptable, uuid(b92f1c21-7f63-422f-985b-08b9ceb56950)] +interface zapISpeexDecoder : nsISupports +{ + /** + * Toggles perceptual enhancer + */ + attribute boolean penhance; + + /** + * Maximum bitrate (bps). + */ + readonly attribute unsigned long maxBitrate; +}; diff --git a/mozilla/zap/zmk/src/zapSpeexDecoder.cpp b/mozilla/zap/zmk/src/zapSpeexDecoder.cpp index c9e6d117e3b..ba0a73995fb 100644 --- a/mozilla/zap/zmk/src/zapSpeexDecoder.cpp +++ b/mozilla/zap/zmk/src/zapSpeexDecoder.cpp @@ -63,6 +63,50 @@ zapSpeexDecoder::~zapSpeexDecoder() #endif } +//---------------------------------------------------------------------- +// nsISupports methods: + +NS_IMPL_ADDREF_INHERITED(zapSpeexDecoder, zapFilterNode) +NS_IMPL_RELEASE_INHERITED(zapSpeexDecoder, zapFilterNode) + +NS_INTERFACE_MAP_BEGIN(zapSpeexDecoder) + NS_INTERFACE_MAP_ENTRY(zapISpeexDecoder) +NS_INTERFACE_MAP_END_INHERITING(zapFilterNode) + +//---------------------------------------------------------------------- +// zapISpeexDecoder methods: + + /* attribute boolean penhance; */ +NS_IMETHODIMP +zapSpeexDecoder::GetPenhance(PRBool *aPenhance) +{ + int bPenh; + speex_decoder_ctl(mDecoderState, SPEEX_GET_ENH, &bPenh); + *aPenhance = (bPenh==1); + return NS_OK; +} +NS_IMETHODIMP +zapSpeexDecoder::SetPenhance(PRBool aPenhance) +{ + int bPenh = aPenhance; + speex_decoder_ctl(mDecoderState, SPEEX_SET_ENH, &bPenh); + return NS_OK; +} + +/* readonly attribute unsigned long maxBitrate; */ +NS_IMETHODIMP +zapSpeexDecoder::GetMaxBitrate(PRUint32 *aMaxBitrate) +{ + int br; + speex_decoder_ctl(mDecoderState, SPEEX_GET_BITRATE, &br); + *aMaxBitrate = (PRUint32)br; + return NS_OK; +} + + +//---------------------------------------------------------------------- +// Implementation helpers: + NS_IMETHODIMP zapSpeexDecoder::AddedToGraph(zapIMediaGraph *graph, const nsACString & id, nsIPropertyBag2 *node_pars) { diff --git a/mozilla/zap/zmk/src/zapSpeexDecoder.h b/mozilla/zap/zmk/src/zapSpeexDecoder.h index 6e123d9979b..1dac9cd81c0 100644 --- a/mozilla/zap/zmk/src/zapSpeexDecoder.h +++ b/mozilla/zap/zmk/src/zapSpeexDecoder.h @@ -40,6 +40,7 @@ #include "zapFilterNode.h" #include "speex/speex.h" #include "nsIWritablePropertyBag2.h" +#include "zapISpeexDecoder.h" //////////////////////////////////////////////////////////////////////// // zapSpeexDecoder @@ -50,11 +51,15 @@ #define ZAP_SPEEXDECODER_CONTRACTID ZAP_MEDIANODE_CONTRACTID_PREFIX "speex-decoder" -class zapSpeexDecoder : public zapFilterNode +class zapSpeexDecoder : public zapFilterNode, + public zapISpeexDecoder { public: zapSpeexDecoder(); ~zapSpeexDecoder(); + + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_ZAPISPEEXDECODER NS_IMETHOD AddedToGraph(zapIMediaGraph *graph, const nsACString & id,