mpegator.h
上传用户:psq1974
上传日期:2007-01-06
资源大小:1195k
文件大小:2k
- /* Copyright (C) 1998, 1999 State University of New York at Stony Brook
- Author: Andrew V. Shuvalov ( andrew@ecsl.cs.sunysb.edu )
- Software license is located in file "COPYING"
- */
- #ifndef _mpegator_h_
- #define _mpegator_h_
- class mpegator : public video_thread
- {
- /** instance of the mpegator OLE */
- IMtrCapture* mpeg;
- /** flag */
- bool captureStarted;
- /** mutex to lock all operations on mpegator: do not lock it for a while! */
- mutex mpeg_ops_mutex;
- /** mpegator have some
- synchronization issues: if you ask the driver is new data available, get
- negative reply and then immediately try to repeat the query it reply
- with "yes" but in fact data are not there yet.
- */
- bool wait_forobject_next_time;
- /** just video buffer. This code was modified several times. The first
- approach was to call StreamGetPtr/send to network/StreamReleasePtr.
- That does not work because send to network call corrupts something
- inside mpegator driver and output is junk. Then i did try to copy
- data into small buffer, release the stream pointer and immediately
- send data to the network. That does not work, because computer resources
- were exhausted and significant percent of data was lost. Finally
- i made data to be copied into large buffer and send happens once per
- few calls of check_for_new_data()
- */
- char video_buffer[100000];
- /** is related to the buffer above */
- unsigned video_data_size;
- public:
- mpegator( int argc, char **argv );
- virtual void init();
- virtual ~mpegator();
- virtual void shutdown();
- virtual bool is_shutdown_performed() { return shutdown_performed; }
- /** start */
- virtual void start_capture();
- /** stop */
- virtual void stop_capture();
- virtual void check_for_new_data();
- };
- #endif // _mpegator_h_