gecko/content/media/webrtc/MediaEngine.h
Ehsan Akhgari 0fd9123eac Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
This patch was generated by a script.  Here's the source of the script for
future reference:

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRInt8 int8_t
convert PRUint8 uint8_t
convert PRInt16 int16_t
convert PRUint16 uint16_t
convert PRInt32 int32_t
convert PRUint32 uint32_t
convert PRInt64 int64_t
convert PRUint64 uint64_t

convert PRIntn int
convert PRUintn unsigned

convert PRSize size_t

convert PROffset32 int32_t
convert PROffset64 int64_t

convert PRPtrdiff ptrdiff_t

convert PRFloat64 double
2012-08-22 11:56:38 -04:00

114 lines
3.2 KiB
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MEDIAENGINE_H_
#define MEDIAENGINE_H_
#include "nsIDOMFile.h"
#include "nsDOMMediaStream.h"
#include "MediaStreamGraph.h"
namespace mozilla {
/**
* Abstract interface for managing audio and video devices. Each platform
* must implement a concrete class that will map these classes and methods
* to the appropriate backend. For example, on Desktop platforms, these will
* correspond to equivalent webrtc (GIPS) calls, and on B2G they will map to
* a Gonk interface.
*/
class MediaEngineVideoSource;
class MediaEngineAudioSource;
class MediaEngine
{
public:
virtual ~MediaEngine() {};
/* Populate an array of video sources in the nsTArray. Also include devices
* that are currently unavailable. */
virtual void EnumerateVideoDevices(nsTArray<nsRefPtr<MediaEngineVideoSource> >*) = 0;
/* Populate an array of audio sources in the nsTArray. Also include devices
* that are currently unavailable. */
virtual void EnumerateAudioDevices(nsTArray<nsRefPtr<MediaEngineAudioSource> >*) = 0;
};
/**
* Common abstract base class for audio and video sources.
*/
class MediaEngineSource : public nsISupports
{
public:
virtual ~MediaEngineSource() {};
/* Populate the human readable name of this device in the nsAString */
virtual void GetName(nsAString&) = 0;
/* Populate the UUID of this device in the nsAString */
virtual void GetUUID(nsAString&) = 0;
/* This call reserves but does not start the device. */
virtual nsresult Allocate() = 0;
/* Release the device back to the system. */
virtual nsresult Deallocate() = 0;
/* Start the device and add the track to the provided SourceMediaStream, with
* the provided TrackID. You may start appending data to the track
* immediately after. */
virtual nsresult Start(SourceMediaStream*, TrackID) = 0;
/* Take a snapshot from this source. In the case of video this is a single
* image, and for audio, it is a snippet lasting aDuration milliseconds. The
* duration argument is ignored for a MediaEngineVideoSource.
*/
virtual nsresult Snapshot(uint32_t aDuration, nsIDOMFile** aFile) = 0;
/* Stop the device and release the corresponding MediaStream */
virtual nsresult Stop() = 0;
/* It is an error to call Start() before an Allocate(), and Stop() before
* a Start(). Only Allocate() may be called after a Deallocate(). */
};
/**
* Video source and friends.
*/
enum MediaEngineVideoCodecType {
kVideoCodecH263,
kVideoCodecVP8,
kVideoCodecI420
};
struct MediaEngineVideoOptions {
uint32_t mWidth;
uint32_t mHeight;
uint32_t mMaxFPS;
MediaEngineVideoCodecType codecType;
};
class MediaEngineVideoSource : public MediaEngineSource
{
public:
virtual ~MediaEngineVideoSource() {};
/* Return a MediaEngineVideoOptions struct with appropriate values for all
* fields. */
virtual MediaEngineVideoOptions GetOptions() = 0;
};
/**
* Audio source and friends.
*/
class MediaEngineAudioSource : public MediaEngineSource
{
public:
virtual ~MediaEngineAudioSource() {};
};
}
#endif /* MEDIAENGINE_H_ */