home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / dctm.lzh / DCTM / source.lzh / source / TIMECODE.H < prev    next >
Encoding:
C/C++ Source or Header  |  2003-02-08  |  1.4 KB  |  62 lines

  1. /*************************************************************************
  2.     timecode.h
  3.  
  4.     03/02/08    Xiaohong
  5. *************************************************************************/
  6. #ifndef _INCLUDE_TIMECODE_H___________________________
  7. #define _INCLUDE_TIMECODE_H___________________________
  8.  
  9. #include <windows.h>
  10.  
  11. #define MAX_FFFFFFFF        4294967295.0     /* = 0xffffffff in dec.    */
  12.  
  13. class Timecode_struc     /* Time_code Struktur laut MPEG        */
  14. {
  15. public:
  16.     Timecode_struc();
  17.     void set(const unsigned long,const unsigned long);
  18.     void empty(void);
  19.     void make(double);
  20.     void write_file(HANDLE);
  21.     bool read_file(HANDLE);
  22.     void buffer(const unsigned char marker,unsigned char** buffer);
  23.  
  24.     inline Timecode_struc& operator=(Timecode_struc&);
  25.     Timecode_struc& operator+(Timecode_struc&);
  26.  
  27.     inline unsigned long get_msb(void)
  28.     {
  29.         return msb;
  30.     }
  31.     inline unsigned long get_lsb(void)
  32.     {
  33.         return lsb;
  34.     }
  35.     inline double timecode(void)
  36.     {
  37.         return msb * MAX_FFFFFFFF + lsb;
  38.     }
  39.  
  40. private:
  41.     unsigned long msb;        /* fuer SCR, DTS, PTS            */
  42.     unsigned long lsb;
  43. };
  44.  
  45. inline Timecode_struc& Timecode_struc::operator=(Timecode_struc& that)
  46. {
  47.     msb = that.get_msb();
  48.     lsb = that.get_lsb();
  49.  
  50.     return *this;
  51. }
  52.  
  53.  
  54. inline bool comp_timecode(Timecode_struc* TS1,Timecode_struc* TS2)
  55. {
  56.     if(TS1->timecode()<=TS2->timecode())
  57.     {
  58.         return true;
  59.     }
  60.     return false;
  61. }
  62. #endif