1
0

svc_mkvdecoder.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include <bfc/dispatch.h>
  3. #include "../nsmkv/Tracks.h"
  4. #include <api/service/services.h>
  5. class ifc_mkvvideodecoder;
  6. class ifc_mkvaudiodecoder;
  7. class NOVTABLE svc_mkvdecoder : public Dispatchable
  8. {
  9. protected:
  10. svc_mkvdecoder() {}
  11. ~svc_mkvdecoder() {}
  12. public:
  13. static FOURCC getServiceType() { return WaSvc::MKVDECODER; }
  14. enum
  15. {
  16. CREATEDECODER_SUCCESS = 0,
  17. CREATEDECODER_NOT_MINE = -1, // graceful failure
  18. CREATEDECODER_FAILURE = 1, // generic failure - codec_id is ours but we weren't able to create the decoder (e.g. track_entry_data)
  19. };
  20. int CreateAudioDecoder(const char *codec_id, const nsmkv::TrackEntryData *track_entry_data, const nsmkv::AudioData *audio_data, unsigned int preferred_bits, unsigned int max_channels, bool floating_point, ifc_mkvaudiodecoder **decoder);
  21. int CreateVideoDecoder(const char *codec_id, const nsmkv::TrackEntryData *track_entry_data, const nsmkv::VideoData *video_data, ifc_mkvvideodecoder **decoder);
  22. DISPATCH_CODES
  23. {
  24. CREATE_AUDIO_DECODER = 0,
  25. CREATE_VIDEO_DECODER = 1,
  26. };
  27. };
  28. inline int svc_mkvdecoder::CreateAudioDecoder(const char *codec_id, const nsmkv::TrackEntryData *track_entry_data, const nsmkv::AudioData *audio_data, unsigned int preferred_bits, unsigned int max_channels, bool floating_point, ifc_mkvaudiodecoder **decoder)
  29. {
  30. return _call(CREATE_AUDIO_DECODER, (int)CREATEDECODER_NOT_MINE, codec_id, track_entry_data, audio_data, preferred_bits, max_channels, floating_point, decoder);
  31. }
  32. inline int svc_mkvdecoder::CreateVideoDecoder(const char *codec_id, const nsmkv::TrackEntryData *track_entry_data, const nsmkv::VideoData *video_data, ifc_mkvvideodecoder **decoder)
  33. {
  34. return _call(CREATE_VIDEO_DECODER, (int)CREATEDECODER_NOT_MINE, codec_id, track_entry_data, video_data, decoder);
  35. }