Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29d7654d authored by Lajos Molnar's avatar Lajos Molnar Committed by Android (Google) Code Review
Browse files

Merge "stagefright: support webm container in muxer cmdline" into nyc-dev

parents 01f69476 0ce6e969
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ static void usage(const char *me) {
    fprintf(stderr, "       -h help\n");
    fprintf(stderr, "       -a use audio\n");
    fprintf(stderr, "       -v use video\n");
    fprintf(stderr, "       -w mux into WebM container (default is MP4)\n");
    fprintf(stderr, "       -s Time in milli-seconds when the trim should start\n");
    fprintf(stderr, "       -e Time in milli-seconds when the trim should end\n");
    fprintf(stderr, "       -o output file name. Default is /sdcard/muxeroutput.mp4\n");
@@ -60,7 +61,8 @@ static int muxing(
        bool enableTrim,
        int trimStartTimeMs,
        int trimEndTimeMs,
        int rotationDegrees) {
        int rotationDegrees,
        MediaMuxer::OutputFormat container = MediaMuxer::OUTPUT_FORMAT_MPEG_4) {
    sp<NuMediaExtractor> extractor = new NuMediaExtractor;
    if (extractor->setDataSource(NULL /* httpService */, path) != OK) {
        fprintf(stderr, "unable to instantiate extractor. %s\n", path);
@@ -80,8 +82,7 @@ static int muxing(
        ALOGE("couldn't open file");
        return fd;
    }
    sp<MediaMuxer> muxer = new MediaMuxer(fd,
                                          MediaMuxer::OUTPUT_FORMAT_MPEG_4);
    sp<MediaMuxer> muxer = new MediaMuxer(fd, container);
    close(fd);

    size_t trackCount = extractor->countTracks();
@@ -237,9 +238,10 @@ int main(int argc, char **argv) {
    // When trimStartTimeMs and trimEndTimeMs seems valid, we turn this switch
    // to true.
    bool enableTrim = false;
    MediaMuxer::OutputFormat container = MediaMuxer::OUTPUT_FORMAT_MPEG_4;

    int res;
    while ((res = getopt(argc, argv, "h?avo:s:e:r:")) >= 0) {
    while ((res = getopt(argc, argv, "h?avo:s:e:r:w")) >= 0) {
        switch (res) {
            case 'a':
            {
@@ -253,6 +255,12 @@ int main(int argc, char **argv) {
                break;
            }

            case 'w':
            {
                container = MediaMuxer::OUTPUT_FORMAT_WEBM;
                break;
            }

            case 'o':
            {
                outputFileName = optarg;
@@ -318,7 +326,7 @@ int main(int argc, char **argv) {
    looper->start();

    int result = muxing(argv[0], useAudio, useVideo, outputFileName,
                        enableTrim, trimStartTimeMs, trimEndTimeMs, rotationDegrees);
                        enableTrim, trimStartTimeMs, trimEndTimeMs, rotationDegrees, container);

    looper->stop();