svc_flvdecoder.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include <bfc/dispatch.h>
  3. #include <api/service/services.h>
  4. class ifc_flvaudiodecoder;
  5. class ifc_flvvideodecoder;
  6. class svc_flvdecoder : public Dispatchable
  7. {
  8. protected:
  9. svc_flvdecoder() {}
  10. ~svc_flvdecoder() {}
  11. public:
  12. static FOURCC getServiceType() { return WaSvc::FLVDECODER; }
  13. enum
  14. {
  15. CREATEDECODER_SUCCESS = 0,
  16. CREATEDECODER_NOT_MINE = -1, // graceful failure
  17. CREATEDECODER_FAILURE = 1, // generic failure - format_type is ours but we weren't able to create the decoder
  18. };
  19. int CreateAudioDecoder(int stereo, int bits, int sample_rate, int format, ifc_flvaudiodecoder **decoder);
  20. int CreateVideoDecoder(int format_type, int width, int height, ifc_flvvideodecoder **decoder);
  21. int HandlesAudio(int format_type);
  22. int HandlesVideo(int format_type);
  23. DISPATCH_CODES
  24. {
  25. CREATE_AUDIO_DECODER = 0,
  26. CREATE_VIDEO_DECODER = 1,
  27. HANDLES_AUDIO=2,
  28. HANDLES_VIDEO=3,
  29. };
  30. };
  31. inline int svc_flvdecoder::CreateAudioDecoder(int stereo, int bits, int sample_rate, int format, ifc_flvaudiodecoder **decoder)
  32. {
  33. return _call(CREATE_AUDIO_DECODER, (int)CREATEDECODER_NOT_MINE, stereo, bits, sample_rate, format, decoder);
  34. }
  35. inline int svc_flvdecoder::CreateVideoDecoder(int format_type, int width, int height, ifc_flvvideodecoder **decoder)
  36. {
  37. return _call(CREATE_VIDEO_DECODER, (int)CREATEDECODER_NOT_MINE, format_type,width, height, decoder);
  38. }
  39. inline int svc_flvdecoder::HandlesAudio(int format_type)
  40. {
  41. return _call(HANDLES_AUDIO, (int)CREATEDECODER_NOT_MINE, format_type);
  42. }
  43. inline int svc_flvdecoder::HandlesVideo(int format_type)
  44. {
  45. return _call(HANDLES_VIDEO, (int)CREATEDECODER_NOT_MINE, format_type);
  46. }