play_commands.h
上传用户:psq1974
上传日期:2007-01-06
资源大小:1195k
文件大小:1k
源码类别:

mpeg/mp3

开发平台:

C/C++

  1. /* Copyright (C) 1998, 1999 State University of New York at Stony Brook
  2.    Author: Andrew V. Shuvalov ( andrew@ecsl.cs.sunysb.edu )
  3.    Software license is located in file "COPYING"
  4. */
  5. #ifndef _play_commands_h_
  6. #define _play_commands_h_
  7. const char _play_cmd_[] = "play";
  8. const char _stop_cmd_[] = "stop";
  9. //const char _broadcast_cmd_[] = "stop";
  10. /** those commands are described in file TextProtocol.java */
  11. const char _set_filename_[] = "setfilename";
  12. const char _start_recording_[] = "startrecording";
  13. const char _stop_recording_[] = "stoprecording";
  14. const char _accept_stream_[] = "acceptstream";
  15. const char _add_broadcast_destination_[] = "addbroadcastdestination";
  16. const char _push_server_ok_[] = "pushserverok";
  17. /** text pattern to convert date and time yyyy-MM-dd HH:mm:ss */
  18. const char _play_time_format_[] = "%04d-%02d-%02d %02d:%02d:%02d";
  19. const char _play_time_sscanf_format_[] = "%04d-%02d-%02d %02d:%02d:%02d";
  20. inline void TIMETOSTR( char *buf, const struct tm t )
  21. {
  22.   sprintf( buf, _play_time_format_, t.tm_year + 1900, t.tm_mon + 1, 
  23.    t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec );
  24. }
  25. inline void  STRTOTIME( const char *buf, struct tm &t )
  26. {
  27.   sscanf( buf, _play_time_sscanf_format_, &t.tm_year, &t.tm_mon,
  28.   &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec );
  29.   t.tm_year -= 1900;
  30.   t.tm_mon  -= 1;
  31. }
  32. inline void TMTOTIMEVAL( const struct tm &t, struct timeval &tv )
  33. {
  34.   tv.tv_sec = mktime( ( struct tm * ) &t );
  35.   tv.tv_usec = 0;
  36. }
  37. #endif   //  _play_commands_h_