]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/atmo/AtmoExternalCaptureInput.cpp
atmo filter: disable until it is fixed
[vlc] / modules / video_filter / atmo / AtmoExternalCaptureInput.cpp
index 01071c60666f78b389daada264b82efb96987ae3..2df7ab7e443b9094e600e9f122792192a92d48ef 100644 (file)
 #include "AtmoExternalCaptureInput.h"
 #include "AtmoTools.h"
 
+#ifndef INT64_C
+#define INT64_C(c)  c ## LL
+#endif
+
 #if defined(_ATMO_VLC_PLUGIN_)
 
 CAtmoExternalCaptureInput::CAtmoExternalCaptureInput(CAtmoDynData *pAtmoDynData) :
@@ -18,8 +22,8 @@ CAtmoExternalCaptureInput::CAtmoExternalCaptureInput(CAtmoDynData *pAtmoDynData)
                            CThread(pAtmoDynData->getAtmoFilter())
 {
     m_pCurrentFramePixels = NULL;
-    vlc_cond_init( this->m_pAtmoThread, &m_WakeupCond );
-    vlc_mutex_init( m_pAtmoThread, &m_WakeupLock );
+    vlc_cond_init( &m_WakeupCond );
+    vlc_mutex_init( &m_WakeupLock );
     msg_Dbg( m_pAtmoThread, "CAtmoExternalCaptureInput created.");
 
 }
@@ -37,9 +41,8 @@ CAtmoExternalCaptureInput::CAtmoExternalCaptureInput(CAtmoDynData *pAtmoDynData)
 
 CAtmoExternalCaptureInput::~CAtmoExternalCaptureInput(void)
 {
-   /* if there is still an unprocessed bufferpicture do kill it */
-   if(m_pCurrentFramePixels != NULL)
-      free(m_pCurrentFramePixels);
+    /* if there is still an unprocessed bufferpicture do kill it */
+    free( m_pCurrentFramePixels );
 
 #if defined(_ATMO_VLC_PLUGIN_)
     vlc_cond_destroy( &m_WakeupCond );
@@ -103,6 +106,7 @@ void CAtmoExternalCaptureInput::DeliverNewSourceDataPaket(BITMAPINFOHEADER *bmpI
         memcpy(m_pCurrentFramePixels,pixelData,PixelDataSize);
     }
 #if defined(_ATMO_VLC_PLUGIN_)
+#error This makes no sense!
    vlc_mutex_lock( &m_WakeupLock );
    vlc_cond_signal( &m_WakeupCond );
    vlc_mutex_unlock( &m_WakeupLock );
@@ -126,8 +130,8 @@ DWORD CAtmoExternalCaptureInput::Execute(void)
 
     vlc_mutex_lock( &m_WakeupLock );
 
-    while ((this->m_bTerminated == ATMO_FALSE) && (this->m_pAtmoThread->b_die == false)) {
-          int value = vlc_cond_timedwait(&m_WakeupCond, &m_WakeupLock, mdate() + I64C(75000));
+    while ((this->m_bTerminated == ATMO_FALSE) && (!vlc_object_alive (this->m_pAtmoThread) == false)) {
+          int value = vlc_cond_timedwait(&m_WakeupCond, &m_WakeupLock, mdate() + INT64_C(75000));
           if(!value) {
              /* DeliverNewSourceDataPaket delivered new work for me... get it! */
              CalcColors(); // read picture and calculate colors
@@ -136,15 +140,6 @@ DWORD CAtmoExternalCaptureInput::Execute(void)
           i++;
           if(i == 100) {
              i = 0;
-#if !defined(WIN32)
-/* kludge for pthreads? using the same condition variable too often results in hanging the pthread
-   call inside vlc_cond_timedwait...
-*/
-#ifdef _ATMO_KLUDGE_
-             vlc_cond_destroy( &m_WakeupCond );
-             vlc_cond_init( m_pAtmoThread, &m_WakeupCond );
-#endif
-#endif
           }
     }
     vlc_mutex_unlock( &m_WakeupLock );
@@ -179,8 +174,10 @@ DWORD CAtmoExternalCaptureInput::Execute(void) {
 void CAtmoExternalCaptureInput::WaitForNextFrame(DWORD timeout)
 {
     this->m_FrameArrived = ATMO_FALSE;
+#error m_FrameArrived is not protected (no, volatile does not work)
     for(DWORD i=0;(i<timeout) && !m_FrameArrived;i++)
 #if defined (_ATMO_VLC_PLUGIN_)
+#error A condition variable or a semaphore is needed.
         msleep(1000);
 #else
         Sleep(1);