[haiku-commits] haiku: hrev48039 - in src: apps/mediaconverter add-ons/media/plugins/ffmpeg

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 18 Oct 2014 18:29:41 +0200 (CEST)

hrev48039 adds 3 changesets to branch 'master'
old head: a12b88a87de9c83bef7ceda6eaf759cd3d5e0035
new head: 0c90c6d7e5cf3cf13af036e8ad50d082bc8982eb
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=0c90c6d+%5Ea12b88a

----------------------------------------------------------------------------

3c5f0e6: Musepack: fix build.

37daf93: Update ffmpeg supported encoders list
  
  * Add FLAC, which works
  * Remove raw audio, ogg and AC3, as they are crashing the current ffmpeg
  version.
  
  Now it's possible to use MediaConvert to convert to FLAC, at least. For
  other formats we will need to either fix ffmpeg, or write encoders using
  the respective libraries (musepack, libvorbis, ...) for each format we
  want to support.
  
  Note that there are also some problems at the reading side, so using
  MediaConvert, the output will be truncated and about 2 seconds of audio
  will be missing at the end of the file in several cases. When this
  happens, the input file is not removed from the list. Watch out for this
  and don't delete the source files until you're very sure the output is
  correct!

0c90c6d: MediaConverter: style fixes.

                                 [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

----------------------------------------------------------------------------

3 files changed, 146 insertions(+), 19 deletions(-)
.../media/plugins/ffmpeg/EncoderTable.cpp        | 123 +++++++++++++++++++
src/add-ons/media/plugins/musepack/mpc/idtag.cpp |   1 +
src/apps/mediaconverter/MediaConverterApp.cpp    |  41 ++++---

############################################################################

Commit:      3c5f0e6b530d2f0930e7bd4b4474b80c4814f790
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3c5f0e6
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Sat Oct 18 16:22:30 2014 UTC

Musepack: fix build.

----------------------------------------------------------------------------

diff --git a/src/add-ons/media/plugins/musepack/mpc/idtag.cpp 
b/src/add-ons/media/plugins/musepack/mpc/idtag.cpp
index a2d4e86..e75e0e4 100644
--- a/src/add-ons/media/plugins/musepack/mpc/idtag.cpp
+++ b/src/add-ons/media/plugins/musepack/mpc/idtag.cpp
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
+#include <strings.h>
 #include <stdlib.h>
 #include "in_mpc.h"
 #include "idtag.h"

############################################################################

Commit:      37daf9367a246f1e6086ee9c90cbbceaee869f68
URL:         http://cgit.haiku-os.org/haiku/commit/?id=37daf93
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Sat Oct 18 16:22:55 2014 UTC

Update ffmpeg supported encoders list

* Add FLAC, which works
* Remove raw audio, ogg and AC3, as they are crashing the current ffmpeg
version.

Now it's possible to use MediaConvert to convert to FLAC, at least. For
other formats we will need to either fix ffmpeg, or write encoders using
the respective libraries (musepack, libvorbis, ...) for each format we
want to support.

Note that there are also some problems at the reading side, so using
MediaConvert, the output will be truncated and about 2 seconds of audio
will be missing at the end of the file in several cases. When this
happens, the input file is not removed from the list. Watch out for this
and don't delete the source files until you're very sure the output is
correct!

----------------------------------------------------------------------------

diff --git a/src/add-ons/media/plugins/ffmpeg/EncoderTable.cpp 
b/src/add-ons/media/plugins/ffmpeg/EncoderTable.cpp
index b16e26f..a404c47 100644
--- a/src/add-ons/media/plugins/ffmpeg/EncoderTable.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/EncoderTable.cpp
@@ -8,6 +8,7 @@
 
 
 const EncoderDescription gEncoderTable[] = {
+       // Video codecs
        {
                {
                        "MPEG-4 video",
@@ -86,6 +87,127 @@ const EncoderDescription gEncoderTable[] = {
                B_MEDIA_ENCODED_VIDEO,
                5
        },
+
+       // Audio codecs
+       {
+               {
+                       "Free Lossless Audio Codec (FLAC)",
+                       "flac",
+                       0,
+                       CODEC_ID_FLAC,
+                       { 0 }
+               },
+               B_ANY_FORMAT_FAMILY,
+               B_MEDIA_RAW_AUDIO,
+               B_MEDIA_ENCODED_AUDIO,
+               10
+       },
+       // All of those crash ffmpeg in one way or another...
+#if 0
+       {
+               {
+                       "Advanced Audio Coding (AAC)",
+                       "aac",
+                       0,
+                       CODEC_ID_AAC,
+                       { 0 }
+               },
+               B_ANY_FORMAT_FAMILY,
+               B_MEDIA_RAW_AUDIO,
+               B_MEDIA_ENCODED_AUDIO,
+               10
+       },
+       {
+               {
+                       "Dolby AC-3",
+                       "ac3",
+                       0,
+                       CODEC_ID_AC3,
+                       { 0 }
+               },
+               B_ANY_FORMAT_FAMILY,
+               B_MEDIA_RAW_AUDIO,
+               B_MEDIA_ENCODED_AUDIO,
+               10
+       },
+       {
+               {
+                       "Apple Lossless Audio Codec",
+                       "alac",
+                       0,
+                       CODEC_ID_ALAC,
+                       { 0 }
+               },
+               B_ANY_FORMAT_FAMILY,
+               B_MEDIA_RAW_AUDIO,
+               B_MEDIA_ENCODED_AUDIO,
+               10
+       },
+       {
+               {
+                       "Adaptive Transform Acoustic Coding",
+                       "atrac",
+                       0,
+                       CODEC_ID_ATRAC3,
+                       { 0 }
+               },
+               B_ANY_FORMAT_FAMILY,
+               B_MEDIA_RAW_AUDIO,
+               B_MEDIA_ENCODED_AUDIO,
+               10
+       },
+       {
+               {
+                       "MPEG Layer III (MP3)",
+                       "mp3",
+                       0,
+                       CODEC_ID_MP3,
+                       { 0 }
+               },
+               B_ANY_FORMAT_FAMILY,
+               B_MEDIA_RAW_AUDIO,
+               B_MEDIA_ENCODED_AUDIO,
+               10
+       },
+       {
+               {
+                       "Monkey's Audio",
+                       "ape",
+                       0,
+                       CODEC_ID_APE,
+                       { 0 }
+               },
+               B_ANY_FORMAT_FAMILY,
+               B_MEDIA_RAW_AUDIO,
+               B_MEDIA_ENCODED_AUDIO,
+               10
+       },
+       {
+               {
+                       "Musepack",
+                       "mpc",
+                       0,
+                       CODEC_ID_MUSEPACK8,
+                       { 0 }
+               },
+               B_ANY_FORMAT_FAMILY,
+               B_MEDIA_RAW_AUDIO,
+               B_MEDIA_ENCODED_AUDIO,
+               10
+       },
+       {
+               {
+                       "Windows Media Audio (WMA)",
+                       "wma",
+                       0,
+                       CODEC_ID_WMAV2,
+                       { 0 }
+               },
+               B_ANY_FORMAT_FAMILY,
+               B_MEDIA_RAW_AUDIO,
+               B_MEDIA_ENCODED_AUDIO,
+               10
+       },
        {
                {
                        "Raw audio",
@@ -125,6 +247,7 @@ const EncoderDescription gEncoderTable[] = {
                B_MEDIA_ENCODED_AUDIO,
                10
        }
+#endif
 };
 
 const size_t gEncoderCount = sizeof(gEncoderTable) / 
sizeof(EncoderDescription);

############################################################################

Revision:    hrev48039
Commit:      0c90c6d7e5cf3cf13af036e8ad50d082bc8982eb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0c90c6d
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Sat Oct 18 16:29:05 2014 UTC

MediaConverter: style fixes.

----------------------------------------------------------------------------

diff --git a/src/apps/mediaconverter/MediaConverterApp.cpp 
b/src/apps/mediaconverter/MediaConverterApp.cpp
index 76572ad..fc07713 100644
--- a/src/apps/mediaconverter/MediaConverterApp.cpp
+++ b/src/apps/mediaconverter/MediaConverterApp.cpp
@@ -143,10 +143,10 @@ MediaConverterApp::RefsReceived(BMessage* msg)
                }
 
                alertText << "\n" << errorFiles;
-               BAlert* alert = new BAlert((errors > 1) ? 
-                       B_TRANSLATE("Error loading files") : 
-                       B_TRANSLATE("Error loading a file"), 
-                       alertText.String(),     B_TRANSLATE("Continue"), NULL, 
NULL, 
+               BAlert* alert = new BAlert((errors > 1) ?
+                       B_TRANSLATE("Error loading files") :
+                       B_TRANSLATE("Error loading a file"),
+                       alertText.String(),     B_TRANSLATE("Continue"), NULL, 
NULL,
                        B_WIDTH_AS_USUAL, B_STOP_ALERT);
                alert->Go();
        }
@@ -271,7 +271,8 @@ MediaConverterApp::_RunConvert()
                                media_codec_info* audioCodec;
                                media_codec_info* videoCodec;
                                media_file_format* fileFormat;
-                               fWin->GetSelectedFormatInfo(&fileFormat, 
&audioCodec, &videoCodec);
+                               fWin->GetSelectedFormatInfo(&fileFormat, 
&audioCodec,
+                                       &videoCodec);
                                BDirectory directory = fWin->OutputDirectory();
                                fWin->Unlock();
                                outEntry = _CreateOutputFile(directory, &inRef, 
fileFormat);
@@ -315,7 +316,7 @@ MediaConverterApp::_RunConvert()
                                                srcIndex++;
                                                BString error(
                                                        B_TRANSLATE("Error 
converting '%filename'"));
-                                               error.ReplaceAll("%filename", 
inRef.name);
+                                               error.ReplaceAll("%filename", 
inRef.name);
                                                
fWin->SetStatusMessage(error.String());
                                        }
                                        fWin->Unlock();
@@ -445,21 +446,23 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, 
BMediaFile* outFile,
                                                // blocks until the window is 
quit
 
                                        // The quality setting is ignored by 
the 3ivx encoder if the
-                                       // view was displayed, but this method 
is the trigger to read
-                                       // all the parameter settings
+                                       // view was displayed, but this method 
is the trigger to
+                                       // read all the parameter settings
                                        outVidTrack->SetQuality(videoQuality / 
100.0f);
 
-                                       // We can now delete the encoderView 
created for us by the encoder
+                                       // We can now delete the encoderView 
created for us by the
+                                       // encoder
                                        delete encoderView;
                                        encoderView = NULL;
 
-                                       videoQualitySupport = 
-                                               B_TRANSLATE("Video using 
parameters form settings");
-                               } else {
-                                       if 
(outVidTrack->SetQuality(videoQuality / 100.0f) >= B_OK)
-                                               videoQualitySupport = 
-                                                       B_TRANSLATE("Video 
quality not supported");
+                                       videoQualitySupport
+                                               = B_TRANSLATE("Video using 
parameters form settings");
+                               } else if (outVidTrack->SetQuality(videoQuality 
/ 100.0f)
+                                       >= B_OK) {
+                                       videoQualitySupport
+                                               = B_TRANSLATE("Video quality 
not supported");
                                }
+
                                if (videoQualitySupport && fWin->Lock()) {
                                        
fWin->SetVideoQualityLabel(videoQualitySupport);
                                        fWin->Unlock();
@@ -525,8 +528,8 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, 
BMediaFile* outFile,
                for (int64 i = start; (i <= end) && !fCancel; i += framesRead) {
                        if ((ret = inVidTrack->ReadFrames(videoBuffer, 
&framesRead,
                                        &mh)) != B_OK) {
-                               fprintf(stderr, "Error reading video frame %" 
B_PRId64 ": %s\n", i,
-                                               strerror(ret));
+                               fprintf(stderr, "Error reading video frame %" 
B_PRId64 ": %s\n",
+                                       i, strerror(ret));
                                snprintf(status.LockBuffer(128), 128,
                                                B_TRANSLATE("Error read video 
frame %" B_PRId64), i);
                                status.UnlockBuffer();
@@ -537,8 +540,8 @@ MediaConverterApp::_ConvertFile(BMediaFile* inFile, 
BMediaFile* outFile,
 
                        if ((ret = outVidTrack->WriteFrames(videoBuffer, 
framesRead,
                                        mh.u.encoded_video.field_flags)) != 
B_OK) {
-                               fprintf(stderr, "Error writing video frame %" 
B_PRId64 ": %s\n", i,
-                                               strerror(ret));
+                               fprintf(stderr, "Error writing video frame %" 
B_PRId64 ": %s\n",
+                                       i, strerror(ret));
                                snprintf(status.LockBuffer(128), 128,
                                                B_TRANSLATE("Error writing 
video frame %" B_PRId64), i);
                                status.UnlockBuffer();


Other related posts:

  • » [haiku-commits] haiku: hrev48039 - in src: apps/mediaconverter add-ons/media/plugins/ffmpeg - pulkomandy