Add zapISpeexDecoder control interface.

git-svn-id: svn://10.0.0.236/branches/ZAP_20050610_BRANCH@177941 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alex%croczilla.com
2005-08-17 10:37:03 +00:00
parent 9b8689ee18
commit 5663c76bee
5 changed files with 104 additions and 1 deletions

View File

@@ -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)

View File

@@ -56,6 +56,7 @@ XPIDLSRCS = zapIMediaGraph.idl \
zapIAudioDevice.idl \
zapIPortaudioDevice.idl \
zapISpeexEncoder.idl \
zapISpeexDecoder.idl \
zapIRTPFrame.idl \
zapIUDPSocket.idl \
zapIUDPSocketPair.idl \

View File

@@ -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 <alex@croczilla.com> (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;
};

View File

@@ -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)
{

View File

@@ -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,