[haiku-commits] haiku: hrev52358 - in src: add-ons/media/plugins/ffmpeg system/kernel/posix system/kernel/arch/x86 apps/mediaplayer/media_node_framework/video

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 23 Sep 2018 17:37:04 -0400 (EDT)

hrev52358 adds 8 changesets to branch 'master'
old head: 7d8b7501ba0bab073c8e173bf78e79c1bcd0a257
new head: 6c73846a038555f531ec37f16204ca90d40f64ad
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=6c73846a0385+%5E7d8b7501ba0b

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

c609f04f86a9: kernel: Print interrupt line when assuming no interrupt use on 
PCI device.

80be7d09c57f: kernel: Handle the user buffers properly in _user_xsi_semctl.
  
  Should fix #14512.

3e4c34234e32: demangle/gcc2: Skip count > length should skip to the end.
  
  This is the behavior the code expects.

19ec89726602: add-ons/media/ffmpeg: Enable deprecation warnings.
  
  There sure are a lot of them...

17c276df2106: add-ons/media/ffmpeg: Remove global initializer system.
  
  All of the functions it calls are deprecated and no longer needed,
  as FFmpeg loads all codecs automatically now, and uses pthreads internally
  for locking as needed.

e5bb653b7895: add-ons/media/ffmpeg: Rework usage of AVPicture in AVCodecDecoder.
  
  It has been deprecated since FFmpeg ~3.0, and is internally implemented
  using these functions now, so this should largely be a no-op change.
  
  AVCodecEncoder still uses it.

1fb7ddbb1e47: add-ons/media/ffmpeg: Use SWS for color-space conversion 
universally.
  
  It seems to be as if not faster than the built-in method now as far
  as I can tell, and this means one less arch-specific difference.
  I haven't ripped all of it out yet, though.

6c73846a0385: MediaPlayer: Quit the VideoProducer when we reach the last buffer.
  
  Fixes #13622.
  
  The "media_node_framework" is such a huge mess. We really should sit down
  and design a MediaKit2 someday that doesn't require ~15,000 lines of media
  node support code just to have a "fully functioning media player."

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

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

11 files changed, 60 insertions(+), 122 deletions(-)
src/add-ons/kernel/debugger/demangle/gcc2.cpp    |  2 +
.../media/plugins/ffmpeg/AVCodecDecoder.cpp      | 24 ++++----
.../media/plugins/ffmpeg/AVCodecDecoder.h        |  7 ++-
.../media/plugins/ffmpeg/FFmpegPlugin.cpp        | 60 --------------------
src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h  |  9 ---
src/add-ons/media/plugins/ffmpeg/Jamfile         | 18 +++---
src/add-ons/media/plugins/ffmpeg/gfx_util.cpp    |  6 +-
.../media_node_framework/video/VideoProducer.cpp |  5 +-
src/system/kernel/arch/x86/irq_routing_table.cpp |  4 +-
src/system/kernel/posix/xsi_semaphore.cpp        | 45 ++++++++-------
.../add-ons/kernel/debugger/DemangleTest.cpp     |  2 +-

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

Commit:      c609f04f86a93cc07d562cedb6e53bfee7d862f8
URL:         https://git.haiku-os.org/haiku/commit/?id=c609f04f86a9
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Sep 23 18:19:25 2018 UTC

kernel: Print interrupt line when assuming no interrupt use on PCI device.

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

diff --git a/src/system/kernel/arch/x86/irq_routing_table.cpp 
b/src/system/kernel/arch/x86/irq_routing_table.cpp
index 578896baef..269041592d 100644
--- a/src/system/kernel/arch/x86/irq_routing_table.cpp
+++ b/src/system/kernel/arch/x86/irq_routing_table.cpp
@@ -584,8 +584,8 @@ ensure_all_functions_matched(pci_module_info* pci, uint8 
bus,
                                // (PCI Local Bus spec 3.0, section 6.2.4 / 
page 223, footnote.)
                                if (interrupt_line == 0 || interrupt_line == 
255) {
                                        dprintf("assuming no interrupt use on 
PCI device"
-                                               " %u:%u:%u (bios irq 0, no 
routing information)\n",
-                                               bus, device, function);
+                                               " %u:%u:%u (bios irq 0, 
interrupt line %" B_PRId32 ")\n",
+                                               bus, device, function, 
interrupt_line);
                                        continue;
                                }
 

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

