Add zapIPacketPump interface with functionality for manually pumping packets.
git-svn-id: svn://10.0.0.236/branches/ZAP_20050610_BRANCH@221099 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -822,16 +822,19 @@ audio/tone frames
|
||||
--------
|
||||
|
||||
General purpose packet pump. Pumps an unaltered "input" packet to the
|
||||
output whenever a "clock" frame is received. The timestamp of the
|
||||
frame is NOT modified. Frames will only be pumped if an output sink is
|
||||
connected.
|
||||
output whenever a "clock" frame is received or when prodded through
|
||||
zapIPacketPump. The timestamp of the frame is NOT modified. Frames
|
||||
will only be pumped if an output sink is connected.
|
||||
|
||||
Sinks: 2
|
||||
|
||||
ACString "name" == "input" : pumped input frames; any stream type (active)
|
||||
ACString "name" == "clock" : reference clock; any stream type (passive)
|
||||
|
||||
Sources: 1 (active)
|
||||
|
||||
Control interfaces: zapIPacketPump
|
||||
|
||||
Output stream:
|
||||
same as "input" stream
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@ XPIDLSRCS = \
|
||||
zapIMediaSink.idl \
|
||||
zapIMediaSource.idl \
|
||||
zapIPacketBuffer.idl \
|
||||
zapIPacketPump.idl \
|
||||
zapIPortaudioDevice.idl \
|
||||
zapIRTPFrame.idl \
|
||||
zapISpeexAudioProcessor.idl \
|
||||
|
||||
50
mozilla/zap/zmk/src/zapIPacketPump.idl
Normal file
50
mozilla/zap/zmk/src/zapIPacketPump.idl
Normal file
@@ -0,0 +1,50 @@
|
||||
/* ***** 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) 2006
|
||||
* 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"
|
||||
|
||||
/**
|
||||
* \ingroup ZMK_MODULE
|
||||
*/
|
||||
[scriptable, uuid(c77c79ac-a00a-452c-bcf9-2f18b0038ba6)]
|
||||
interface zapIPacketPump : nsISupports
|
||||
{
|
||||
/**
|
||||
* Attempt to pump a single packet. Will have no effect if either
|
||||
* source or sink are disconnected.
|
||||
*/
|
||||
void pump();
|
||||
};
|
||||
@@ -119,20 +119,9 @@ zapPacketPumpClock::DisconnectSource(zapIMediaSource *source,
|
||||
NS_IMETHODIMP
|
||||
zapPacketPumpClock::ConsumeFrame(zapIMediaFrame * frame)
|
||||
{
|
||||
if (!mPump || !mPump->mInput || !mPump->mOutput) return NS_OK;
|
||||
if (!mPump) return NS_OK;
|
||||
|
||||
nsRefPtr<zapPacketPumpClock> deathGrip(this);
|
||||
|
||||
// ok, our cue. attempt to pump a frame
|
||||
nsCOMPtr<zapIMediaFrame> mframe;
|
||||
if (NS_SUCCEEDED(mPump->mInput->ProduceFrame(getter_AddRefs(mframe)))) {
|
||||
// the following check is important, since the graph might have been
|
||||
// reconfigured by the ProduceFrame call
|
||||
if (mPump->mOutput)
|
||||
mPump->mOutput->ConsumeFrame(mframe);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return mPump->Pump();
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +154,7 @@ NS_INTERFACE_MAP_BEGIN(zapPacketPump)
|
||||
NS_INTERFACE_MAP_ENTRY(zapIMediaNode)
|
||||
NS_INTERFACE_MAP_ENTRY(zapIMediaSink)
|
||||
NS_INTERFACE_MAP_ENTRY(zapIMediaSource)
|
||||
NS_INTERFACE_MAP_ENTRY(zapIPacketPump)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -173,8 +163,8 @@ NS_INTERFACE_MAP_END
|
||||
/* void addedToGraph (in zapIMediaGraph graph, in ACString id, in nsIPropertyBag2 node_pars); */
|
||||
NS_IMETHODIMP
|
||||
zapPacketPump::AddedToGraph(zapIMediaGraph *graph,
|
||||
const nsACString & id,
|
||||
nsIPropertyBag2* node_pars)
|
||||
const nsACString & id,
|
||||
nsIPropertyBag2* node_pars)
|
||||
{
|
||||
mGraph = graph;
|
||||
|
||||
@@ -308,3 +298,24 @@ zapPacketPump::ProduceFrame(zapIMediaFrame ** frame)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// zapIPacketPump implementation:
|
||||
|
||||
/* void pump (); */
|
||||
NS_IMETHODIMP
|
||||
zapPacketPump::Pump()
|
||||
{
|
||||
if (!mInput || !mOutput) return NS_OK;
|
||||
|
||||
nsRefPtr<zapPacketPump> deathGrip(this);
|
||||
|
||||
nsCOMPtr<zapIMediaFrame> frame;
|
||||
if (NS_SUCCEEDED(mInput->ProduceFrame(getter_AddRefs(frame)))) {
|
||||
// the following check is important, since the graph might have
|
||||
// been reconfigured by the ProduceFrame() call:
|
||||
if (mOutput)
|
||||
mOutput->ConsumeFrame(frame);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "zapIMediaNode.h"
|
||||
#include "zapIMediaSource.h"
|
||||
#include "zapIMediaSink.h"
|
||||
#include "zapIPacketPump.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class zapPacketPumpClock;
|
||||
@@ -55,12 +56,14 @@ class zapPacketPumpClock;
|
||||
|
||||
class zapPacketPump : public zapIMediaNode,
|
||||
public zapIMediaSource,
|
||||
public zapIMediaSink
|
||||
public zapIMediaSink,
|
||||
public zapIPacketPump
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_ZAPIMEDIANODE
|
||||
NS_DECL_ZAPIMEDIASOURCE
|
||||
NS_DECL_ZAPIMEDIASINK
|
||||
NS_DECL_ZAPIPACKETPUMP
|
||||
|
||||
zapPacketPump();
|
||||
~zapPacketPump();
|
||||
|
||||
Reference in New Issue
Block a user