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.

59 lines
1.9 KiB

  1. // Copyright (c) 1996 Microsoft Corporation. All Rights Reserved.
  2. /**********************************************************************
  3. Code to test timecode routines
  4. **********************************************************************/
  5. #include <stdio.h>
  6. #include "timecode.h"
  7. #include "ltcdcode.h"
  8. __cdecl
  9. main(int argc)
  10. {
  11. LTCdecoder decoder;
  12. TimeCode timeCode(0,0,0,0);
  13. // LTCuserBits userBits;
  14. char string[TIMECODE_STRING_LENGTH];
  15. const int BUFFERSIZE = 1024;
  16. short buffer[BUFFERSIZE];
  17. int bufferSize;
  18. if(argc>1) _asm int 3; // XXX debug a program w/input from stdin!
  19. int done = 0;
  20. while(!done) {
  21. int index;
  22. // scoop up a buffer from stdin
  23. for(index = 0; (index < BUFFERSIZE) && (!done); index++) {
  24. done = (scanf("%d", &buffer[index])== -1);
  25. // printf("%d %d\n", index, buffer[index]);
  26. }
  27. short *ptr;
  28. for(bufferSize = index, ptr = buffer; bufferSize; ) {
  29. LONGLONG syncSample, endSample;
  30. // send buffer off to be decoded
  31. if(decoder.decodeBuffer(&ptr, &bufferSize)) {
  32. decoder.getStartStopSample(&syncSample, &endSample);
  33. decoder.getTimeCode(&timeCode);
  34. timeCode.GetString(string);
  35. printf("tc: %s (%d/%d)\n",
  36. string, (int)syncSample, (int)endSample);
  37. #ifdef PRINTUSERBITS
  38. if(decoder.getUserBits(&userBits)) {
  39. printf("%04x %04x %04x %04x %04x %04x %04x %04x\n",
  40. userBits.user1, userBits.user2, userBits.user3,
  41. userBits.user4, userBits.user5, userBits.user6,
  42. userBits.user7, userBits.user8);
  43. }
  44. #endif
  45. //printf("ptr= 0x%X (0x%X), bufferSize= %d\n",
  46. //ptr, buffer, bufferSize);
  47. }
  48. }
  49. }
  50. return(0);
  51. }