Changeset 44

Show
Ignore:
Timestamp:
05/04/08 16:50:54 (4 months ago)
Author:
sip
Message:

Minor fix and add watcher ouput

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • media/include/videomixer.h

    r37 r44  
    3636        VideoInput*  GetInput(int id); 
    3737        VideoOutput* GetOutput(int id); 
     38        int SetWatcher(VideoOutput* watcher); 
    3839        int GetCompositionType(); 
    3940        int SetSlot(int num,int id); 
     
    7172        int     numSlots; 
    7273 
     74        //Watcher output 
     75        VideoOutput *watcher; 
     76 
    7377        //Threads, mutex y condiciones 
    7478        pthread_t       mixVideoThread; 
  • media/src/videomixer.cpp

    r34 r44  
    1717        mosaicPos       = NULL; 
    1818        numSlots        = 0; 
     19 
     20        //No watcher 
     21        watcher = NULL; 
    1922 
    2023        //Inciamos lso mutex y la condicion 
     
    97100                                input->SetFrame(mosaic->GetFrame(),mosaic->GetWidth(),mosaic->GetHeight()); 
    98101                        } 
     102 
     103                        //If been watched 
     104                        if (watcher) 
     105                                //Put frame 
     106                                watcher->NextFrame(mosaic->GetFrame()); 
     107                         
     108                        //Reset 
     109                        mosaic->Reset(); 
    99110                } 
    100111 
    101                 //Reset 
    102                 mosaic->Reset(); 
    103112 
    104113                //Desprotege la lista 
     
    107116                //Esperamos que nos seƱalicen 
    108117                pthread_cond_wait(&mixVideoCond,&mixVideoMutex); 
     118 
    109119 
    110120                //Protegemos la lista 
     
    127137 
    128138                                //If it's visible 
    129                                 if (pos!=1) 
     139                                if (pos!=-1) 
    130140                                        //Change mosaic 
    131                                         mosaic->Update(id-1,output->GetFrame(),output->GetWidth(),output->GetHeight()); 
     141                                        mosaic->Update(pos,output->GetFrame(),output->GetWidth(),output->GetHeight()); 
    132142                        } 
    133143                } 
    134144 
     145                //Desprotege la lista 
     146                lstVideosUse.DecUse(); 
     147 
    135148                //Desbloqueamos 
    136149                pthread_mutex_unlock(&mixVideoMutex); 
    137                          
    138                 //Desprotege la lista 
    139                 lstVideosUse.DecUse(); 
    140150        } 
    141151 
     
    159169        // Estamos mzclando 
    160170        mixingVideo = true; 
     171 
     172        //Calculate Init position 
     173        CalculatePositions(); 
    161174 
    162175        //Y arrancamoe el thread 
     
    199212        Log("<End videomixer\n"); 
    200213         
     214        return 1; 
     215} 
     216 
     217/*********************** 
     218* CreateMixer 
     219*       Crea una nuevo source de video para mezclar 
     220***************************/ 
     221int VideoMixer::SetWatcher(VideoOutput* w) 
     222{ 
     223        //Protegemos la lista 
     224        lstVideosUse.WaitUnusedAndLock(); 
     225 
     226        //Set watcher 
     227        watcher = w; 
     228 
     229        //If it's not null 
     230        if (watcher) 
     231                //Set width 
     232                watcher->SetVideoSize(mosaic->GetWidth(),mosaic->GetHeight()); 
     233 
     234        //Desprotegemos la lista 
     235        lstVideosUse.Unlock(); 
     236 
     237        //Ok 
    201238        return 1; 
    202239} 
     
    394431                        } 
    395432 
     433        //Signal for new video 
     434        pthread_cond_signal(&mixVideoCond); 
     435 
    396436        //Desprotegemos la lista 
    397437        lstVideosUse.Unlock(); 
     
    552592        CalculatePositions(); 
    553593 
     594        //If we have watcher 
     595        if (watcher) 
     596                //Set size 
     597                watcher->SetVideoSize(mosaic->GetWidth(),mosaic->GetHeight()); 
     598 
     599        //Signal for new video 
     600        pthread_cond_signal(&mixVideoCond); 
     601 
    554602        //Desprotegemos la lista 
    555603        lstVideosUse.Unlock(); 
     
    601649                                        //Start after me next pass 
    602650                                        first++;         
     651                                //It's locked 
     652                                firstFree = -1; 
    603653                                //Next 
    604654                                break; 
     
    635685        }        
    636686 
    637         //For each slot 
    638         for (int i=0;i<numSlots;i++) 
    639                 //If we empty slot 
    640                 if (mosaicPos[i]<=0) 
    641                         //Print it 
    642                         mosaic->Update(i,logo.GetFrame(),logo.GetWidth(),logo.GetHeight()); 
    643  
    644687        //Log Slots 
    645688        for (int i=0;i<numSlots;i++) 
     
    658701        Log("]\n"); 
    659702 
     703        //For each slot 
     704        for (int i=0;i<numSlots;i++) 
     705                //If we empty slot 
     706                if (mosaicPos[i]<=0) 
     707                        //Print it 
     708                        mosaic->Update(i,logo.GetFrame(),logo.GetWidth(),logo.GetHeight()); 
     709 
     710 
    660711        Log("<CalculatePositions\n"); 
    661712} 
     
    676727        //Protegemos la lista 
    677728        lstVideosUse.WaitUnusedAndLock(); 
     729 
     730        //If we fix a participant 
     731        if (id!=-1) 
     732                //Chek if it was alredy a slot in use for this user 
     733                for (int i=0;i<numSlots;i++) 
     734                        //It was the user? 
     735                        if (mosaicSlots[i]==id) 
     736                        { 
     737                                //Set it free 
     738                                mosaicSlots[i] = 0; 
     739                                //Break 
     740                                break; 
     741                        }  
    678742 
    679743        //Set it 
Copyright 2006 - Sergio García Murillo
Powered by Trac - Edgewall Software