am e0fa467e: Move frame count calculations for fast tracks

* commit 'e0fa467e1150c65a7b1b1ed904c579b40f97c9df':
  Move frame count calculations for fast tracks
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index 6a5b45f..49a9bc0 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -608,6 +608,7 @@
     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");
 }
 
 int main(int argc, char **argv) {
@@ -621,6 +622,7 @@
     bool useSurfaceAlloc = false;
     bool useSurfaceTexAlloc = false;
     bool dumpStream = false;
+    bool dumpPCMStream = false;
     String8 dumpStreamFilename;
     gNumRepetitions = 1;
     gMaxNumFrames = 0;
@@ -635,7 +637,7 @@
     sp<LiveSession> liveSession;
 
     int res;
-    while ((res = getopt(argc, argv, "han:lm:b:ptsrow:kxSTd:")) >= 0) {
+    while ((res = getopt(argc, argv, "han:lm:b:ptsrow:kxSTd:D:")) >= 0) {
         switch (res) {
             case 'a':
             {
@@ -650,6 +652,14 @@
                 break;
             }
 
+            case 'D':
+            {
+                dumpPCMStream = true;
+                audioOnly = true;
+                dumpStreamFilename.setTo(optarg);
+                break;
+            }
+
             case 'l':
             {
                 listComponents = true;
@@ -1094,6 +1104,20 @@
             writeSourcesToMP4(mediaSources, syncInfoPresent);
         } else if (dumpStream) {
             dumpSource(mediaSource, dumpStreamFilename);
+        } else if (dumpPCMStream) {
+            OMXClient client;
+            CHECK_EQ(client.connect(), (status_t)OK);
+
+            sp<MediaSource> decSource =
+                OMXCodec::Create(
+                        client.interface(),
+                        mediaSource->getFormat(),
+                        false,
+                        mediaSource,
+                        0,
+                        0);
+
+            dumpSource(decSource, dumpStreamFilename);
         } else if (seekTest) {
             performSeekTest(mediaSource);
         } else {