• Aaron Levinson's avatar
    avdevice/decklink: remove pthread dependency · 9e86a618
    Aaron Levinson authored
    Purpose: avdevice/decklink: Removed pthread dependency by replacing
    semaphore used in code appropriately.  Doing so makes it easier to
    build ffmpeg using Visual C++ on Windows.  This is a contination of
    Kyle Schwarz's "avdevice/decklink: Remove pthread dependency" patch
    that is available at https://patchwork.ffmpeg.org/patch/2654/ .  This
    patch wasn't accepted, and as far as I can tell, there was no
    follow-up after it was rejected.
    
    Notes: Used Visual Studio 2015 (with update 3) for this.
    
    Comments:
    
    -- configure: Eliminated pthreads dependency for decklink_indev_deps
       and decklink_outdev_deps and replaced with threads dependency
    
    -- libavdevice/decklink_common.cpp / .h:
    a) Eliminated semaphore and replaced with a combination of a mutex,
       condition variable, and a counter (frames_buffer_available_spots).
    b) Removed include of pthread.h and semaphore.h and now using
       libavutil/thread.h instead.
    
    -- libavdevice/decklink_dec.cpp: Eliminated include of pthread.h and
       semaphore.h.
    
    -- libavdevice/decklink_enc.cpp:
    a) Eliminated include of pthread.h and semaphore.h.
    b) Replaced use of semaphore with the equivalent using a combination
       of a mutex, condition variable, and a counter
       (frames_buffer_available_spots).  In theory, libavutil/thread.h and
       the associated code could have been modified instead to add
       cross-platform implementations of the sem_ functions, but an
       inspection of the ffmpeg source base indicates that there are only
       two cases in which semaphores are used (including this one that was
       replaced), so it was deemed to not be worth the effort.
    Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
    9e86a618
decklink_common.h 4.1 KB