Commit c395d230 authored by Marton Balint's avatar Marton Balint

avdevice/decklink_enc: convert to std::atomic

Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent 7cfa98fd
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <atomic>
using std::atomic;
#include <DeckLinkAPI.h> #include <DeckLinkAPI.h>
#include <pthread.h> #include <pthread.h>
...@@ -28,7 +31,6 @@ extern "C" { ...@@ -28,7 +31,6 @@ extern "C" {
#include "libavformat/avformat.h" #include "libavformat/avformat.h"
#include "libavformat/internal.h" #include "libavformat/internal.h"
#include "libavutil/imgutils.h" #include "libavutil/imgutils.h"
#include "libavutil/atomic.h"
} }
#include "decklink_common.h" #include "decklink_common.h"
...@@ -60,10 +62,10 @@ public: ...@@ -60,10 +62,10 @@ public:
virtual HRESULT STDMETHODCALLTYPE GetAncillaryData(IDeckLinkVideoFrameAncillary **ancillary) { return S_FALSE; } virtual HRESULT STDMETHODCALLTYPE GetAncillaryData(IDeckLinkVideoFrameAncillary **ancillary) { return S_FALSE; }
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; } virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
virtual ULONG STDMETHODCALLTYPE AddRef(void) { return avpriv_atomic_int_add_and_fetch(&_refs, 1); } virtual ULONG STDMETHODCALLTYPE AddRef(void) { return ++_refs; }
virtual ULONG STDMETHODCALLTYPE Release(void) virtual ULONG STDMETHODCALLTYPE Release(void)
{ {
int ret = avpriv_atomic_int_add_and_fetch(&_refs, -1); int ret = --_refs;
if (!ret) { if (!ret) {
av_frame_free(&_avframe); av_frame_free(&_avframe);
delete this; delete this;
...@@ -75,7 +77,7 @@ public: ...@@ -75,7 +77,7 @@ public:
AVFrame *_avframe; AVFrame *_avframe;
private: private:
volatile int _refs; std::atomic<int> _refs;
}; };
class decklink_output_callback : public IDeckLinkVideoOutputCallback class decklink_output_callback : public IDeckLinkVideoOutputCallback
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment