Skip to content
This repository
Browse code

Merge pull request #3384 from popcornmix/omxcorecleanup

[rbp/omxplayer] OMXCore tidying
  • Loading branch information...
commit a451f13bf49617446e2bd1581c62b5b4c2d83a6c 2 parents 947f666 + 7d20816
huceke authored October 06, 2013
349  xbmc/linux/OMXCore.cpp
@@ -32,6 +32,7 @@
32 32
 #include "utils/log.h"
33 33
 
34 34
 #include "OMXClock.h"
  35
+#include "xbmc/linux/RBP.h"
35 36
 
36 37
 #ifdef TARGET_LINUX
37 38
 #include "XMemUtils.h"
@@ -46,13 +47,13 @@
46 47
 
47 48
 static void add_timespecs(struct timespec &time, long millisecs)
48 49
 {
49  
-   time.tv_sec  += millisecs / 1000;
50  
-   time.tv_nsec += (millisecs % 1000) * 1000000;
51  
-   if (time.tv_nsec > 1000000000)
  50
+   long long nsec = time.tv_nsec + (long long)millisecs * 1000000;
  51
+   while (nsec > 1000000000)
52 52
    {
53  
-      time.tv_sec  += 1;
54  
-      time.tv_nsec -= 1000000000;
  53
+      time.tv_sec += 1;
  54
+      nsec -= 1000000000;
55 55
    }
  56
+   time.tv_nsec = nsec;
56 57
 }
57 58
 
58 59
 
@@ -64,22 +65,12 @@ COMXCoreTunel::COMXCoreTunel()
64 65
   m_dst_port            = 0;
65 66
   m_portSettingsChanged = false;
66 67
   m_tunnel_set          = false;
67  
-  m_DllOMX              = new DllOMX();
68  
-
69  
-  if(m_DllOMX)
70  
-    m_DllOMXOpen        = m_DllOMX->Load();
71  
-  else
72  
-    m_DllOMXOpen        = false;
73  
-
  68
+  m_DllOMX              = g_RBP.GetDllOMX();
74 69
   pthread_mutex_init(&m_lock, NULL);
75 70
 }
76 71
 
77 72
 COMXCoreTunel::~COMXCoreTunel()
78 73
 {
79  
-  if(m_DllOMXOpen)
80  
-    m_DllOMX->Unload();
81  
-  delete m_DllOMX;
82  
-
83 74
   pthread_mutex_destroy(&m_lock);
84 75
 }
85 76
 
@@ -95,8 +86,6 @@ void COMXCoreTunel::UnLock()
95 86
 
96 87
 void COMXCoreTunel::Initialize(COMXCoreComponent *src_component, unsigned int src_port, COMXCoreComponent *dst_component, unsigned int dst_port)
