diff options
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/stagefright/Android.mk | 10 | ||||
-rw-r--r-- | cmds/stagefright/SimplePlayer.cpp | 12 | ||||
-rw-r--r-- | cmds/stagefright/SimplePlayer.h | 4 | ||||
-rw-r--r-- | cmds/stagefright/recordvideo.cpp | 12 | ||||
-rw-r--r-- | cmds/stagefright/stagefright.cpp | 10 |
5 files changed, 28 insertions, 20 deletions
diff --git a/cmds/stagefright/Android.mk b/cmds/stagefright/Android.mk index 1247588..a59186a 100644 --- a/cmds/stagefright/Android.mk +++ b/cmds/stagefright/Android.mk @@ -8,8 +8,8 @@ LOCAL_SRC_FILES:= \ SineSource.cpp LOCAL_SHARED_LIBRARIES := \ - libstagefright libmedia libmedia_native libutils libbinder libstagefright_foundation \ - libjpeg libgui + libstagefright libmedia libutils libbinder libstagefright_foundation \ + libjpeg libgui libcutils LOCAL_C_INCLUDES:= \ frameworks/av/media/libstagefright \ @@ -104,7 +104,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libstagefright liblog libutils libbinder libgui \ - libstagefright_foundation libmedia libmedia_native libcutils + libstagefright_foundation libmedia libcutils LOCAL_C_INCLUDES:= \ frameworks/av/media/libstagefright \ @@ -127,7 +127,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libstagefright liblog libutils libbinder libstagefright_foundation \ - libmedia libmedia_native libgui libcutils libui + libmedia libgui libcutils libui LOCAL_C_INCLUDES:= \ frameworks/av/media/libstagefright \ @@ -151,7 +151,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libstagefright liblog libutils libbinder libstagefright_foundation \ - libmedia libmedia_native libgui libcutils libui + libmedia libgui libcutils libui LOCAL_C_INCLUDES:= \ frameworks/av/media/libstagefright \ diff --git a/cmds/stagefright/SimplePlayer.cpp b/cmds/stagefright/SimplePlayer.cpp index 7636906..93de112 100644 --- a/cmds/stagefright/SimplePlayer.cpp +++ b/cmds/stagefright/SimplePlayer.cpp @@ -64,12 +64,12 @@ status_t SimplePlayer::setDataSource(const char *path) { return PostAndAwaitResponse(msg, &response); } -status_t SimplePlayer::setSurface(const sp<ISurfaceTexture> &surfaceTexture) { +status_t SimplePlayer::setSurface(const sp<IGraphicBufferProducer> &bufferProducer) { sp<AMessage> msg = new AMessage(kWhatSetSurface, id()); sp<SurfaceTextureClient> surfaceTextureClient; - if (surfaceTexture != NULL) { - surfaceTextureClient = new SurfaceTextureClient(surfaceTexture); + if (bufferProducer != NULL) { + surfaceTextureClient = new SurfaceTextureClient(bufferProducer); } msg->setObject( @@ -297,9 +297,11 @@ status_t SimplePlayer::onPrepare() { AString mime; CHECK(format->findString("mime", &mime)); + bool isVideo = !strncasecmp(mime.c_str(), "video/", 6); + if (!haveAudio && !strncasecmp(mime.c_str(), "audio/", 6)) { haveAudio = true; - } else if (!haveVideo && !strncasecmp(mime.c_str(), "video/", 6)) { + } else if (!haveVideo && isVideo) { haveVideo = true; } else { continue; @@ -320,7 +322,7 @@ status_t SimplePlayer::onPrepare() { err = state->mCodec->configure( format, - mNativeWindow->getSurfaceTextureClient(), + isVideo ? mNativeWindow->getSurfaceTextureClient() : NULL, NULL /* crypto */, 0 /* flags */); diff --git a/cmds/stagefright/SimplePlayer.h b/cmds/stagefright/SimplePlayer.h index 2548252..0a06059 100644 --- a/cmds/stagefright/SimplePlayer.h +++ b/cmds/stagefright/SimplePlayer.h @@ -23,7 +23,7 @@ namespace android { struct ABuffer; struct ALooper; struct AudioTrack; -struct ISurfaceTexture; +struct IGraphicBufferProducer; struct MediaCodec; struct NativeWindowWrapper; struct NuMediaExtractor; @@ -32,7 +32,7 @@ struct SimplePlayer : public AHandler { SimplePlayer(); status_t setDataSource(const char *path); - status_t setSurface(const sp<ISurfaceTexture> &surfaceTexture); + status_t setSurface(const sp<IGraphicBufferProducer> &bufferProducer); status_t prepare(); status_t start(); status_t stop(); diff --git a/cmds/stagefright/recordvideo.cpp b/cmds/stagefright/recordvideo.cpp index e02f111..c30c122 100644 --- a/cmds/stagefright/recordvideo.cpp +++ b/cmds/stagefright/recordvideo.cpp @@ -44,7 +44,7 @@ static void usage(const char *me) { fprintf(stderr, " -p encoder profile. see omx il header (default: encoder specific)\n"); fprintf(stderr, " -v video codec: [0] AVC [1] M4V [2] H263 (default: 0)\n"); fprintf(stderr, " -s(oftware) prefer software codec\n"); - fprintf(stderr, "The output file is /sdcard/output.mp4\n"); + fprintf(stderr, " -o filename: output file (default: /sdcard/output.mp4)\n"); exit(1); } @@ -162,12 +162,12 @@ int main(int argc, char **argv) { int level = -1; // Encoder specific default int profile = -1; // Encoder specific default int codec = 0; - const char *fileName = "/sdcard/output.mp4"; + char *fileName = "/sdcard/output.mp4"; bool preferSoftwareCodec = false; android::ProcessState::self()->startThreadPool(); int res; - while ((res = getopt(argc, argv, "b:c:f:i:n:w:t:l:p:v:hs")) >= 0) { + while ((res = getopt(argc, argv, "b:c:f:i:n:w:t:l:p:v:o:hs")) >= 0) { switch (res) { case 'b': { @@ -235,6 +235,12 @@ int main(int argc, char **argv) { break; } + case 'o': + { + fileName = optarg; + break; + } + case 's': { preferSoftwareCodec = true; diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index b92a8a0..1002ac4 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -589,7 +589,7 @@ static void performSeekTest(const sp<MediaSource> &source) { } static void usage(const char *me) { - fprintf(stderr, "usage: %s\n", me); + fprintf(stderr, "usage: %s [options] [input_filename]\n", me); fprintf(stderr, " -h(elp)\n"); fprintf(stderr, " -a(udio)\n"); fprintf(stderr, " -n repetitions\n"); @@ -607,8 +607,8 @@ static void usage(const char *me) { "(video only)\n"); fprintf(stderr, " -S allocate buffers from a surface\n"); fprintf(stderr, " -T allocate buffers from a surface texture\n"); - fprintf(stderr, " -d(ump) filename (raw stream data to a file)\n"); - fprintf(stderr, " -D(ump) filename (decoded PCM data to a file)\n"); + fprintf(stderr, " -d(ump) output_filename (raw stream data to a file)\n"); + fprintf(stderr, " -D(ump) output_filename (decoded PCM data to a file)\n"); } static void dumpCodecProfiles(const sp<IOMX>& omx, bool queryDecoders) { @@ -940,8 +940,8 @@ int main(int argc, char **argv) { } else { CHECK(useSurfaceTexAlloc); - sp<SurfaceTexture> texture = new SurfaceTexture(0 /* tex */); - gSurface = new SurfaceTextureClient(texture); + sp<GLConsumer> texture = new GLConsumer(0 /* tex */); + gSurface = new SurfaceTextureClient(texture->getBufferQueue()); } CHECK_EQ((status_t)OK, |