summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2013-03-08 23:13:07 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-03-08 23:13:08 +0000
commit70369845f8250df4f6f22c336414b4df0a3ce53e (patch)
treec1b635a2b80aff583bf569f53942239727369038 /media
parent2797b47f8a74b902d445cd89755e2349136a8b6b (diff)
parent3db62dfc5102247d415df4667bd9609e669fc022 (diff)
downloadframeworks_av-70369845f8250df4f6f22c336414b4df0a3ce53e.zip
frameworks_av-70369845f8250df4f6f22c336414b4df0a3ce53e.tar.gz
frameworks_av-70369845f8250df4f6f22c336414b4df0a3ce53e.tar.bz2
Merge "Clean up the native code to match Java update" into jb-mr2-dev
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/MediaMuxer.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/media/libstagefright/MediaMuxer.cpp b/media/libstagefright/MediaMuxer.cpp
index 30bed90..aefc270 100644
--- a/media/libstagefright/MediaMuxer.cpp
+++ b/media/libstagefright/MediaMuxer.cpp
@@ -35,14 +35,20 @@
namespace android {
-MediaMuxer::MediaMuxer(const char* pathOut)
- : mState(INITED) {
- mWriter = new MPEG4Writer(pathOut);
+MediaMuxer::MediaMuxer(const char *path, OutputFormat format)
+ : mState(UNINITED) {
+ if (format == OUTPUT_FORMAT_MPEG_4) {
+ mWriter = new MPEG4Writer(path);
+ mState = INITED;
+ }
}
-MediaMuxer::MediaMuxer(int fd)
- : mState(INITED) {
- mWriter = new MPEG4Writer(fd);
+MediaMuxer::MediaMuxer(int fd, OutputFormat format)
+ : mState(UNINITED) {
+ if (format == OUTPUT_FORMAT_MPEG_4) {
+ mWriter = new MPEG4Writer(fd);
+ mState = INITED;
+ }
}
MediaMuxer::~MediaMuxer() {
@@ -107,8 +113,6 @@ status_t MediaMuxer::writeSampleData(const sp<ABuffer> &buffer, size_t trackInde
int64_t timeUs, uint32_t flags) {
Mutex::Autolock autoLock(mMuxerLock);
- sp<MediaAdapter> currentTrack = mTrackList[trackIndex];
-
if (buffer.get() == NULL) {
ALOGE("WriteSampleData() get an NULL buffer.");
return -EINVAL;
@@ -134,10 +138,11 @@ status_t MediaMuxer::writeSampleData(const sp<ABuffer> &buffer, size_t trackInde
// Just set the kKeyDecodingTime as the presentation time for now.
metaData->setInt64(kKeyDecodingTime, timeUs);
- if (flags & MediaCodec::BUFFER_FLAG_SYNCFRAME) {
+ if (flags & SAMPLE_FLAG_SYNC) {
metaData->setInt32(kKeyIsSyncFrame, true);
}
+ sp<MediaAdapter> currentTrack = mTrackList[trackIndex];
// This pushBuffer will wait until the mediaBuffer is consumed.
return currentTrack->pushBuffer(mediaBuffer);
}