receiver_ctrl.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) Massimo Cora' 2005 <maxcvs@email.it>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #ifndef __RECEIVER_CTRL_H__
00020 #define __RECEIVER_CTRL_H__
00021 
00022 
00023 #include <wx/wx.h>
00024 #include <OStream.hh>
00025 #include "main_frame.h"
00026 
00027 // opencv
00028 #include <cv.h>
00029 #include <highgui.h>
00030 
00031 // fmod
00032 #ifdef __LINUX__
00033 #include <fmodex/fmod.hpp>
00034 #include <fmodex/fmod.h>
00035 #include <fmodex/fmod_errors.h>
00036 #else
00037 #include <fmod.hpp>
00038 #include <fmod.h>
00039 #include <fmod_errors.h>
00040 #endif
00041 
00042 
00043 
00044 typedef struct _image_received_data {
00045         IplImage* image;
00046         int stream_id;
00047 
00048 } image_received_data_t;
00049 
00050 
00051 typedef struct _audio_frame_received_data {
00052         unsigned char* audio;
00053         int audio_size;
00054         int stream_id;
00055         
00056 } audio_received_data_t;
00057 
00058 class MainFrame;
00059 
00060 class ReceiverCtrlThread : public wxThread {
00061 
00062 public:
00063         ReceiverCtrlThread( class MainFrame * main_frame_instance );
00064         virtual ~ReceiverCtrlThread();
00065         void Create( const wxString destRTSPUrl, bool is_multi_stream = false );
00066 
00067         void StopReceiving();
00068         bool isReceiving();
00069         bool isShuttingDown();
00070 
00071         void doOmniStuffParsing( IplImage* image_received, int stream_id );
00072         void notifyMainThread( IplImage* image_received, int stream_id );
00073         void initializeOmniStuff( IplImage *image_to_parse );
00074         static bool onImageReceivedFromNet( IplImage* image_received, int stream_id, const void *client_data );
00075         static bool onAudioFrameReceivedFromNet( unsigned char* audio_buf, int audio_buf_size, 
00076                                                                                         int stream_id, const void *client_data );
00077 
00078         // just to accomplish callbacks
00079         static void fake_destroy_image_context( char*, void* );
00080         static void fake_create_image_context( char*, void* );
00081         static void ready_to_send_image( IplImage *image, int stream_id, char* __unused__, 
00082                                                                                 void* callback_data );
00083 
00084 
00085 
00086 private:        // functions
00087         void* Entry();
00088         void parseErrorStatus( int err_status );
00089 
00090         void doAudioParsing( unsigned char* audio_buf, int audio_buf_size, 
00091                                                                                 int stream_id );
00092         void fmod_init ();      
00093         static void add_available_bytes( unsigned char* bytes_to_add_buff, unsigned int bytes_to_add_size );
00094         static FMOD_RESULT F_CALLBACK fmod_read_cb(void *handle, void *buffer, 
00095                                                                   unsigned int sizebytes, unsigned int *bytesread, void *userdata);
00096         static FMOD_RESULT F_CALLBACK fmod_close_cb(void *handle, void *userdata);
00097         static FMOD_RESULT F_CALLBACK fmod_open_cb(const char *name, int unicode, unsigned int *filesize, 
00098                                                                   void **handle, void **userdata);
00099         static FMOD_RESULT F_CALLBACK fmod_seek_cb(void * handle, unsigned int pos, void * userdata );
00100         void ERRCHECK(FMOD_RESULT result);
00101 
00102 private:        // data
00103         OmniAlgoSimpleDetection<OmniFastLookupTable, int, IplImage, CvPoint> *_ctrl_lookup;
00104         OmniAlgoSimpleDetection<OmniGCardConverter, double, IplImage, CvPoint> *_ctrl_gcard;
00105 
00106         OmniAlgoVRFilterDetection<OmniFastLookupTable, int, IplImage, CvPoint> *_ctrl_vr_lookup;
00107         OmniAlgoVRFilterDetection<OmniGCardConverter, double, IplImage, CvPoint> *_ctrl_vr_gcard;
00108 
00109         MainFrame *_main_frame_pointer;
00110         OStreamReceiver *_receiver;
00111         bool _receiving_status;
00112         bool _shutting_down;
00113         bool _ctrl_initialized;
00114         bool _is_multi_stream;
00115         bool _gcard_use;
00116 
00117     FMOD::System     *_system;
00118     FMOD::Sound      *_sound;
00119     FMOD::Channel    *_channel;
00120     FMOD_RESULT      _result;
00121     unsigned int     _version;
00122         bool                     _fmod_initialized;
00123 
00124 };
00125 
00126 
00127 #endif

Generated on Tue Dec 26 10:32:39 2006 for Omnimeeting by  doxygen 1.4.7