97 88
 {
98  
-  if(!m_DllOMXOpen)
99  
-    return;
100 89
   m_src_component  = src_component;
101 90
   m_src_port    = src_port;
102 91
   m_dst_component  = dst_component;
@@ -110,7 +99,7 @@ bool COMXCoreTunel::IsInitialized()
110 99
 
111 100
 OMX_ERRORTYPE COMXCoreTunel::Flush()
112 101
 {
113  
-  if(!m_DllOMXOpen || !m_src_component || !m_dst_component || !m_tunnel_set || !IsInitialized())
  102
+  if(!m_src_component || !m_dst_component || !m_tunnel_set || !IsInitialized())
114 103
     return OMX_ErrorUndefined;
115 104
 
116 105
   Lock();
@@ -149,9 +138,6 @@ OMX_ERRORTYPE COMXCoreTunel::Flush()
149 138
 
150 139
 OMX_ERRORTYPE COMXCoreTunel::Deestablish(bool noWait)
151 140
 {
152  
-  if(!m_DllOMXOpen)
153  
-    return OMX_ErrorUndefined;
154  
-
155 141
   if(!m_src_component || !m_dst_component || !IsInitialized())
156 142
     return OMX_ErrorUndefined;
157 143
 
@@ -211,9 +197,6 @@ OMX_ERRORTYPE COMXCoreTunel::Deestablish(bool noWait)
211 197
 
212 198
 OMX_ERRORTYPE COMXCoreTunel::Establish(bool portSettingsChanged, bool enable_ports /* = true */)
213 199
 {
214  
-  if(!m_DllOMXOpen)
215  
-    return OMX_ErrorUndefined;
216  
-
217 200
   Lock();
218 201
 
219 202
   OMX_ERRORTYPE omx_err = OMX_ErrorNone;
@@ -319,7 +302,7 @@ OMX_ERRORTYPE COMXCoreTunel::Establish(bool portSettingsChanged, bool enable_por
319 302
       UnLock();
320 303
       return omx_err;
321 304
     }
322  
-    
  305
+
323 306
     if(m_dst_component->GetState() == OMX_StateLoaded)
324 307
     {
325 308
       omx_err = m_dst_component->SetStateForComponent(OMX_StateIdle);
@@ -373,6 +356,9 @@ COMXCoreComponent::COMXCoreComponent()
373 356
 
374 357
   m_exit = false;
375 358
 
  359
+  m_omx_input_use_buffers  = false;
  360
+  m_omx_output_use_buffers = false;
  361
+
376 362
   pthread_mutex_init(&m_omx_input_mutex, NULL);
377 363
   pthread_mutex_init(&m_omx_output_mutex, NULL);
378 364
   pthread_mutex_init(&m_omx_event_mutex, NULL);
@@ -381,15 +367,7 @@ COMXCoreComponent::COMXCoreComponent()
381 367
   pthread_cond_init(&m_output_buffer_cond, NULL);
382 368
   pthread_cond_init(&m_omx_event_cond, NULL);
383 369
 
384  
-  m_omx_input_use_buffers  = false;
385  
-  m_omx_output_use_buffers = false;
386  
-
387  
-  m_DllOMX = new DllOMX();
388  
-
389  
-  if(m_DllOMX)
390  
-    m_DllOMXOpen = m_DllOMX->Load();
391  
-  else
392  
-    m_DllOMXOpen = false;
  370
+  m_DllOMX = g_RBP.GetDllOMX();
393 371
 
394 372
   pthread_mutex_init(&m_lock, NULL);
395 373
 }
@@ -407,10 +385,6 @@ COMXCoreComponent::~COMXCoreComponent()
407 385
   pthread_cond_destroy(&m_omx_event_cond);
408 386
 
409 387
   pthread_mutex_destroy(&m_lock);
410  
-
411  
-  if(m_DllOMXOpen)
412  
-    m_DllOMX->Unload();
413  
-  delete m_DllOMX;
414 388
 }
415 389
 
416 390
 void COMXCoreComponent::Lock()
@@ -428,7 +402,7 @@ void COMXCoreComponent::TransitionToStateLoaded()
428 402
   if(!m_handle)
429 403
     return;
430 404
 
431  
-  if(GetState() != OMX_StateIdle)
  405
+  if(GetState() != OMX_StateLoaded && GetState() != OMX_StateIdle)
432 406
     SetStateForComponent(OMX_StateIdle);
433 407
 
434 408
   if(GetState() != OMX_StateLoaded)
@@ -439,6 +413,9 @@ OMX_ERRORTYPE COMXCoreComponent::EmptyThisBuffer(OMX_BUFFERHEADERTYPE *omx_buffe
439 413
 {
440 414
   OMX_ERRORTYPE omx_err = OMX_ErrorNone;
441 415
 
  416
+  #if defined(OMX_DEBUG_EVENTHANDLER)
  417
+  CLog::Log(LOGDEBUG, "COMXCoreComponent::EmptyThisBuffer component(%s) %p\n", m_componentName.c_str(), omx_buffer);
  418
+  #endif
442 419
   if(!m_handle || !omx_buffer)
443 420
     return OMX_ErrorUndefined;
444 421
 
@@ -456,6 +433,9 @@ OMX_ERRORTYPE COMXCoreComponent::FillThisBuffer(OMX_BUFFERHEADERTYPE *omx_buffer
456 433
 {
457 434
   OMX_ERRORTYPE omx_err = OMX_ErrorNone;
458 435
 
  436
+  #if defined(OMX_DEBUG_EVENTHANDLER)
  437
+  CLog::Log(LOGDEBUG, "COMXCoreComponent::FillThisBuffer component(%s) %p\n", m_componentName.c_str(), omx_buffer);
  438
+  #endif
459 439
   if(!m_handle || !omx_buffer)
460 440
     return OMX_ErrorUndefined;
461 441
 
@@ -559,7 +539,7 @@ void COMXCoreComponent::FlushOutput()
559 539
 }
560 540
 
561 541
 // timeout in milliseconds
562  
-OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetInputBuffer(long timeout)
  542
+OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetInputBuffer(long timeout /*=200*/)
563 543
 {
564 544
   OMX_BUFFERHEADERTYPE *omx_input_buffer = NULL;
565 545
 
@@ -570,8 +550,10 @@ OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetInputBuffer(long timeout)
570 550
   struct timespec endtime;
571 551
   clock_gettime(CLOCK_REALTIME, &endtime);
572 552
   add_timespecs(endtime, timeout);
573  
-  while (1 && !m_flush_input)
  553
+  while (!m_flush_input)
574 554
   {
  555
+    if (m_resource_error)
  556
+      break;
575 557
     if(!m_omx_input_avaliable.empty())
576 558
     {
577 559
       omx_input_buffer = m_omx_input_avaliable.front();
@@ -581,7 +563,8 @@ OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetInputBuffer(long timeout)
581 563
 
582 564
     int retcode = pthread_cond_timedwait(&m_input_buffer_cond, &m_omx_input_mutex, &endtime);
583 565
     if (retcode != 0) {
584  
-      CLog::Log(LOGERROR, "COMXCoreComponent::GetInputBuffer %s wait event timeout\n", m_componentName.c_str());
  566
+      if (timeout != 0)
  567
+        CLog::Log(LOGERROR, "COMXCoreComponent::GetInputBuffer %s wait event timeout\n", m_componentName.c_str());
585 568
       break;
586 569
     }
587 570
   }
@@ -589,7 +572,7 @@ OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetInputBuffer(long timeout)
589 572
   return omx_input_buffer;
590 573
 }
591 574
 
592  
-OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetOutputBuffer()
  575
+OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetOutputBuffer(long timeout /*=200*/)
593 576
 {
594 577
   OMX_BUFFERHEADERTYPE *omx_output_buffer = NULL;
595 578
 
@@ -597,17 +580,82 @@ OMX_BUFFERHEADERTYPE *COMXCoreComponent::GetOutputBuffer()
597 580
     return NULL;
598 581
 
599 582
   pthread_mutex_lock(&m_omx_output_mutex);
  583
+  struct timespec endtime;
  584
+  clock_gettime(CLOCK_REALTIME, &endtime);
  585
+  add_timespecs(endtime, timeout);
  586
+  while (!m_flush_output)
  587
+  {
  588
+    if (m_resource_error)
  589
+      break;
  590
+    if(!m_omx_output_available.empty())
  591
+    {
  592
+      omx_output_buffer = m_omx_output_available.front();
  593
+      m_omx_output_available.pop();
  594
+      break;
  595
+    }
  596
+
  597
+    int retcode = pthread_cond_timedwait(&m_output_buffer_cond, &m_omx_output_mutex, &endtime);
  598
+    if (retcode != 0) {
  599
+      CLog::Log(LOGERROR, "COMXCoreComponent::GetOutputBuffer %s wait event timeout\n", m_componentName.c_str());
  600
+      break;
  601
+    }
  602
+  }
  603
+  pthread_mutex_unlock(&m_omx_output_mutex);
  604
+
  605
+  return omx_output_buffer;
  606
+}
  607
+
600 608
 
601  
-  if(!m_omx_output_available.empty())
  609
+OMX_ERRORTYPE COMXCoreComponent::WaitForInputDone(long timeout /*=200*/)
  610
+{
  611
+  OMX_ERRORTYPE omx_err = OMX_ErrorNone;
  612
+
  613
+  pthread_mutex_lock(&m_omx_input_mutex);
  614
+  struct timespec endtime;
  615
+  clock_gettime(CLOCK_REALTIME, &endtime);
  616
+  add_timespecs(endtime, timeout);
  617
+  while (m_input_buffer_count != m_omx_input_avaliable.size())
602 618
   {
603  
-    omx_output_buffer = m_omx_output_available.front();
604  
-    m_omx_output_available.pop();
  619
+    if (m_resource_error)
  620
+      break;
  621
+    int retcode = pthread_cond_timedwait(&m_input_buffer_cond, &m_omx_input_mutex, &endtime);
  622
+    if (retcode != 0) {
  623
+      if (timeout != 0)
  624
+        CLog::Log(LOGERROR, "COMXCoreComponent::WaitForInputDone %s wait event timeout\n", m_componentName.c_str());
  625
+      omx_err = OMX_ErrorTimeout;
  626
+      break;
  627
+    }
605 628
   }
  629
+  pthread_mutex_unlock(&m_omx_input_mutex);
  630
+  return omx_err;
  631
+}
  632
+
  633
+
  634
+OMX_ERRORTYPE COMXCoreComponent::WaitForOutputDone(long timeout /*=200*/)
  635
+{
  636
+  OMX_ERRORTYPE omx_err = OMX_ErrorNone;
606 637
 
  638
+  pthread_mutex_lock(&m_omx_output_mutex);
  639
+  struct timespec endtime;
  640
+  clock_gettime(CLOCK_REALTIME, &endtime);
  641
+  add_timespecs(endtime, timeout);
  642
+  while (m_output_buffer_count != m_omx_output_available.size())
  643
+  {
  644
+    if (m_resource_error)
  645
+      break;
  646
+    int retcode = pthread_cond_timedwait(&m_output_buffer_cond, &m_omx_output_mutex, &endtime);
  647
+    if (retcode != 0) {
  648
+      if (timeout != 0)
  649
+        CLog::Log(LOGERROR, "COMXCoreComponent::WaitForOutputDone %s wait event timeout\n", m_componentName.c_str());
  650
+      omx_err = OMX_ErrorTimeout;
  651
+      break;
  652
+    }
  653
+  }
607 654
   pthread_mutex_unlock(&m_omx_output_mutex);
608  
-  return omx_output_buffer;
  655
+  return omx_err;
609 656
 }
610 657
 
  658
+
611 659
 OMX_ERRORTYPE COMXCoreComponent::AllocInputBuffers(bool use_buffers /* = false **/)
612 660
 {
613 661
   OMX_ERRORTYPE omx_err = OMX_ErrorNone;
@@ -678,6 +726,11 @@ OMX_ERRORTYPE COMXCoreComponent::AllocInputBuffers(bool use_buffers /* = false *
678 726
   }
679 727
 
680 728
   omx_err = WaitForCommand(OMX_CommandPortEnable, m_input_port);
  729
+  if(omx_err != OMX_ErrorNone)
  730
+  {
  731
+    CLog::Log(LOGERROR, "COMXCoreComponent::AllocInputBuffers WaitForCommand:OMX_CommandPortEnable failed on %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
  732
+    return omx_err;
  733
+  }
681 734
 
682 735
   m_flush_input = false;
683 736
 
@@ -754,6 +807,11 @@ OMX_ERRORTYPE COMXCoreComponent::AllocOutputBuffers(bool use_buffers /* = false
754 807
   }
755 808
 
756 809
   omx_err = WaitForCommand(OMX_CommandPortEnable, m_output_port);
  810
+  if(omx_err != OMX_ErrorNone)
  811
+  {
  812
+    CLog::Log(LOGERROR, "COMXCoreComponent::AllocOutputBuffers WaitForCommand:OMX_CommandPortEnable failed on %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
  813
+    return omx_err;
  814
+  }
757 815
 
758 816
   m_flush_output = false;
759 817
 
@@ -772,11 +830,11 @@ OMX_ERRORTYPE COMXCoreComponent::FreeInputBuffers()
772 830
 
773 831
   m_flush_input = true;
774 832
 
  833
+  omx_err = DisablePort(m_input_port, false);
  834
+
775 835
   pthread_mutex_lock(&m_omx_input_mutex);
776 836
   pthread_cond_broadcast(&m_input_buffer_cond);
777 837
 
778  
-  omx_err = DisablePort(m_input_port, false);
779  
-
780 838
   for (size_t i = 0; i < m_omx_input_buffers.size(); i++)
781 839
   {
782 840
     uint8_t *buf = m_omx_input_buffers[i]->pBuffer;
@@ -791,8 +849,17 @@ OMX_ERRORTYPE COMXCoreComponent::FreeInputBuffers()
791 849
       CLog::Log(LOGERROR, "COMXCoreComponent::FreeInputBuffers error deallocate omx input buffer on component %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
792 850
     }
793 851
   }
  852
+  pthread_mutex_unlock(&m_omx_input_mutex);
794 853
 
795  
-  WaitForCommand(OMX_CommandPortDisable, m_input_port);
  854
+  omx_err = WaitForCommand(OMX_CommandPortDisable, m_input_port);
  855
+  if(omx_err != OMX_ErrorNone)
  856
+  {
  857
+    CLog::Log(LOGERROR, "COMXCoreComponent::FreeInputBuffers WaitForCommand:OMX_CommandPortDisable failed on %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
  858
+  }
  859
+
  860
+  WaitForInputDone(1000);
  861
+
  862
+  pthread_mutex_lock(&m_omx_input_mutex);
796 863
   assert(m_omx_input_buffers.size() == m_omx_input_avaliable.size());
797 864
 
798 865
   m_omx_input_buffers.clear();
@@ -821,11 +888,11 @@ OMX_ERRORTYPE COMXCoreComponent::FreeOutputBuffers()
821 888
 
822 889
   m_flush_output = true;
823 890
 
  891
+  omx_err = DisablePort(m_output_port, false);
  892
+
824 893
   pthread_mutex_lock(&m_omx_output_mutex);
825 894
   pthread_cond_broadcast(&m_output_buffer_cond);
826 895
 
827  
-  omx_err = DisablePort(m_output_port, false);
828  
-
829 896
   for (size_t i = 0; i < m_omx_output_buffers.size(); i++)
830 897
   {
831 898
     uint8_t *buf = m_omx_output_buffers[i]->pBuffer;
@@ -840,8 +907,17 @@ OMX_ERRORTYPE COMXCoreComponent::FreeOutputBuffers()
840 907
       CLog::Log(LOGERROR, "COMXCoreComponent::FreeOutputBuffers error deallocate omx output buffer on component %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
841 908
     }
842 909
   }
  910
+  pthread_mutex_unlock(&m_omx_output_mutex);
  911
+
  912
+  omx_err = WaitForCommand(OMX_CommandPortDisable, m_output_port);
  913
+  if(omx_err != OMX_ErrorNone)
  914
+  {
  915
+    CLog::Log(LOGERROR, "COMXCoreComponent::FreeOutputBuffers WaitForCommand:OMX_CommandPortDisable failed on %s omx_err(0x%08x)\n", m_componentName.c_str(), omx_err);
  916
+  }
  917
+
  918
+  WaitForOutputDone(1000);
843 919
 
844  
-  WaitForCommand(OMX_CommandPortDisable, m_output_port);
  920
+  pthread_mutex_lock(&m_omx_output_mutex);
845 921
   assert(m_omx_output_buffers.size() == m_omx_output_available.size());
846 922
 
847 923
   m_omx_output_buffers.clear();
@@ -1009,6 +1085,8 @@ OMX_ERRORTYPE COMXCoreComponent::WaitForEvent(OMX_EVENTTYPE eventType, long time
1009 1085
       }
1010 1086
     }
1011 1087
 
  1088
+    if (m_resource_error)
  1089
+      break;
1012 1090
     int retcode = pthread_cond_timedwait(&m_omx_event_cond, &m_omx_event_mutex, &endtime);
1013 1091
     if (retcode != 0) 
1014 1092
     {
@@ -1016,7 +1094,7 @@ OMX_ERRORTYPE COMXCoreComponent::WaitForEvent(OMX_EVENTTYPE eventType, long time
1016 1094
         CLog::Log(LOGERROR, "COMXCoreComponent::WaitForEvent %s wait event 0x%08x timeout %ld\n",
1017 1095
                           m_componentName.c_str(), (int)eventType, timeout);
1018 1096
       pthread_mutex_unlock(&m_omx_event_mutex);
1019  
-      return OMX_ErrorMax;
  1097
+      return OMX_ErrorTimeout;
1020 1098
     }
1021 1099
   }
1022 1100
   pthread_mutex_unlock(&m_omx_event_mutex);
@@ -1076,13 +1154,15 @@ OMX_ERRORTYPE COMXCoreComponent::WaitForCommand(OMX_U32 command, OMX_U32 nData2,
1076 1154
       }
1077 1155
     }
1078 1156
 
  1157
+    if (m_resource_error)
  1158
+      break;
1079 1159
     int retcode = pthread_cond_timedwait(&m_omx_event_cond, &m_omx_event_mutex, &endtime);
1080 1160
     if (retcode != 0) {
1081 1161
       CLog::Log(LOGERROR, "COMXCoreComponent::WaitForCommand %s wait timeout event.eEvent 0x%08x event.command 0x%08x event.nData2 %d\n", 
1082 1162
         m_componentName.c_str(), (int)OMX_EventCmdComplete, (int)command, (int)nData2);
1083 1163
       
1084 1164
       pthread_mutex_unlock(&m_omx_event_mutex);
1085  
-      return OMX_ErrorMax;
  1165
+      return OMX_ErrorTimeout;
1086 1166
     }
1087 1167
   }
1088 1168
   pthread_mutex_unlock(&m_omx_event_mutex);
@@ -1110,6 +1190,8 @@ OMX_ERRORTYPE COMXCoreComponent::SetStateForComponent(OMX_STATETYPE state)
1110 1190
   {
1111 1191
     if(omx_err == OMX_ErrorSameState)
1112 1192
     {
  1193
+      CLog::Log(LOGERROR, "COMXCoreComponent::SetStateForComponent - %s same state\n",
  1194
+        m_componentName.c_str());
1113 1195
       omx_err = OMX_ErrorNone;
1114 1196
     }
1115 1197
     else
@@ -1121,12 +1203,10 @@ OMX_ERRORTYPE COMXCoreComponent::SetStateForComponent(OMX_STATETYPE state)
1121 1203
   else 
1122 1204
   {
1123 1205
     omx_err = WaitForCommand(OMX_CommandStateSet, state);
1124  
-    if(omx_err == OMX_ErrorSameState)
  1206
+    if (omx_err != OMX_ErrorNone)
1125 1207
     {
1126  
-      CLog::Log(LOGERROR, "COMXCoreComponent::SetStateForComponent - %s ignore OMX_ErrorSameState\n", 
1127  
-        m_componentName.c_str());
1128  
-      UnLock();
1129  
-      return OMX_ErrorNone;
  1208
+      CLog::Log(LOGERROR, "COMXCoreComponent::WaitForCommand - %s failed with omx_err(0x%x)\n",
  1209
+        m_componentName.c_str(), omx_err);
1130 1210
     }
1131 1211
   }
1132 1212
 
@@ -1367,10 +1447,28 @@ bool COMXCoreComponent::Initialize( const std::string &component_name, OMX_INDEX
1367 1447
 {
1368 1448
   OMX_ERRORTYPE omx_err;
1369 1449
 
1370  
-  if(!m_DllOMXOpen)
1371  
-    return false;
  1450
+  m_input_port  = 0;
  1451
+  m_output_port = 0;
  1452
+  m_handle      = NULL;
  1453
+
  1454
+  m_input_alignment     = 0;
  1455
+  m_input_buffer_size  = 0;
  1456
+  m_input_buffer_count  = 0;
  1457
+
  1458
+  m_output_alignment    = 0;
  1459
+  m_output_buffer_size  = 0;
  1460
+  m_output_buffer_count = 0;
  1461
+  m_flush_input         = false;
  1462
+  m_flush_output        = false;
  1463
+  m_resource_error      = false;
  1464
+
  1465
+  m_eos                 = false;
  1466
+
  1467
+  m_exit = false;
  1468
+
  1469
+  m_omx_input_use_buffers  = false;
  1470
+  m_omx_output_use_buffers = false;
1372 1471
 
1373  
-  m_resource_error = false;
1374 1472
   m_componentName = component_name;
1375 1473
   
1376 1474
   m_callbacks.EventHandler    = &COMXCoreComponent::DecoderEventHandlerCallback;
@@ -1389,8 +1487,8 @@ bool COMXCoreComponent::Initialize( const std::string &component_name, OMX_INDEX
1389 1487
       return false;
1390 1488
     }
1391 1489
 
1392  
-    CLog::Log(LOGDEBUG, "COMXCoreComponent::Initialize : %s handle %p dllopen : %d\n", 
1393  
-          m_componentName.c_str(), m_handle, m_DllOMXOpen);
  1490
+    CLog::Log(LOGDEBUG, "COMXCoreComponent::Initialize : %s handle %p\n",
  1491
+          m_componentName.c_str(), m_handle);
1394 1492
   }
1395 1493
 
1396 1494
   OMX_PORT_PARAM_TYPE port_param;
@@ -1453,7 +1551,7 @@ bool COMXCoreComponent::Deinitialize(bool free_component /* = false */)
1453 1551
   m_flush_input   = true;
1454 1552
   m_flush_output  = true;
1455 1553
 
1456  
-  if(m_handle && m_DllOMXOpen)
  1554
+  if(m_handle)
1457 1555
   {
1458 1556
     FlushAll();
1459 1557
 
@@ -1464,8 +1562,8 @@ bool COMXCoreComponent::Deinitialize(bool free_component /* = false */)
1464 1562
 
1465 1563
     if(free_component)
1466 1564
     {
1467  
-      CLog::Log(LOGDEBUG, "COMXCoreComponent::Deinitialize : %s handle %p dllopen : %d\n", 
1468  
-          m_componentName.c_str(), m_handle, m_DllOMXOpen);
  1565
+      CLog::Log(LOGDEBUG, "COMXCoreComponent::Deinitialize : %s handle %p\n",
  1566
+          m_componentName.c_str(), m_handle);
1469 1567
       omx_err = m_DllOMX->OMX_FreeHandle(m_handle);
1470 1568
       if (omx_err != OMX_ErrorNone)
1471 1569
       {
@@ -1498,7 +1596,7 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderEventHandlerCallback(
1498 1596
     return OMX_ErrorNone;
1499 1597
 
1500 1598
   COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
1501  
-  return ctx->DecoderEventHandler(hComponent, pAppData, eEvent, nData1, nData2, pEventData);
  1599
+  return ctx->DecoderEventHandler(hComponent, eEvent, nData1, nData2, pEventData);
1502 1600
 }
1503 1601
 
1504 1602
 // DecoderEmptyBufferDone -- OMXCore input buffer has been emptied
@@ -1511,7 +1609,7 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderEmptyBufferDoneCallback(
1511 1609
     return OMX_ErrorNone;
1512 1610
 
1513 1611
   COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
1514  
-  return ctx->DecoderEmptyBufferDone( hComponent, pAppData, pBuffer);
  1612
+  return ctx->DecoderEmptyBufferDone( hComponent, pBuffer);
1515 1613
 }
1516 1614
 
1517 1615
 // DecoderFillBufferDone -- OMXCore output buffer has been filled
@@ -1524,41 +1622,43 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderFillBufferDoneCallback(
1524 1622
     return OMX_ErrorNone;
1525 1623
 
1526 1624
   COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
1527  
-  return ctx->DecoderFillBufferDone(hComponent, pAppData, pBuffer);
  1625
+  return ctx->DecoderFillBufferDone(hComponent, pBuffer);
1528 1626
 }
1529 1627
 
1530  
-OMX_ERRORTYPE COMXCoreComponent::DecoderEmptyBufferDone(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer)
  1628
+OMX_ERRORTYPE COMXCoreComponent::DecoderEmptyBufferDone(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE* pBuffer)
1531 1629
 {
1532  
-  if(!pAppData || m_exit)
  1630
+  if(m_exit)
1533 1631
     return OMX_ErrorNone;
1534 1632
 
1535  
-  COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
1536  
-
1537  
-  pthread_mutex_lock(&ctx->m_omx_input_mutex);
1538  
-  ctx->m_omx_input_avaliable.push(pBuffer);
  1633
+  #if defined(OMX_DEBUG_EVENTHANDLER)
  1634
+  CLog::Log(LOGDEBUG, "COMXCoreComponent::DecoderEmptyBufferDone component(%s) %p %d/%d\n", m_componentName.c_str(), pBuffer, m_omx_input_avaliable.size(), m_input_buffer_count);
  1635
+  #endif
  1636
+  pthread_mutex_lock(&m_omx_input_mutex);
  1637
+  m_omx_input_avaliable.push(pBuffer);
1539 1638
 
1540 1639
   // this allows (all) blocked tasks to be awoken
1541  
-  pthread_cond_broadcast(&ctx->m_input_buffer_cond);
  1640
+  pthread_cond_broadcast(&m_input_buffer_cond);
1542 1641
 
1543  
-  pthread_mutex_unlock(&ctx->m_omx_input_mutex);
  1642
+  pthread_mutex_unlock(&m_omx_input_mutex);
1544 1643
 
1545 1644
   return OMX_ErrorNone;
1546 1645
 }
1547 1646
 
1548  
-OMX_ERRORTYPE COMXCoreComponent::DecoderFillBufferDone(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer)
  1647
+OMX_ERRORTYPE COMXCoreComponent::DecoderFillBufferDone(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE* pBuffer)
1549 1648
 {
1550  
-  if(!pAppData || m_exit)
  1649
+  if(m_exit)
1551 1650
     return OMX_ErrorNone;
1552 1651
 
1553  
-  COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
1554  
-
1555  
-  pthread_mutex_lock(&ctx->m_omx_output_mutex);
1556  
-  ctx->m_omx_output_available.push(pBuffer);
  1652
+  #if defined(OMX_DEBUG_EVENTHANDLER)
  1653
+  CLog::Log(LOGDEBUG, "COMXCoreComponent::DecoderFillBufferDone component(%s) %p %d/%d\n", m_componentName.c_str(), pBuffer, m_omx_output_available.size(), m_output_buffer_count);
  1654
+  #endif
  1655
+  pthread_mutex_lock(&m_omx_output_mutex);
  1656
+  m_omx_output_available.push(pBuffer);
1557 1657
 
1558 1658
   // this allows (all) blocked tasks to be awoken
1559  
-  pthread_cond_broadcast(&ctx->m_output_buffer_cond);
  1659
+  pthread_cond_broadcast(&m_output_buffer_cond);
1560 1660
 
1561  
-  pthread_mutex_unlock(&ctx->m_omx_output_mutex);
  1661
+  pthread_mutex_unlock(&m_omx_output_mutex);
1562 1662
 
1563 1663
   return OMX_ErrorNone;
1564 1664
 }
@@ -1568,18 +1668,15 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderFillBufferDone(OMX_HANDLETYPE hComponent
1568 1668
 // Component event handler -- OMX event callback
1569 1669
 OMX_ERRORTYPE COMXCoreComponent::DecoderEventHandler(
1570 1670
   OMX_HANDLETYPE hComponent,
1571  
-  OMX_PTR pAppData,
1572 1671
   OMX_EVENTTYPE eEvent,
1573 1672
   OMX_U32 nData1,
1574 1673
   OMX_U32 nData2,
1575 1674
   OMX_PTR pEventData)
1576 1675
 {
1577  
-  COMXCoreComponent *ctx = static_cast<COMXCoreComponent*>(pAppData);
1578  
-
1579 1676
 #ifdef OMX_DEBUG_EVENTS
1580 1677
   CLog::Log(LOGDEBUG,
1581  
-    "COMXCore::%s - %s eEvent(0x%x), nData1(0x%lx), nData2(0x%lx), pEventData(0x%p)\n",
1582  
-    __func__, (char *)ctx->GetName().c_str(), eEvent, nData1, nData2, pEventData);
  1678
+    "COMXCoreComponent::%s - %s eEvent(0x%x), nData1(0x%x), nData2(0x%x), pEventData(0x%p)\n",
  1679
+    __func__, GetName().c_str(), eEvent, nData1, nData2, pEventData);
1583 1680
 #endif
1584 1681
 
1585 1682
   AddEvent(eEvent, nData1, nData2);
@@ -1595,91 +1692,91 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderEventHandler(
1595 1692
           {
1596 1693
             case OMX_StateInvalid:
1597 1694
             #if defined(OMX_DEBUG_EVENTHANDLER)
1598  
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateInvalid\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1695
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateInvalid\n", CLASSNAME, __func__, GetName().c_str());
1599 1696
             #endif
1600 1697
             break;
1601 1698
             case OMX_StateLoaded:
1602 1699
             #if defined(OMX_DEBUG_EVENTHANDLER)
1603  
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateLoaded\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1700
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateLoaded\n", CLASSNAME, __func__, GetName().c_str());
1604 1701
             #endif
1605 1702
             break;
1606 1703
             case OMX_StateIdle:
1607 1704
             #if defined(OMX_DEBUG_EVENTHANDLER)
1608  
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateIdle\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1705
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateIdle\n", CLASSNAME, __func__, GetName().c_str());
1609 1706
             #endif
1610 1707
             break;
1611 1708
             case OMX_StateExecuting:
1612 1709
             #if defined(OMX_DEBUG_EVENTHANDLER)
1613  
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateExecuting\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1710
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateExecuting\n", CLASSNAME, __func__, GetName().c_str());
1614 1711
             #endif
1615 1712
             break;
1616 1713
             case OMX_StatePause:
1617 1714
             #if defined(OMX_DEBUG_EVENTHANDLER)
1618  
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StatePause\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1715
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StatePause\n", CLASSNAME, __func__, GetName().c_str());
1619 1716
             #endif
1620 1717
             break;
1621 1718
             case OMX_StateWaitForResources:
1622 1719
             #if defined(OMX_DEBUG_EVENTHANDLER)
1623  
-              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateWaitForResources\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1720
+              CLog::Log(LOGDEBUG, "%s::%s %s - OMX_StateWaitForResources\n", CLASSNAME, __func__, GetName().c_str());
1624 1721
             #endif
1625 1722
             break;
1626 1723
             default:
1627 1724
             #if defined(OMX_DEBUG_EVENTHANDLER)
1628 1725
               CLog::Log(LOGDEBUG,
1629  
-                "%s::%s %s - Unknown OMX_Statexxxxx, state(%d)\n", CLASSNAME, __func__, ctx->GetName().c_str(), (int)nData2);
  1726
+                "%s::%s %s - Unknown OMX_Statexxxxx, state(%d)\n", CLASSNAME, __func__, GetName().c_str(), (int)nData2);
1630 1727
             #endif
1631 1728
             break;
1632 1729
           }
1633 1730
         break;
1634 1731
         case OMX_CommandFlush:
1635 1732
           #if defined(OMX_DEBUG_EVENTHANDLER)
1636  
-          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandFlush, port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), (int)nData2);
  1733
+          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandFlush, port %d\n", CLASSNAME, __func__, GetName().c_str(), (int)nData2);
1637 1734
           #endif
1638 1735
         break;
1639 1736
         case OMX_CommandPortDisable:
1640 1737
           #if defined(OMX_DEBUG_EVENTHANDLER)
1641  
-          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandPortDisable, nData1(0x%lx), port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), nData1, (int)nData2);
  1738
+          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandPortDisable, nData1(0x%x), port %d\n", CLASSNAME, __func__, GetName().c_str(), nData1, (int)nData2);
1642 1739
           #endif
1643 1740
         break;
1644 1741
         case OMX_CommandPortEnable:
1645 1742
           #if defined(OMX_DEBUG_EVENTHANDLER)
1646  
-          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandPortEnable, nData1(0x%lx), port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), nData1, (int)nData2);
  1743
+          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandPortEnable, nData1(0x%x), port %d\n", CLASSNAME, __func__, GetName().c_str(), nData1, (int)nData2);
1647 1744
           #endif
1648 1745
         break;
1649 1746
         #if defined(OMX_DEBUG_EVENTHANDLER)
1650 1747
         case OMX_CommandMarkBuffer:
1651  
-          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandMarkBuffer, nData1(0x%lx), port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), nData1, (int)nData2);
  1748
+          CLog::Log(LOGDEBUG, "%s::%s %s - OMX_CommandMarkBuffer, nData1(0x%x), port %d\n", CLASSNAME, __func__, GetName().c_str(), nData1, (int)nData2);
1652 1749
         break;
1653 1750
         #endif
1654 1751
       }
1655 1752
     break;
1656 1753
     case OMX_EventBufferFlag:
1657 1754
       #if defined(OMX_DEBUG_EVENTHANDLER)
1658  
-      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventBufferFlag(input)\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1755
+      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventBufferFlag(input)\n", CLASSNAME, __func__, GetName().c_str());
1659 1756
       #endif
1660 1757
       if(nData2 & OMX_BUFFERFLAG_EOS)
1661 1758
       {
1662  
-        pthread_mutex_lock(&ctx->m_omx_eos_mutex);
1663  
-        ctx->m_eos = true;
1664  
-        pthread_mutex_unlock(&ctx->m_omx_eos_mutex);
  1759
+        pthread_mutex_lock(&m_omx_eos_mutex);
  1760
+        m_eos = true;
  1761
+        pthread_mutex_unlock(&m_omx_eos_mutex);
1665 1762
       }
1666 1763
     break;
1667 1764
     case OMX_EventPortSettingsChanged:
1668 1765
       #if defined(OMX_DEBUG_EVENTHANDLER)
1669  
-      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventPortSettingsChanged(output)\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1766
+      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventPortSettingsChanged(output)\n", CLASSNAME, __func__, GetName().c_str());
1670 1767
       #endif
1671 1768
     break;
1672 1769
     case OMX_EventParamOrConfigChanged:
1673 1770
       #if defined(OMX_DEBUG_EVENTHANDLER)
1674  
-      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventParamOrConfigChanged(output)\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1771
+      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventParamOrConfigChanged(output)\n", CLASSNAME, __func__, GetName().c_str());
1675 1772
       #endif
1676 1773
     break;
1677 1774
     #if defined(OMX_DEBUG_EVENTHANDLER)
1678 1775
     case OMX_EventMark:
1679  
-      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventMark\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1776
+      CLog::Log(LOGDEBUG, "%s::%s %s - OMX_EventMark\n", CLASSNAME, __func__, GetName().c_str());
1680 1777
     break;
1681 1778
     case OMX_EventResourcesAcquired:
1682  
-      CLog::Log(LOGDEBUG, "%s::%s %s- OMX_EventResourcesAcquired\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1779
+      CLog::Log(LOGDEBUG, "%s::%s %s- OMX_EventResourcesAcquired\n", CLASSNAME, __func__, GetName().c_str());
1683 1780
     break;
1684 1781
     #endif
1685 1782
     case OMX_EventError:
@@ -1687,34 +1784,42 @@ OMX_ERRORTYPE COMXCoreComponent::DecoderEventHandler(
1687 1784
       {
1688 1785
         case OMX_ErrorSameState:
1689 1786
           //#if defined(OMX_DEBUG_EVENTHANDLER)
1690  
-          //CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorSameState, same state\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1787
+          //CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorSameState, same state\n", CLASSNAME, __func__, GetName().c_str());
1691 1788
           //#endif
1692 1789
         break;
1693 1790
         case OMX_ErrorInsufficientResources:
1694  
-          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorInsufficientResources, insufficient resources\n", CLASSNAME, __func__, ctx->GetName().c_str());
1695  
-          ctx->m_resource_error = true;
  1791
+          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorInsufficientResources, insufficient resources\n", CLASSNAME, __func__, GetName().c_str());
  1792
+          m_resource_error = true;
1696 1793
         break;
1697 1794
         case OMX_ErrorFormatNotDetected:
1698  
-          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorFormatNotDetected, cannot parse input stream\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1795
+          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorFormatNotDetected, cannot parse input stream\n", CLASSNAME, __func__, GetName().c_str());
1699 1796
         break;
1700 1797
         case OMX_ErrorPortUnpopulated:
1701 1798
           // this one is expected for tunneled ports. We always get it from mixer on teardown
1702  
-          if(ctx->GetName() != "OMX.broadcom.audio_mixer")
1703  
-            CLog::Log(LOGWARNING, "%s::%s %s - OMX_ErrorPortUnpopulated port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), (int)nData2);
  1799
+          if(GetName() != "OMX.broadcom.audio_mixer")
  1800
+            CLog::Log(LOGWARNING, "%s::%s %s - OMX_ErrorPortUnpopulated port %d\n", CLASSNAME, __func__, GetName().c_str(), (int)nData2);
1704 1801
         break;
1705 1802
         case OMX_ErrorStreamCorrupt:
1706  
-          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorStreamCorrupt, Bitstream corrupt\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1803
+          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorStreamCorrupt, Bitstream corrupt\n", CLASSNAME, __func__, GetName().c_str());
  1804
+          m_resource_error = true;
1707 1805
         break;
1708 1806
         case OMX_ErrorUnsupportedSetting:
1709  
-          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorUnsupportedSetting, unsupported setting\n", CLASSNAME, __func__, ctx->GetName().c_str());
  1807
+          CLog::Log(LOGERROR, "%s::%s %s - OMX_ErrorUnsupportedSetting, unsupported setting\n", CLASSNAME, __func__, GetName().c_str());
1710 1808
         break;
1711 1809
         default:
1712  
-          CLog::Log(LOGERROR, "%s::%s %s - OMX_EventError detected, nData1(0x%x), port %d\n",  CLASSNAME, __func__, ctx->GetName().c_str(), nData1, (int)nData2);
  1810
+          CLog::Log(LOGERROR, "%s::%s %s - OMX_EventError detected, nData1(0x%x), port %d\n",  CLASSNAME, __func__, GetName().c_str(), nData1, (int)nData2);
1713 1811
         break;
1714 1812
       }
  1813
+      // wake things up
  1814
+      if (m_resource_error)
  1815
+      {
  1816
+        pthread_cond_broadcast(&m_output_buffer_cond);
  1817
+        pthread_cond_broadcast(&m_input_buffer_cond);
  1818
+        pthread_cond_broadcast(&m_omx_event_cond);
  1819
+      }
1715 1820
     break;
1716 1821
     default:
1717  
-      CLog::Log(LOGWARNING, "%s::%s %s - Unknown eEvent(0x%x), nData1(0x%x), port %d\n", CLASSNAME, __func__, ctx->GetName().c_str(), eEvent, nData1, (int)nData2);
  1822
+      CLog::Log(LOGWARNING, "%s::%s %s - Unknown eEvent(0x%x), nData1(0x%x), port %d\n", CLASSNAME, __func__, GetName().c_str(), eEvent, nData1, (int)nData2);
1718 1823
     break;
1719 1824
   }
1720 1825
 
16  xbmc/linux/OMXCore.h
@@ -58,7 +58,6 @@ typedef struct omx_event {
58 58
   OMX_U32 nData2;
59 59
 } omx_event;
60 60
 
61  
-class DllLibOMXCore;
62 61
 class COMXCore;
63 62
 class COMXCoreComponent;
64 63
 class COMXCoreTunel;
@@ -83,7 +82,6 @@ class COMXCoreTunel
83 82
   unsigned int      m_src_port;
84 83
   unsigned int      m_dst_port;
85 84
   DllOMX            *m_DllOMX;
86  
-  bool              m_DllOMXOpen;
87 85
   void              Lock();
88 86
   void              UnLock();
89 87
   bool              m_tunnel_set;
@@ -129,12 +127,12 @@ class COMXCoreComponent
129 127
     OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBufferHeader);
130 128
 
131 129
   // OMXCore decoder callback routines.
132  
-  OMX_ERRORTYPE DecoderEventHandler(OMX_HANDLETYPE hComponent, OMX_PTR pAppData,
  130
+  OMX_ERRORTYPE DecoderEventHandler(OMX_HANDLETYPE hComponent,
133 131
     OMX_EVENTTYPE eEvent, OMX_U32 nData1, OMX_U32 nData2, OMX_PTR pEventData);
134 132
   OMX_ERRORTYPE DecoderEmptyBufferDone(
135  
-    OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer);
  133
+    OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE* pBuffer);
136 134
   OMX_ERRORTYPE DecoderFillBufferDone(
137  
-    OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer);
  135
+    OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE* pBuffer);
138 136
 
139 137
   void TransitionToStateLoaded();
140 138
 
@@ -153,7 +151,7 @@ class COMXCoreComponent
153 151
   void FlushOutput();
154 152
 
155 153
   OMX_BUFFERHEADERTYPE *GetInputBuffer(long timeout=200);
156  
-  OMX_BUFFERHEADERTYPE *GetOutputBuffer();
  154
+  OMX_BUFFERHEADERTYPE *GetOutputBuffer(long timeout=200);
157 155
 
158 156
   OMX_ERRORTYPE AllocInputBuffers(bool use_buffers = false);
159 157
   OMX_ERRORTYPE AllocOutputBuffers(bool use_buffers = false);
@@ -161,6 +159,9 @@ class COMXCoreComponent
161 159
   OMX_ERRORTYPE FreeInputBuffers();
162 160
   OMX_ERRORTYPE FreeOutputBuffers();
163 161
 
  162
+  OMX_ERRORTYPE WaitForInputDone(long timeout=200);
  163
+  OMX_ERRORTYPE WaitForOutputDone(long timeout=200);
  164
+
164 165
   bool IsEOS() { return m_eos; };
165 166
   bool BadState() { return m_resource_error; };
166 167
   void ResetEos();
@@ -197,7 +198,6 @@ class COMXCoreComponent
197 198
 
198 199
   bool          m_exit;
199 200
   DllOMX        *m_DllOMX;
200  
-  bool          m_DllOMXOpen;
201 201
   pthread_cond_t    m_input_buffer_cond;
202 202
   pthread_cond_t    m_output_buffer_cond;
203 203
   pthread_cond_t    m_omx_event_cond;
@@ -218,10 +218,10 @@ class COMXCore
218 218
   // initialize OMXCore and get decoder component
219 219
   bool Initialize();
220 220
   void Deinitialize();
  221
+  DllOMX *GetDll() { return m_DllOMX; }
221 222
 
222 223
 protected:
223 224
   bool              m_is_open;
224  
-  bool              m_Initialized;
225 225
   DllOMX            *m_DllOMX;
226 226
 };
227 227
 
2  xbmc/linux/RBP.h
@@ -52,6 +52,7 @@ class CRBP
52 52
   void GetDisplaySize(int &width, int &height);
53 53
   // stride can be null for packed output
54 54
   unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true);
  55
+  DllOMX *GetDllOMX() { return m_OMX ? m_OMX->GetDll() : NULL; }
55 56
 
56 57
 private:
57 58
   DllBcmHost *m_DllBcmHost;
@@ -60,6 +61,7 @@ class CRBP
60 61
   int        m_arm_mem;
61 62
   int        m_gpu_mem;
62 63
   COMXCore   *m_OMX;
  64
+  class DllLibOMXCore;
63 65
 };
64 66
 
65 67
 extern CRBP g_RBP;

0 notes on commit a451f13

Please sign in to comment.
Something went wrong with that request. Please try again.