00001 // Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com> 00002 // 00003 // Use, modification and distribution is allowed without limitation, 00004 // warranty, or liability of any kind. 00005 // 00006 00007 #include <qobject.h> 00008 #include <qapplication.h> 00009 00010 #include "output.h" 00011 #include "visual.h" 00012 00013 OutputListeners::OutputListeners() 00014 { 00015 bufsize=0; 00016 } 00017 00018 00019 OutputListeners::~OutputListeners() 00020 { 00021 } 00022 00023 00024 void OutputListeners::error(const QString &e) { 00025 QObject *object = firstListener(); 00026 while (object) { 00027 QApplication::postEvent(object, new OutputEvent(e)); 00028 object = nextListener(); 00029 } 00030 } 00031 00032 void OutputListeners::addVisual(MythTV::Visual *v) 00033 { 00034 if (visuals.find(v) == -1) { 00035 visuals.append(v); 00036 } 00037 } 00038 00039 void OutputListeners::removeVisual(MythTV::Visual *v) 00040 { 00041 visuals.remove(v); 00042 } 00043 00044 void OutputListeners::dispatchVisual(uchar *buffer, unsigned long b_len, 00045 unsigned long written, int chan, int prec) 00046 { 00047 if (! buffer) 00048 return; 00049 00050 MythTV::Visual *visual = visuals.first(); 00051 while (visual) { 00052 visual->mutex()->lock(); 00053 visual->add(buffer, b_len, written, chan, prec); 00054 visual->mutex()->unlock(); 00055 00056 visual = visuals.next(); 00057 } 00058 } 00059 00060 void OutputListeners::prepareVisuals() 00061 { 00062 MythTV::Visual *visual = visuals.first(); 00063 while (visual) { 00064 visual->mutex()->lock(); 00065 visual->prepare(); 00066 visual->mutex()->unlock(); 00067 00068 visual = visuals.next(); 00069 } 00070 }
1.5.5