Commit:      80be7d09c57fa7a7a00ca1a4ac48a5ee891854fa
URL:         https://git.haiku-os.org/haiku/commit/?id=80be7d09c57f
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Sep 23 18:45:01 2018 UTC

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

kernel: Handle the user buffers properly in _user_xsi_semctl.

Should fix #14512.

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

diff --git a/src/system/kernel/posix/xsi_semaphore.cpp 
b/src/system/kernel/posix/xsi_semaphore.cpp
index 8938cfa7e3..f4f4a2ea9a 100644
--- a/src/system/kernel/posix/xsi_semaphore.cpp
+++ b/src/system/kernel/posix/xsi_semaphore.cpp
@@ -832,10 +832,18 @@ _user_xsi_semget(key_t key, int numberOfSemaphores, int 
flags)
 
 int
 _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
-       union semun *args)
+       union semun *_args)
 {
        TRACE(("xsi_semctl: semaphoreID = %d, semaphoreNumber = %d, command = 
%d\n",
                semaphoreID, semaphoreNumber, command));
+
+       union semun args = {0};
+       if (_args != NULL) {
+               if (!IS_USER_ADDRESS(_args)
+                               || user_memcpy(&args, _args, sizeof(union 
semun)) != B_OK)
+                       return B_BAD_ADDRESS;
+       }
+
        MutexLocker ipcHashLocker(sIpcLock);
        MutexLocker setHashLocker(sXsiSemaphoreSetLock);
        XsiSemaphoreSet *semaphoreSet = sSemaphoreHashTable.Lookup(semaphoreID);
@@ -850,10 +858,6 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int 
command,
                        "semaphore %d\n", semaphoreNumber, semaphoreID));
                return EINVAL;
        }
-       if (args != 0 && !IS_USER_ADDRESS(args)) {
-               TRACE_ERROR(("xsi_semctl: semun address is not valid\n"));
-               return B_BAD_ADDRESS;
-       }
 
        // Lock the semaphore set itself and release both the semaphore
        // set hash table lock and the ipc hash table lock _only_ if
@@ -865,11 +869,12 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, 
int command,
                setLocker.SetTo(&semaphoreSet->Lock(), false);
                setHashLocker.Unlock();
                ipcHashLocker.Unlock();
-       } else
+       } else {
                // We are about to delete the set along with its mutex, so
                // we can't use the MutexLocker class, as the mutex itself
                // won't exist on function exit
                mutex_lock(&semaphoreSet->Lock());
+       }
 
        int result = 0;
        XsiSemaphore *semaphore = semaphoreSet->Semaphore(semaphoreNumber);
