Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.5 KiB

  1. /**********************************************************************
  2. Copyright (c) Microsoft Corporation 1996. All Rights Reserved
  3. Timecode header file
  4. Format: NTSC, PAL or Film
  5. Dropframe or not
  6. Rates: 29.97 -> NTSC (4 field drop), Brazilian M-PAL (8 field drop)
  7. 30 -> NTSC, Brazilian PAL (non-dropframe)
  8. 24 -> Film
  9. 25 -> PAL
  10. Ken Greenebaum, November 1996
  11. **********************************************************************/
  12. #ifndef _H_TIMECODE
  13. #define _H_TIMECODE
  14. #include <wtypes.h>
  15. #define TIMECODE_STRING_LENGTH 12 // 00:00:00:00 (XXX this is temporary?)
  16. class TimeCode {
  17. public:
  18. TimeCode();
  19. TimeCode(int hours, int min, int sec, int frames,
  20. BOOL ntsc=TRUE, BOOL drop=FALSE);
  21. TimeCode(char *string, BOOL ntsc=TRUE, BOOL drop=FALSE);
  22. void operator--(); // prefix
  23. void operator--(int); // postfix
  24. void operator++(); // prefix
  25. void operator++(int); // postfix
  26. int operator==(TimeCode tc)
  27. {_GetFrame(); return(_frames.frames == tc.GetTime()); }
  28. int operator>(TimeCode tc)
  29. {_GetFrame(); return(_frames.frames > tc.GetTime()); }
  30. int operator<(TimeCode tc)
  31. {_GetFrame(); return(_frames.frames < tc.GetTime()); }
  32. int operator<=(TimeCode tc)
  33. {_GetFrame(); return(_frames.frames <= tc.GetTime()); }
  34. int operator>=(TimeCode tc)
  35. {_GetFrame(); return(_frames.frames >= tc.GetTime()); }
  36. void SetTime(int hours, int minutes, int seconds, int frames);
  37. void SetTime(char *string);
  38. void SetFormat(BOOL ntsc, BOOL dropframe);
  39. void GetTime(int *hours, int *minutes, int *seconds, int *frames);
  40. LONGLONG GetTime();
  41. void GetString(char *string);
  42. private:
  43. struct {
  44. int hours;
  45. int minutes;
  46. int seconds;
  47. int frames;
  48. BOOL dirty;
  49. } _hmsf;
  50. struct {
  51. LONGLONG frames;
  52. BOOL dirty;
  53. } _frames;
  54. void _HMSFfromFrames();
  55. void _FramesFromHMSF();
  56. inline void _GetFrame() { if(_frames.dirty) _FramesFromHMSF(); }
  57. static const char NTSC_MODE;
  58. static const char PAL_MODE;
  59. static const char FORMAT_MASK;
  60. static const char DROPFRAME_MODE;
  61. static const char NO_DROPFRAME_MODE;
  62. static const char DROPFRAME_MASK;
  63. static const char NTSC_NODROP;
  64. static const char NTSC_DROP;
  65. static const char PAL_NODROP;
  66. static const char PAL_DROP;
  67. unsigned char _timeCodeFormat; // describe format based on the above consts
  68. };
  69. #endif /* _H_TIMECODE */