summaryrefslogtreecommitdiffstats
path: root/media/libavextensions
diff options
context:
space:
mode:
authorSurajit Podder <spodder@codeaurora.org>2015-07-21 15:29:39 +0530
committerSatish Kamuju <skamuj@codeaurora.org>2015-10-06 17:36:01 +0530
commit9953765019ae2243e98e8e74eee327c9893b93d1 (patch)
treea0d21f06540cbdac85dcb6348a27b9eddf3cb68d /media/libavextensions
parentbd019775a921ae9165e924e4d37bc838a7ef5781 (diff)
downloadframeworks_av-9953765019ae2243e98e8e74eee327c9893b93d1.zip
frameworks_av-9953765019ae2243e98e8e74eee327c9893b93d1.tar.gz
frameworks_av-9953765019ae2243e98e8e74eee327c9893b93d1.tar.bz2
video: Modify classes to support camcorder pause/resume
* Modify MediaRecorder, CameraSource, AudioSource to be extendable. * Add hooks to instantiate extended implementations to implement pause/resume. Change-Id: I847263fc69e4f613c5ea60fb6809c7da176d3a8d
Diffstat (limited to 'media/libavextensions')
-rw-r--r--media/libavextensions/common/AVExtensionsCommon.h2
-rw-r--r--media/libavextensions/common/ExtensionsLoader.hpp2
-rw-r--r--media/libavextensions/media/AVMediaExtensions.h3
-rw-r--r--media/libavextensions/media/AVMediaUtils.cpp5
-rw-r--r--media/libavextensions/stagefright/AVExtensions.h25
-rw-r--r--media/libavextensions/stagefright/AVFactory.cpp28
6 files changed, 63 insertions, 2 deletions
diff --git a/media/libavextensions/common/AVExtensionsCommon.h b/media/libavextensions/common/AVExtensionsCommon.h
index 52a247a..c39872e 100644
--- a/media/libavextensions/common/AVExtensionsCommon.h
+++ b/media/libavextensions/common/AVExtensionsCommon.h
@@ -31,8 +31,6 @@
namespace android {
-static const char * CUSTOMIZATION_LIB_NAME = "libavenhancements.so";
-
typedef void *(*createFunction_t)(void);
template <typename T>
diff --git a/media/libavextensions/common/ExtensionsLoader.hpp b/media/libavextensions/common/ExtensionsLoader.hpp
index b23b868..e03979c 100644
--- a/media/libavextensions/common/ExtensionsLoader.hpp
+++ b/media/libavextensions/common/ExtensionsLoader.hpp
@@ -31,6 +31,8 @@
namespace android {
+static const char * CUSTOMIZATION_LIB_NAME = "libavenhancements.so";
+
/*
* Create strongly-typed objects of type T
* If the customization library exists and does contain a "named" constructor,
diff --git a/media/libavextensions/media/AVMediaExtensions.h b/media/libavextensions/media/AVMediaExtensions.h
index 4dc3d95..ea5245c 100644
--- a/media/libavextensions/media/AVMediaExtensions.h
+++ b/media/libavextensions/media/AVMediaExtensions.h
@@ -36,6 +36,7 @@
namespace android {
+class MediaRecorder;
/*
* Common delegate to the classes in libstagefright
*/
@@ -57,6 +58,8 @@ struct AVMediaUtils {
virtual size_t AudioTrackGetOffloadFrameCount(size_t frameCount) {
return frameCount;
}
+
+ virtual sp<MediaRecorder> createMediaRecorder(const String16& opPackageName);
// ----- NO TRESSPASSING BEYOND THIS LINE ------
DECLARE_LOADABLE_SINGLETON(AVMediaUtils);
};
diff --git a/media/libavextensions/media/AVMediaUtils.cpp b/media/libavextensions/media/AVMediaUtils.cpp
index 7c21414..0f9e9eb 100644
--- a/media/libavextensions/media/AVMediaUtils.cpp
+++ b/media/libavextensions/media/AVMediaUtils.cpp
@@ -40,6 +40,7 @@
#include <media/stagefright/ACodec.h>
#include <media/AudioTrack.h>
+#include <media/mediarecorder.h>
#include "common/ExtensionsLoader.hpp"
#include "media/AVMediaExtensions.h"
@@ -53,6 +54,10 @@ AVMediaUtils::AVMediaUtils() {
AVMediaUtils::~AVMediaUtils() {
}
+sp<MediaRecorder> AVMediaUtils::createMediaRecorder(const String16& opPackageName) {
+ return new MediaRecorder(opPackageName);
+}
+
//static
AVMediaUtils *AVMediaUtils::sInst =
ExtensionsLoader<AVMediaUtils>::createInstance("createExtendedMediaUtils");
diff --git a/media/libavextensions/stagefright/AVExtensions.h b/media/libavextensions/stagefright/AVExtensions.h
index 4d73f59..e75499f 100644
--- a/media/libavextensions/stagefright/AVExtensions.h
+++ b/media/libavextensions/stagefright/AVExtensions.h
@@ -46,10 +46,18 @@ struct ACodec;
struct ALooper;
struct IMediaHTTPConnection;
struct MediaCodec;
+struct MediaSource;
struct MediaHTTP;
struct NuCachedSource2;
class CameraParameters;
class MediaBuffer;
+struct AudioSource;
+class CameraSource;
+class ICamera;
+class ICameraRecordingProxy;
+class String16;
+class IGraphicBufferProducer;
+struct Size;
/*
* Factory to create objects of base-classes in libstagefright
@@ -69,6 +77,23 @@ struct AVFactory {
virtual MediaHTTP* createMediaHTTP(
const sp<IMediaHTTPConnection> &conn);
+ virtual AudioSource* createAudioSource(
+ audio_source_t inputSource,
+ const String16 &opPackageName,
+ uint32_t sampleRate,
+ uint32_t channels,
+ uint32_t outSampleRate = 0);
+
+ virtual CameraSource *CreateFromCamera(
+ const sp<ICamera> &camera,
+ const sp<ICameraRecordingProxy> &proxy,
+ int32_t cameraId,
+ const String16& clientName,
+ uid_t clientUid,
+ Size videoSize,
+ int32_t frameRate,
+ const sp<IGraphicBufferProducer>& surface,
+ bool storeMetaDataInVideoBuffers = true);
// ----- NO TRESSPASSING BEYOND THIS LINE ------
DECLARE_LOADABLE_SINGLETON(AVFactory);
};
diff --git a/media/libavextensions/stagefright/AVFactory.cpp b/media/libavextensions/stagefright/AVFactory.cpp
index fe00f45..19977e9 100644
--- a/media/libavextensions/stagefright/AVFactory.cpp
+++ b/media/libavextensions/stagefright/AVFactory.cpp
@@ -41,6 +41,9 @@
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MediaExtractor.h>
#include <media/stagefright/MediaHTTP.h>
+#include <media/stagefright/AudioSource.h>
+#include <media/stagefright/CameraSource.h>
+#include <camera/CameraParameters.h>
#include "common/ExtensionsLoader.hpp"
#include "stagefright/AVExtensions.h"
@@ -75,6 +78,31 @@ MediaHTTP* AVFactory::createMediaHTTP(
return new MediaHTTP(conn);
}
+AudioSource* AVFactory::createAudioSource(
+ audio_source_t inputSource,
+ const String16 &opPackageName,
+ uint32_t sampleRate,
+ uint32_t channels,
+ uint32_t outSampleRate) {
+ return new AudioSource(inputSource, opPackageName, sampleRate,
+ channels, outSampleRate);
+}
+
+CameraSource* AVFactory::CreateFromCamera(
+ const sp<ICamera> &camera,
+ const sp<ICameraRecordingProxy> &proxy,
+ int32_t cameraId,
+ const String16& clientName,
+ uid_t clientUid,
+ Size videoSize,
+ int32_t frameRate,
+ const sp<IGraphicBufferProducer>& surface,
+ bool storeMetaDataInVideoBuffers) {
+ return CameraSource::CreateFromCamera(camera, proxy, cameraId,
+ clientName, clientUid, videoSize, frameRate, surface,
+ storeMetaDataInVideoBuffers);
+}
+
// ----- NO TRESSPASSING BEYOND THIS LINE ------
AVFactory::AVFactory() {
}