[haiku-commits] haiku: hrev50639 - src/add-ons/media/plugins/ffmpeg

  • From: jerome.duval@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 31 Oct 2016 09:49:15 +0100 (CET)

hrev50639 adds 1 changeset to branch 'master'
old head: 905ee3fb8fde036bd8233479ca7b82df069bf62f
new head: 7af63063bb1d7f6c510144805d43bb89fdf61a82
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=7af63063bb1d+%5E905ee3fb8fde

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

7af63063bb1d: media/ffmpeg: skips libswr, and interleaves samples for planar 
audio.
  
  * workaround for #12720.

                                   [ Jérôme Duval <jerome.duval@xxxxxxxxx> ]

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

Revision:    hrev50639
Commit:      7af63063bb1d7f6c510144805d43bb89fdf61a82
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7af63063bb1d
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Mon Oct 31 08:07:53 2016 UTC

Ticket:      https://dev.haiku-os.org/ticket/12720

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

1 file changed, 16 insertions(+)
src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp | 16 ++++++++++++++++

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

diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp 
b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
index 27ec813..2b219f9 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
@@ -928,6 +928,7 @@ 
AVCodecDecoder::_MoveAudioFramesToRawDecodedAudioAndUpdateStartTimes()
        // "planar" audio (each channel separated instead of interleaved 
samples).
        // In that case, we use swresample to convert the data
        if (av_sample_fmt_is_planar(fContext->sample_fmt)) {
+#if 0
                const uint8_t* ptr[8];
                for (int i = 0; i < 8; i++) {
                        if (fDecodedDataBuffer->data[i] == NULL)
@@ -950,6 +951,21 @@ 
AVCodecDecoder::_MoveAudioFramesToRawDecodedAudioAndUpdateStartTimes()
 
                if (frames < 0)
                        debugger("resampling failed");
+#else
+               // interleave planar audio with same format
+               uintptr_t out = (uintptr_t)fRawDecodedAudio->data[0];
+               int32 offset = fDecodedDataBufferOffset;
+               for (int i = 0; i < frames; i++) {
+                       for (int j = 0; j < fContext->channels; j++) {
+                               memcpy((void*)out, fDecodedDataBuffer->data[j]
+                                       + offset, fInputFrameSize);
+                               out += fInputFrameSize;
+                       }
+                       offset += fInputFrameSize;
+               }
+               outFrames = frames;
+               inFrames = frames;
+#endif
        } else {
                memcpy(fRawDecodedAudio->data[0], fDecodedDataBuffer->data[0]
                                + fDecodedDataBufferOffset, frames * 
fOutputFrameSize);


Other related posts:

  • » [haiku-commits] haiku: hrev50639 - src/add-ons/media/plugins/ffmpeg - jerome . duval