diff options
author | Andreas Huber <andih@google.com> | 2010-08-04 10:14:30 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-08-04 11:49:24 -0700 |
commit | 39ddf8e0f18766f7ba1e3246b774aa6ebd93eea8 (patch) | |
tree | 87f5d0d68c1779f113843e939c41440ff6b00389 /media/libmediaplayerservice | |
parent | 610959a52fe22a88e50d158f5f5f492fee4f1921 (diff) | |
download | frameworks_av-39ddf8e0f18766f7ba1e3246b774aa6ebd93eea8.zip frameworks_av-39ddf8e0f18766f7ba1e3246b774aa6ebd93eea8.tar.gz frameworks_av-39ddf8e0f18766f7ba1e3246b774aa6ebd93eea8.tar.bz2 |
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.
Change-Id: I95b8dd487061add9bade15749e563b01cd99d9a6
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r-- | media/libmediaplayerservice/Android.mk | 7 | ||||
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.cpp | 49 | ||||
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.h | 3 |
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 dfddae0..f6f89c7 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.cpp +++ b/media/libmediaplayerservice/StagefrightRecorder.cpp @@ -40,6 +40,8 @@ #include <unistd.h> #include <ctype.h> +#include "ARTPWriter.h" + namespace android { StagefrightRecorder::StagefrightRecorder() @@ -628,6 +630,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; @@ -760,6 +765,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( @@ -882,7 +920,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; @@ -944,7 +984,8 @@ status_t StagefrightRecorder::setupVideoEncoder(const sp<MediaWriter>& writer) { return UNKNOWN_ERROR; } - writer->addSource(encoder); + *source = encoder; + return OK; } @@ -982,8 +1023,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 b4c5900..216f6bc 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.h +++ b/media/libmediaplayerservice/StagefrightRecorder.h @@ -101,10 +101,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); |