VideoDecoder.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef VIDEODECODER_H
  2. #define VIDEODECODER_H
  3. #include <stdint.h>
  4. #include <semaphore.h>
  5. #include "ark_api.h"
  6. #include "mfcapi.h"
  7. #include "dwl.h"
  8. #define MAX_STREAM_BUFFER_SIZE (1024*1024)
  9. #ifdef __cplusplus
  10. struct VideoFrame{
  11. int src_offset_x;
  12. int src_offset_y;
  13. int src_width;
  14. int src_height;
  15. int dst_offset_x;
  16. int dst_offset_y;
  17. int dst_width;
  18. int dst_height;
  19. int rotate;
  20. };
  21. struct display_info{
  22. disp_handle *display_handle;
  23. int lay_id;
  24. unsigned int disp_posx;
  25. unsigned int disp_posy;
  26. unsigned int disp_width;
  27. unsigned int disp_height;
  28. struct ark_reqbuf reqbuf;
  29. };
  30. class VideoDecoder
  31. {
  32. public:
  33. VideoDecoder();
  34. static VideoDecoder *instance();
  35. //init decoder
  36. bool Init(VideoFrame* pVideoFrame);
  37. void Uninit();
  38. //open video layer
  39. bool Open(VideoFrame* pVideoFrame);
  40. bool Close();
  41. bool Show(bool bVisible);
  42. int InputDecoder(const void *data, int length);
  43. private:
  44. #ifndef BPS_DECODE
  45. int DrawLayer(display_info *pinfo);
  46. int MallocMemory();
  47. int FreeMemory();
  48. display_info * disp_layer_init(enum ark_disp_layer layer, int format, int width, int height, int buf_cnt);
  49. #endif
  50. private:
  51. static VideoDecoder *mInstance;
  52. VideoFrame *mpVideoFrame;
  53. bool m_bReady;
  54. #ifdef BPS_DECODE
  55. video_handle *mHandle;
  56. #else
  57. int m_mapSize;
  58. //save bus add y address
  59. unsigned int myBusAddress;
  60. OutFrameBuffer mOutBuffer;
  61. DWLLinearMem_t mInBuffer;
  62. MFCHandle *mMFCHanle;
  63. memalloc_handle * mMemHandle;
  64. reqbuf_info* mInreqbuf;
  65. //save bus add y address
  66. int mFdMemalloc;
  67. // display_info *overlay;
  68. display_info *overlay;
  69. #endif
  70. };
  71. #endif
  72. #endif // VIDEODECODER_H