00001 #ifndef DEVICEDVBINPUT_H 00002 #define DEVICEDVBINPUT_H 00003 00004 #include "channel.inc" 00005 #include "condition.inc" 00006 #include "garbage.h" 00007 #include "mwindow.inc" 00008 #include "recordconfig.inc" 00009 #include <stdint.h> 00010 #include "thread.h" 00011 00012 00013 // This is the common interface for the DVB recording devices. 00014 // It handles the network connection to the DVB tuner. 00015 00016 00017 class DeviceDVBInput : public GarbageObject 00018 { 00019 public: 00020 DeviceDVBInput(MWindow *mwindow, 00021 VideoInConfig *config); 00022 ~DeviceDVBInput(); 00023 00024 void reset(); 00025 00026 int close(); 00027 int try_tuner(); 00028 int reopen_tuner(); 00029 int get_signal_strength(int channel, int tuner_id); 00030 00031 // Provides multiplexed data. Each caller needs its own demuxer. 00032 // Returns the number of bytes read. 00033 // Initial opening and channel changes are handled in here. 00034 int read_stream(unsigned char *data, int size); 00035 00036 // Access the socket 00037 int read_tuner(unsigned char *data, int size); 00038 int write_tuner(unsigned char *data, int size); 00039 int write_int64(int64_t value); 00040 int64_t read_int64(int *error); 00041 00042 // Acquire the global DVB input thread 00043 // by either referencing MWindow::dvb_input or creating a new one. 00044 // Then try to connect to the tuner and begin streaming immediately. 00045 // Return 0 if failure. 00046 static DeviceDVBInput* get_input_thread(MWindow *mwindow); 00047 // Release the global DVB input thread by either deleting it or decreasing 00048 // the reference counter. 00049 static void put_input_thread(MWindow *mwindow); 00050 00051 00052 VideoInConfig *config; 00053 int tuner_fd; 00054 int want_signal; 00055 Condition *signal_lock; 00056 int lock_result; 00057 int signal_result; 00058 int channel_changed; 00059 MWindow *mwindow; 00060 Channel *channel; 00061 }; 00062 00063 00064 00065 00066 #endif 00067
1.5.5