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