svc_burner.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include <precomp.h>
  2. #include "svc_burner.h"
  3. #include <api/api.h>
  4. #define CBCLASS svc_mediaRecorderI
  5. START_DISPATCH;
  6. CB(ISSESSIONSUPPORTED,isSessionSupported)
  7. CB(ISMEDIASUPPORTED,isMediaSupported)
  8. CB(GETNUMDEVICES,getNumDevices)
  9. CB(ENUMDEVICE,enumDevice)
  10. VCB(REFRESHDEVICES,refreshDevices)
  11. END_DISPATCH;
  12. #undef CBCLASS
  13. #define CBCLASS MediaRecorder::DeviceI
  14. START_DISPATCH;
  15. CB(GETDEPENDENCYPTR,getDependencyPtr)
  16. CB(GETDEVICENAME,getDeviceName)
  17. CB(GETDEVICETYPE,getDeviceType)
  18. CB(GETDEVICEDESCRIPTION,getDeviceDescription)
  19. CB(ENUMDEVICESPEEDS,enumDeviceSpeeds)
  20. CB(GETMEDIASIZE,getMediaSize)
  21. CB(GETMEDIAFREE,getMediaFree)
  22. VCB(CLEARSESSIONS,clearSessions)
  23. CB(ADDSESSION,addSession)
  24. CB(GETSESSION,getSession)
  25. CB(SETRECORDSPEED,setRecordSpeed)
  26. CB(SETTEST,setTest)
  27. CB(SETCLOSEDISC,setCloseDisc)
  28. CB(CANBURNNOW,canBurnNow)
  29. CB(CANCANCEL,canCancel)
  30. CB(BEGIN,begin)
  31. CB(END,end)
  32. CB(CANCEL,cancel)
  33. CB(GETSTATUS,getStatus)
  34. CB(GETPROGRESS,getProgress)
  35. CB(GETSTATUSTEXT,getStatusText)
  36. CB(GETLASTERROR,getLastError)
  37. END_DISPATCH;
  38. #undef CBCLASS
  39. #define CBCLASS MediaRecorder::SessionI
  40. START_DISPATCH;
  41. CB(GETSESSIONTYPE,getSessionType)
  42. CB(CLOSESESSION,closeSession)
  43. CB(GETNUMENTRIES,getNumEntries)
  44. CB(ENUMENTRY,enumEntry)
  45. CB(GETTOTALBYTES,getTotalBytes)
  46. CB(GETTOTALTIME,getTotalTime)
  47. END_DISPATCH;
  48. #undef CBCLASS
  49. const char *MediaRecorder::RedbookSession::enumEntry(int n) {
  50. if( n>=getNumEntries()) return NULL;
  51. return m_tracks[n]->getValue();
  52. }
  53. int MediaRecorder::RedbookSession::getTotalBytes() {
  54. double length=(double)getTotalTime();
  55. return (int)(length*(44100*4)/1000); //always 44khz 16bps stereo
  56. }
  57. int MediaRecorder::RedbookSession::getTotalTime() {
  58. int total=0;
  59. for(int i=0;i<getNumEntries();i++) {
  60. int length=0;
  61. if((length=api->metadb_getLength(m_tracks[i]->getValue()))!=-1) total+=length;
  62. }
  63. return total;
  64. }