ifc_mkvvideodecoder.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #pragma once
  2. #include <bfc/dispatch.h>
  3. class NOVTABLE ifc_mkvvideodecoder : public Dispatchable
  4. {
  5. protected:
  6. ifc_mkvvideodecoder() {}
  7. ~ifc_mkvvideodecoder() {}
  8. public:
  9. enum
  10. {
  11. MKV_SUCCESS = 0,
  12. MKV_NEED_MORE_INPUT = -1,
  13. MKV_FAILURE=1,
  14. };
  15. int GetOutputProperties(int *x, int *y, int *color_format, double *aspect_ratio);
  16. int DecodeBlock(const void *inputBuffer, size_t inputBufferBytes, uint64_t timestamp);
  17. void Flush();
  18. void Close();
  19. int GetPicture(void **data, void **decoder_data, uint64_t *timestamp);
  20. void FreePicture(void *data, void *decoder_data);
  21. void EndOfStream(); // signal to the decoder that the video bitstream is over - flush any buffered frames
  22. void HurryUp(int state); // 1 = hurry up (drop unnecessary frames), 0 = revert to normal
  23. DISPATCH_CODES
  24. {
  25. GET_OUTPUT_PROPERTIES = 0,
  26. DECODE_BLOCK = 1,
  27. FLUSH = 2,
  28. CLOSE = 3,
  29. GET_PICTURE = 4,
  30. FREE_PICTURE = 5,
  31. END_OF_STREAM = 6,
  32. HURRY_UP = 7,
  33. };
  34. };
  35. inline int ifc_mkvvideodecoder::GetOutputProperties(int *x, int *y, int *color_format, double *aspect_ratio)
  36. {
  37. return _call(GET_OUTPUT_PROPERTIES, (int)MKV_FAILURE, x, y, color_format, aspect_ratio);
  38. }
  39. inline int ifc_mkvvideodecoder::DecodeBlock(const void *inputBuffer, size_t inputBufferBytes, uint64_t timestamp)
  40. {
  41. return _call(DECODE_BLOCK, (int)MKV_FAILURE, inputBuffer, inputBufferBytes, timestamp);
  42. }
  43. inline void ifc_mkvvideodecoder::Flush()
  44. {
  45. _voidcall(FLUSH);
  46. }
  47. inline void ifc_mkvvideodecoder::Close()
  48. {
  49. _voidcall(CLOSE);
  50. }
  51. inline int ifc_mkvvideodecoder::GetPicture(void **data, void **decoder_data, uint64_t *timestamp)
  52. {
  53. return _call(GET_PICTURE, (int)MKV_FAILURE, data, decoder_data, timestamp);
  54. }
  55. inline void ifc_mkvvideodecoder::FreePicture(void *data, void *decoder_data)
  56. {
  57. _voidcall(FREE_PICTURE, data, decoder_data);
  58. }
  59. inline void ifc_mkvvideodecoder::EndOfStream()
  60. {
  61. _voidcall(END_OF_STREAM);
  62. }
  63. inline void ifc_mkvvideodecoder::HurryUp(int state)
  64. {
  65. _voidcall(HURRY_UP, state);
  66. }