gecko/dom/media/encoder/OmxTrackEncoder.h
Botond Ballo a22b4f8419 Bug 1073003 - Fix warnings about calling 'delete' on an object of incomplete type. r=jolin
--HG--
extra : rebase_source : 520fd7cdaad55805639a109bd5fd55308a721fc4
2015-01-02 17:27:02 -05:00

95 lines
2.3 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
/* 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 OmxTrackEncoder_h_
#define OmxTrackEncoder_h_
#include "TrackEncoder.h"
namespace android {
class OMXVideoEncoder;
class OMXAudioEncoder;
}
/**
* There are two major classes defined in file OmxTrackEncoder;
* OmxVideoTrackEncoder and OmxAudioTrackEncoder, the video and audio track
* encoder for media type AVC/H.264 and AAC. OMXCodecWrapper wraps and controls
* an instance of MediaCodec, defined in libstagefright, runs on Android Jelly
* Bean platform.
*/
namespace mozilla {
class OmxVideoTrackEncoder: public VideoTrackEncoder
{
public:
OmxVideoTrackEncoder();
~OmxVideoTrackEncoder();
already_AddRefed<TrackMetadataBase> GetMetadata() MOZ_OVERRIDE;
nsresult GetEncodedTrack(EncodedFrameContainer& aData) MOZ_OVERRIDE;
protected:
nsresult Init(int aWidth, int aHeight,
int aDisplayWidth, int aDisplayHeight,
TrackRate aTrackRate) MOZ_OVERRIDE;
private:
nsAutoPtr<android::OMXVideoEncoder> mEncoder;
};
class OmxAudioTrackEncoder : public AudioTrackEncoder
{
public:
OmxAudioTrackEncoder();
~OmxAudioTrackEncoder();
already_AddRefed<TrackMetadataBase> GetMetadata() = 0;
nsresult GetEncodedTrack(EncodedFrameContainer& aData) MOZ_OVERRIDE;
protected:
nsresult Init(int aChannels, int aSamplingRate) = 0;
// Append encoded frames to aContainer.
nsresult AppendEncodedFrames(EncodedFrameContainer& aContainer);
nsAutoPtr<android::OMXAudioEncoder> mEncoder;
};
class OmxAACAudioTrackEncoder MOZ_FINAL : public OmxAudioTrackEncoder
{
public:
OmxAACAudioTrackEncoder()
: OmxAudioTrackEncoder()
{}
already_AddRefed<TrackMetadataBase> GetMetadata() MOZ_OVERRIDE;
protected:
nsresult Init(int aChannels, int aSamplingRate) MOZ_OVERRIDE;
};
class OmxAMRAudioTrackEncoder MOZ_FINAL : public OmxAudioTrackEncoder
{
public:
OmxAMRAudioTrackEncoder()
: OmxAudioTrackEncoder()
{}
enum {
AMR_NB_SAMPLERATE = 8000,
};
already_AddRefed<TrackMetadataBase> GetMetadata() MOZ_OVERRIDE;
protected:
nsresult Init(int aChannels, int aSamplingRate) MOZ_OVERRIDE;
};
}
#endif