ifc_avivideodecoder.h 2.1 KB

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