OStreamReceiver.hh

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) Massimo Cora' 2006 <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 Library 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 _OSTREAMRECEIVER_H_
00020 #define _OSTREAMRECEIVER_H_
00021 
00022 #include <liveMedia.hh>
00023 #include <BasicUsageEnvironment.hh>
00024 
00025 #include "OStreamBufferedSink.hh"
00026 
00031 typedef enum  {
00032 
00033         ERROR_NORMAL_STATUS = 0,
00034         ERROR_FAILED_SDP_DESCRIPTION,
00035         ERROR_FAILED_FILE_SINK_CREATION,
00036         ERROR_FAILED_TO_CREATE_RECEIVER,
00037         ERROR_FAILED_CREATE_RTSP_CLIENT,
00038         ERROR_FAILED_CREATE_MEDIASESSION,
00039         ERROR_FAILED_SETUP_STREAMS,
00040         ERROR_UNKOWN_ERROR
00041 } ostream_receiver_error_codes;
00042 
00043 
00049 class OStreamReceiver
00050 {
00051 public:
00052 
00064         OStreamReceiver( const char* dest_rtsp_url,
00065                                          on_packet_video_received_cb* f_on_packet_video_received_cb,
00066                                          const void *video_callback_data,
00067                                          on_packet_audio_received_cb* f_on_packet_audio_received_cb,
00068                                          const void *audio_callback_data,
00069                                          const char* receiving_iface = "0.0.0.0",
00070                                          unsigned int sink_buffer_size = 200000 );
00071         
00072         virtual ~OStreamReceiver();
00073 
00079         int isReadyToStream();
00080         
00086         int startReceiving();
00087         
00089         void stopReceiving();
00090         
00098         static void subsessionAfterPlaying( void* mediaSubSess );
00099         static void subsessionByeHandler( void* mediaSubSess );
00100         static void startPlayingStreams( void* OStreamReceiverClassPointer );
00101         static void checkForPacketArrival(void* OStreamReceiverClassPointer );
00102 
00103 private:        // functions
00104 
00110         bool createRTSPClient();
00111         
00117         bool createMediaSession();
00118         
00125         int getSDPDescriptionFromURL( char const* url );
00126         
00128         void setupStreams();
00129         
00131         bool clientStartPlayingSession();
00132         bool clientSetupSubsession( void* mediaSubSess );
00133         void closeMediaSinks();
00134         
00139         void shutdown();
00140 
00142         on_packet_video_received_cb* f_on_packet_video_received_cb;
00143         
00145         on_packet_audio_received_cb* f_on_packet_audio_received_cb;
00146 
00147 private:        // data
00148 
00150         int _error_status;
00151         
00153         double _end_time;
00154         
00156         char* _sdp_description;
00157         
00159         const char* _client_protocol_name;
00160         
00162         char _watch_variable;
00163         
00169         unsigned int _sink_buffer_size;
00170         
00172         const void *_callback_video_data_client;
00173         
00175         const void *_callback_audio_data_client;
00176         
00178         char *_receiving_iface;
00179 
00181         UsageEnvironment* _env;
00182         TaskScheduler* _scheduler;
00183         RTSPClient* _rtsp_client;
00184         TaskToken _arrival_check_timer_task;
00185         
00193         MediaSession* _media_session;
00194 };
00195 
00196 
00197 #endif  //_OSTREAMRECEIVER_H_
00198 

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