summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-08-05 11:46:04 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-08-05 11:46:04 -0700
commit982a93173bc84f005172152d823cbb59dfcbeb12 (patch)
tree2ef94049c4daadc6b4da5a3d6c93c04d99d08d05 /media/libmediaplayerservice
parentaa68b49a53a874a1813e65752663f19d18149e2c (diff)
parent347d3c1dabd7ae9c998a024c685de2001e0ff369 (diff)
downloadframeworks_av-982a93173bc84f005172152d823cbb59dfcbeb12.zip
frameworks_av-982a93173bc84f005172152d823cbb59dfcbeb12.tar.gz
frameworks_av-982a93173bc84f005172152d823cbb59dfcbeb12.tar.bz2
am 1f513d88: am c17f35dd: Merge "Support for Gtalk video, includes AMR/H.263 assembler and packetization support, extensions to MediaRecorder to stream via RTP over a pair of UDP sockets as well as various fixes to the RTP implementation." into gingerbread
Merge commit '1f513d8821670a33d6361ea521b6756163a3f9bf' * commit '1f513d8821670a33d6361ea521b6756163a3f9bf': Support for Gtalk video, includes AMR/H.263 assembler and packetization support, extensions to MediaRecorder to stream via RTP over a pair of UDP sockets as well as various fixes to the RTP implementation.
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r--media/libmediaplayerservice/Android.mk7
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.cpp49
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.h3
3 files changed, 54 insertions, 5 deletions
diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk
index 8f010c9..e1edd16 100644
--- a/media/libmediaplayerservice/Android.mk
+++ b/media/libmediaplayerservice/Android.mk
@@ -31,9 +31,13 @@ LOCAL_SHARED_LIBRARIES := \
libandroid_runtime \
libstagefright \
libstagefright_omx \
- libstagefright_color_conversion \
+ libstagefright_color_conversion \
+ libstagefright_foundation \
libsurfaceflinger_client
+LOCAL_STATIC_LIBRARIES := \
+ libstagefright_rtsp
+
ifneq ($(BUILD_WITHOUT_PV),true)
LOCAL_SHARED_LIBRARIES += \
libopencore_player \
@@ -51,6 +55,7 @@ LOCAL_C_INCLUDES := \
$(call include-path-for, graphics corecg) \
$(TOP)/external/opencore/extern_libs_v2/khronos/openmax/include \
$(TOP)/frameworks/base/media/libstagefright/include \
+ $(TOP)/frameworks/base/media/libstagefright/rtsp \
$(TOP)/external/tremolo/Tremolo
LOCAL_MODULE:= libmediaplayerservice
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index 7d6754b..805f86b 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -41,6 +41,8 @@
#include <unistd.h>
#include <ctype.h>
+#include "ARTPWriter.h"
+
namespace android {
StagefrightRecorder::StagefrightRecorder()
@@ -684,6 +686,9 @@ status_t StagefrightRecorder::start() {
case OUTPUT_FORMAT_AAC_ADTS:
return startAACRecording();
+ case OUTPUT_FORMAT_RTP_AVP:
+ return startRTPRecording();
+
default:
LOGE("Unsupported output file format: %d", mOutputFormat);
return UNKNOWN_ERROR;
@@ -816,6 +821,39 @@ status_t StagefrightRecorder::startAMRRecording() {
return OK;
}
+status_t StagefrightRecorder::startRTPRecording() {
+ CHECK_EQ(mOutputFormat, OUTPUT_FORMAT_RTP_AVP);
+
+ if ((mAudioSource != AUDIO_SOURCE_LIST_END
+ && mVideoSource != VIDEO_SOURCE_LIST_END)
+ || (mAudioSource == AUDIO_SOURCE_LIST_END
+ && mVideoSource == VIDEO_SOURCE_LIST_END)) {
+ // Must have exactly one source.
+ return BAD_VALUE;
+ }
+
+ if (mOutputFd < 0) {
+ return BAD_VALUE;
+ }
+
+ sp<MediaSource> source;
+
+ if (mAudioSource != AUDIO_SOURCE_LIST_END) {
+ source = createAudioSource();
+ } else {
+ status_t err = setupVideoEncoder(&source);
+ if (err != OK) {
+ return err;
+ }
+ }
+
+ mWriter = new ARTPWriter(dup(mOutputFd));
+ mWriter->addSource(source);
+ mWriter->setListener(mListener);
+
+ return mWriter->start();
+}
+
void StagefrightRecorder::clipVideoFrameRate() {
LOGV("clipVideoFrameRate: encoder %d", mVideoEncoder);
int minFrameRate = mEncoderProfiles->getVideoEncoderParamByName(
@@ -949,7 +987,9 @@ void StagefrightRecorder::clipVideoFrameHeight() {
}
}
-status_t StagefrightRecorder::setupVideoEncoder(const sp<MediaWriter>& writer) {
+status_t StagefrightRecorder::setupVideoEncoder(sp<MediaSource> *source) {
+ source->clear();
+
status_t err = setupCameraSource();
if (err != OK) return err;
@@ -1017,7 +1057,8 @@ status_t StagefrightRecorder::setupVideoEncoder(const sp<MediaWriter>& writer) {
return UNKNOWN_ERROR;
}
- writer->addSource(encoder);
+ *source = encoder;
+
return OK;
}
@@ -1055,8 +1096,10 @@ status_t StagefrightRecorder::startMPEG4Recording() {
}
if (mVideoSource == VIDEO_SOURCE_DEFAULT
|| mVideoSource == VIDEO_SOURCE_CAMERA) {
- err = setupVideoEncoder(writer);
+ sp<MediaSource> encoder;
+ err = setupVideoEncoder(&encoder);
if (err != OK) return err;
+ writer->addSource(encoder);
totalBitRate += mVideoBitRate;
}
diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h
index 03f0b61..a8be27d 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -105,10 +105,11 @@ private:
status_t startMPEG4Recording();
status_t startAMRRecording();
status_t startAACRecording();
+ status_t startRTPRecording();
sp<MediaSource> createAudioSource();
status_t setupCameraSource();
status_t setupAudioEncoder(const sp<MediaWriter>& writer);
- status_t setupVideoEncoder(const sp<MediaWriter>& writer);
+ status_t setupVideoEncoder(sp<MediaSource> *source);
// Encoding parameter handling utilities
status_t setParameter(const String8 &key, const String8 &value);