@@ -892,15 +897,11 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, 
int command,
                                        (int)semaphoreSet->IpcKey()));
                                result = EACCES;
                        } else {
-                               int value;
-                               if (user_memcpy(&value, &args->val, 
sizeof(int)) < B_OK) {
-                                       TRACE_ERROR(("xsi_semctl: user_memcpy 
failed\n"));
-                                       result = B_BAD_ADDRESS;
-                               } else if (value > USHRT_MAX) {
-                                       TRACE_ERROR(("xsi_semctl: value %d out 
of range\n", value));
+                               if (args.val > USHRT_MAX) {
+                                       TRACE_ERROR(("xsi_semctl: value %d out 
of range\n", args.val));
                                        result = ERANGE;
                                } else {
-                                       semaphore->SetValue(value);
+                                       semaphore->SetValue(args.val);
                                        
semaphoreSet->ClearUndo(semaphoreNumber);
                                }
                        }
@@ -950,8 +951,8 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int 
command,
                                for (int i = 0; i < 
semaphoreSet->NumberOfSemaphores(); i++) {
                                        semaphore = semaphoreSet->Semaphore(i);
                                        unsigned short value = 
semaphore->Value();
-                                       if (user_memcpy(&args->array[i], &value,
-                                               sizeof(unsigned short)) < B_OK) 
{
+                                       if (user_memcpy(args.array + i, &value,
+                                                       sizeof(unsigned short)) 
!= B_OK) {
                                                TRACE_ERROR(("xsi_semctl: 
user_memcpy failed\n"));
                                                result = B_BAD_ADDRESS;
                                                break;
@@ -971,8 +972,8 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int 
command,
                                for (int i = 0; i < 
semaphoreSet->NumberOfSemaphores(); i++) {
                                        semaphore = semaphoreSet->Semaphore(i);
                                        unsigned short value;
-                                       if (user_memcpy(&value, 
&args->array[i], sizeof(unsigned short))
-                                               < B_OK) {
+                                       if (user_memcpy(&value, args.array + i,
+                                                       sizeof(unsigned short)) 
!= B_OK) {
                                                TRACE_ERROR(("xsi_semctl: 
user_memcpy failed\n"));
                                                result = B_BAD_ADDRESS;
                                                doClear = false;
@@ -998,8 +999,8 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int 
command,
                                sem.sem_nsems = 
semaphoreSet->NumberOfSemaphores();
                                sem.sem_otime = semaphoreSet->LastSemopTime();
                                sem.sem_ctime = semaphoreSet->LastSemctlTime();
-                               if (user_memcpy(args->buf, &sem, sizeof(struct 
semid_ds))
-                                       < B_OK) {
+                               if (user_memcpy(args.buf, &sem, sizeof(struct 
semid_ds))
+                                               < B_OK) {
                                        TRACE_ERROR(("xsi_semctl: user_memcpy 
failed\n"));
                                        result = B_BAD_ADDRESS;
                                }
@@ -1015,8 +1016,8 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, 
int command,
                                result = EACCES;
                        } else {
                                struct semid_ds sem;
-                               if (user_memcpy(&sem, args->buf, sizeof(struct 
semid_ds))
-                                       < B_OK) {
+                               if (user_memcpy(&sem, args.buf, sizeof(struct 
semid_ds))
+                                               != B_OK) {
                                        TRACE_ERROR(("xsi_semctl: user_memcpy 
failed\n"));
                                        result = B_BAD_ADDRESS;
                                } else
@@ -1105,7 +1106,7 @@ _user_xsi_semop(int semaphoreID, struct sembuf *ops, 
size_t numOps)
        MemoryDeleter operationsDeleter(operations);
 
        if (user_memcpy(operations, ops,
-               (sizeof(struct sembuf) * numOps)) < B_OK) {
+                       (sizeof(struct sembuf) * numOps)) != B_OK) {
                TRACE_ERROR(("xsi_semop: user_memcpy failed\n"));
                return B_BAD_ADDRESS;
        }

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

Commit:      3e4c34234e32324de533a1134e2d5fdd83795ce4
URL:         https://git.haiku-os.org/haiku/commit/?id=3e4c34234e32
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Sep 23 18:47:26 2018 UTC

demangle/gcc2: Skip count > length should skip to the end.

This is the behavior the code expects.

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

diff --git a/src/add-ons/kernel/debugger/demangle/gcc2.cpp 
b/src/add-ons/kernel/debugger/demangle/gcc2.cpp
index 1c1f24252e..9c09456ea5 100644
--- a/src/add-ons/kernel/debugger/demangle/gcc2.cpp
+++ b/src/add-ons/kernel/debugger/demangle/gcc2.cpp
@@ -49,6 +49,8 @@ public:
        {
                if (count > fLength) {
                        TRACE("Input::Skip(): fOffset > fLength\n");
+                       fString += fLength;
+                       fLength = 0;
                        return;
                }
 
diff --git a/src/tests/add-ons/kernel/debugger/DemangleTest.cpp 
b/src/tests/add-ons/kernel/debugger/DemangleTest.cpp
index 7d82f65fc3..c485490ca9 100644
--- a/src/tests/add-ons/kernel/debugger/DemangleTest.cpp
+++ b/src/tests/add-ons/kernel/debugger/DemangleTest.cpp
@@ -37,7 +37,7 @@ DemangleTest::RunGCC2Tests()
                
"registerInstance__Q26icu_5713BreakIteratorPQ26icu_5713BreakIteratorRCQ26icu_576Locale18UBreakIteratorTypeR10UErrorCode");
 
        // Previously caused crashes
-       TEST("SetTo__Q282_GLOBAL_", "SetTo__Q282_GLOBAL_");
+       TEST("SetTo__Q282_GLOBAL_", "_GLOBAL_::SetTo()");
 }
 
 

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

Commit:      19ec89726602d1dc508b40ec7299889ba723b84f
URL:         https://git.haiku-os.org/haiku/commit/?id=19ec89726602
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Sep 23 19:57:40 2018 UTC

add-ons/media/ffmpeg: Enable deprecation warnings.

There sure are a lot of them...

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

diff --git a/src/add-ons/media/plugins/ffmpeg/Jamfile 
b/src/add-ons/media/plugins/ffmpeg/Jamfile
index 6003dcfed2..907a268aa3 100644
--- a/src/add-ons/media/plugins/ffmpeg/Jamfile
+++ b/src/add-ons/media/plugins/ffmpeg/Jamfile
@@ -5,7 +5,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ;
 UsePrivateHeaders media shared ;
 UsePrivateHeaders [ FDirName media experimental ] ;
 
-SubDirC++Flags -D__STDC_CONSTANT_MACROS -Wno-deprecated-declarations ;
+SubDirC++Flags -D__STDC_CONSTANT_MACROS -Wdeprecated ;
 
 local sources =
        AVCodecDecoder.cpp

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

Commit:      17c276df2106c10dd5703f7b624e74a8e57eaae1
URL:         https://git.haiku-os.org/haiku/commit/?id=17c276df2106
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Sep 23 19:58:28 2018 UTC

add-ons/media/ffmpeg: Remove global initializer system.

All of the functions it calls are deprecated and no longer needed,
as FFmpeg loads all codecs automatically now, and uses pthreads internally
for locking as needed.

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

diff --git a/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.cpp 
b/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.cpp
index b1545ef18b..8e84c68b63 100644
--- a/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.cpp
@@ -16,8 +16,6 @@
 
 #include <new>
 
-#include <Locker.h>
-
 extern "C" {
        #include "avcodec.h"
        #include "avformat.h"
@@ -42,64 +40,6 @@ extern "C" {
 #define ERROR(a...) fprintf(stderr, a)
 
 
-static int
-manage_locks(void** _lock, enum AVLockOp operation)
-{
-       TRACE("manage_locks(%p, %d)\n", *_lock, operation);
-
-       BLocker** lock = reinterpret_cast<BLocker**>(_lock);
-
-       switch (operation) {
-               case AV_LOCK_CREATE:
-                       TRACE("  AV_LOCK_CREATE\n");
-                       *lock = new(std::nothrow) BLocker("FFmpeg lock");
-                       if (*lock == NULL)
-                               return 1;
-                       break;
-
-               case AV_LOCK_OBTAIN:
-                       TRACE("  AV_LOCK_OBTAIN\n");
-                       if (!(*lock)->Lock())
-                               return 1;
-                       break;
-
-               case AV_LOCK_RELEASE:
-                       TRACE("  AV_LOCK_RELEASE\n");
-                       (*lock)->Unlock();
-                       break;
-
-               case AV_LOCK_DESTROY:
-                       TRACE("  AV_LOCK_DESTROY\n");
-                       delete *lock;
-                       break;
-
-               default:
-                       return 1;
-       }
-       return 0;
-}
-
-
-FFmpegPlugin::GlobalInitilizer::GlobalInitilizer()
-{
-       if (av_lockmgr_register(manage_locks) != 0)
-               ERROR("Failed to register lock management!\n");
-
-       av_register_all();
-               // This will also call av_codec_init() by registering codecs.
-       avfilter_register_all();
-}
-
-
-FFmpegPlugin::GlobalInitilizer::~GlobalInitilizer()
-{
-       av_lockmgr_register(NULL);
-}
-
-
-FFmpegPlugin::GlobalInitilizer FFmpegPlugin::sInitilizer;
-
-
 // #pragma mark -
 
 
diff --git a/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h 
b/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
index 3013472319..66c0935750 100644
--- a/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
+++ b/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
@@ -42,15 +42,6 @@ public:
                                                                        
media_format_family* formatFamily,
                                                                        
media_format* inputFormat,
                                                                        
media_format* outputFormat);
-
-private:
-       class GlobalInitilizer {
-               public:
-                                                               
GlobalInitilizer();
-                                                               
~GlobalInitilizer();
-       };
-
-       static  GlobalInitilizer        sInitilizer;
 };
 
 

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

Commit:      e5bb653b789555e975cb5a675496372c39263b44
URL:         https://git.haiku-os.org/haiku/commit/?id=e5bb653b7895
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Sep 23 19:59:36 2018 UTC

add-ons/media/ffmpeg: Rework usage of AVPicture in AVCodecDecoder.

It has been deprecated since FFmpeg ~3.0, and is internally implemented
using these functions now, so this should largely be a no-op change.

AVCodecEncoder still uses it.

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

diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp 
b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
index 1c781026c4..12f8d36cb9 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.cpp
@@ -1570,9 +1570,9 @@ AVCodecDecoder::_UpdateMediaHeaderForVideoFrame()
        fHeader.file_pos = 0;
        fHeader.orig_size = 0;
        fHeader.start_time = fRawDecodedPicture->pkt_dts;
-       fHeader.size_used = avpicture_get_size(
+       fHeader.size_used = av_image_get_buffer_size(
                colorspace_to_pixfmt(fOutputColorSpace), 
fRawDecodedPicture->width,
-               fRawDecodedPicture->height);
+               fRawDecodedPicture->height, 1);
        fHeader.u.raw_video.display_line_width = fRawDecodedPicture->width;
        fHeader.u.raw_video.display_line_count = fRawDecodedPicture->height;
        fHeader.u.raw_video.bytes_per_row
@@ -1622,11 +1622,11 @@ AVCodecDecoder::_DeinterlaceAndColorConvertVideoFrame()
 {
        int displayWidth = fRawDecodedPicture->width;
        int displayHeight = fRawDecodedPicture->height;
-       AVPicture deinterlacedPicture;
+       AVFrame deinterlacedPicture;
        bool useDeinterlacedPicture = false;
 
        if (fRawDecodedPicture->interlaced_frame) {
-               AVPicture rawPicture;
+               AVFrame rawPicture;
                rawPicture.data[0] = fRawDecodedPicture->data[0];
                rawPicture.data[1] = fRawDecodedPicture->data[1];
                rawPicture.data[2] = fRawDecodedPicture->data[2];
@@ -1636,12 +1636,14 @@ AVCodecDecoder::_DeinterlaceAndColorConvertVideoFrame()
                rawPicture.linesize[2] = fRawDecodedPicture->linesize[2];
                rawPicture.linesize[3] = fRawDecodedPicture->linesize[3];
 
-               avpicture_alloc(&deinterlacedPicture, fCodecContext->pix_fmt, 
displayWidth,
-                       displayHeight);
+               if (av_image_alloc(deinterlacedPicture.data,
+                               deinterlacedPicture.linesize, displayWidth, 
displayHeight,
+                               fCodecContext->pix_fmt, 1) < 0)
+                       return B_NO_MEMORY;
 
                // deinterlace implemented using avfilter
                _ProcessFilterGraph(&deinterlacedPicture, &rawPicture,
-                               fCodecContext->pix_fmt, displayWidth, 
displayHeight);
+                       fCodecContext->pix_fmt, displayWidth, displayHeight);
                useDeinterlacedPicture = true;
        }
 
@@ -1717,7 +1719,7 @@ AVCodecDecoder::_DeinterlaceAndColorConvertVideoFrame()
        }
 
        if (fRawDecodedPicture->interlaced_frame)
-               avpicture_free(&deinterlacedPicture);
+               av_freep(&deinterlacedPicture.data[0]);
 
        return B_OK;
 }
@@ -1787,7 +1789,7 @@ AVCodecDecoder::_InitFilterGraph(enum AVPixelFormat 
pixfmt, int32 width,
        \returns B_NO_MEMORY Not enough memory available for correct operation.
 */
 status_t
-AVCodecDecoder::_ProcessFilterGraph(AVPicture *dst, const AVPicture *src,
+AVCodecDecoder::_ProcessFilterGraph(AVFrame *dst, const AVFrame *src,
        enum AVPixelFormat pixfmt, int32 width, int32 height)
 {
        if (fFilterGraph == NULL || width != fLastWidth
@@ -1812,8 +1814,8 @@ AVCodecDecoder::_ProcessFilterGraph(AVPicture *dst, const 
AVPicture *src,
        if (ret < 0)
                return B_BAD_DATA;
 
-       av_picture_copy(dst, (const AVPicture *)fFilterFrame, pixfmt, width,
-               height);
+       av_image_copy(dst->data, dst->linesize, (const 
uint8**)fFilterFrame->data,
+               fFilterFrame->linesize, pixfmt, width, height);
        av_frame_unref(fFilterFrame);
        return B_OK;
 }
diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h 
b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
index 43a95b3d0f..9319ca937d 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
@@ -22,6 +22,7 @@ extern "C" {
        #include "avfilter.h"
        #include "buffersink.h"
        #include "buffersrc.h"
+       #include "imgutils.h"
        #include "swresample.h"
        #include "swscale.h"
 }
@@ -101,8 +102,8 @@ private:
                        // video deinterlace filter graph
                        status_t        _InitFilterGraph(enum AVPixelFormat 
pixfmt,
                                                        int32 width, int32 
height);
-                       status_t        _ProcessFilterGraph(AVPicture *dst,
-                                                       const AVPicture *src, 
enum AVPixelFormat pixfmt,
+                       status_t        _ProcessFilterGraph(AVFrame *dst,
+                                                       const AVFrame *src, 
enum AVPixelFormat pixfmt,
                                                        int32 width, int32 
height);
 
                        media_header            fHeader;

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

Commit:      1fb7ddbb1e477540ade98c43015492c2411315e4
URL:         https://git.haiku-os.org/haiku/commit/?id=1fb7ddbb1e47
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Sep 23 20:05:45 2018 UTC

add-ons/media/ffmpeg: Use SWS for color-space conversion universally.

It seems to be as if not faster than the built-in method now as far
as I can tell, and this means one less arch-specific difference.
I haven't ripped all of it out yet, though.

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

diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h 
b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
index 9319ca937d..52b8e40132 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
@@ -35,7 +35,7 @@ extern "C" {
 #include "gfx_util.h"
 
 
-#ifdef __x86_64
+#if 1
 #define USE_SWS_FOR_COLOR_SPACE_CONVERSION 1
 #else
 #define USE_SWS_FOR_COLOR_SPACE_CONVERSION 0
diff --git a/src/add-ons/media/plugins/ffmpeg/Jamfile 
b/src/add-ons/media/plugins/ffmpeg/Jamfile
index 907a268aa3..ebac868479 100644
--- a/src/add-ons/media/plugins/ffmpeg/Jamfile
+++ b/src/add-ons/media/plugins/ffmpeg/Jamfile
@@ -24,14 +24,14 @@ local sources =
        gfx_util.cpp
        ;
 
-if $(TARGET_ARCH) != x86_64 {
-       sources +=
-               gfx_conv_mmx.cpp
-               yuvrgb_sse.nasm
-               yuvrgb_sse2.nasm
-               yuvrgb_ssse3.nasm
-       ;
-}
+#if $(TARGET_ARCH) != x86_64 {
+#      sources +=
+#              gfx_conv_mmx.cpp
+#              yuvrgb_sse.nasm
+#              yuvrgb_sse2.nasm
+#              yuvrgb_ssse3.nasm
+#      ;
+#}
 
 local architectureObject ;
 for architectureObject in [ MultiArchSubDirSetup ] {
diff --git a/src/add-ons/media/plugins/ffmpeg/gfx_util.cpp 
b/src/add-ons/media/plugins/ffmpeg/gfx_util.cpp
index f641744d34..9bb570dbed 100644
--- a/src/add-ons/media/plugins/ffmpeg/gfx_util.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/gfx_util.cpp
@@ -46,7 +46,7 @@ resolve_colorspace(color_space colorSpace, AVPixelFormat 
pixelFormat, int width,
 
                        if (pixelFormat == AV_PIX_FMT_YUV420P
                                || pixelFormat == AV_PIX_FMT_YUVJ420P) {
-#ifndef __x86_64__
+#if 0
                                if (cpu.HasSSSE3() && width % 8 == 0 && height 
% 2 == 0) {
                                        TRACE("resolve_colorspace: 
gfx_conv_yuv420p_rgba32_ssse3\n");
                                        return gfx_conv_yuv420p_rgba32_ssse3;
@@ -65,7 +65,7 @@ resolve_colorspace(color_space colorSpace, AVPixelFormat 
pixelFormat, int width,
 
                        if (pixelFormat == AV_PIX_FMT_YUV422P
                                || pixelFormat == AV_PIX_FMT_YUVJ422P) {
-#ifndef __x86_64__
+#if 0
                                if (cpu.HasSSSE3() && width % 8 == 0) {
                                        TRACE("resolve_colorspace: 
gfx_conv_yuv422p_RGB32_ssse3\n");
                                        return gfx_conv_yuv422p_rgba32_ssse3;
@@ -87,7 +87,7 @@ resolve_colorspace(color_space colorSpace, AVPixelFormat 
pixelFormat, int width,
 
                        // Packed Formats
                        if (pixelFormat == AV_PIX_FMT_YUYV422) {
-#ifndef __x86_64__
+#if 0
                                if (cpu.HasSSSE3() && width % 8 == 0) {
                                        return gfx_conv_yuv422_rgba32_ssse3;
                                } else if (cpu.HasSSE2() && width % 8 == 0) {

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

Revision:    hrev52358
Commit:      6c73846a038555f531ec37f16204ca90d40f64ad
URL:         https://git.haiku-os.org/haiku/commit/?id=6c73846a0385
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Sep 23 20:55:54 2018 UTC

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

MediaPlayer: Quit the VideoProducer when we reach the last buffer.

Fixes #13622.

The "media_node_framework" is such a huge mess. We really should sit down
and design a MediaKit2 someday that doesn't require ~15,000 lines of media
node support code just to have a "fully functioning media player."

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

diff --git a/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp 
b/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp
index 774dfc3ed2..a5fb4a1209 100644
--- a/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp
+++ b/src/apps/mediaplayer/media_node_framework/video/VideoProducer.cpp
@@ -762,12 +762,13 @@ VideoProducer::_FrameGeneratorThread()
                                                err = B_OK;
                                        }
                                        // clean the buffer if something went 
wrong
-                                       if (err != B_OK) {
+                                       if (err != B_OK && err != 
B_LAST_BUFFER_ERROR) {
                                                // TODO: should use "back 
value" according
                                                // to color space!
                                                memset(buffer->Data(), 0, 
h->size_used);
                                                err = B_OK;
-                                       }
+                                       } else if (err == B_LAST_BUFFER_ERROR)
+                                               running = false;
                                        // Send the buffer on down to the 
consumer
                                        if (wasCached || (err = 
SendBuffer(buffer, fOutput.source,
                                                        fOutput.destination) != 
B_OK)) {


Other related posts:

  • » [haiku-commits] haiku: hrev52358 - in src: add-ons/media/plugins/ffmpeg system/kernel/posix system/kernel/arch/x86 apps/mediaplayer/media_node_framework/video - waddlesplash