VideoDecoder.h 1.8 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 "display.h"
  7. #include "mfcapi.h"
  8. #include "dwl.h"
  9. #define DISPLAY_LAYER 1
  10. //#define TVOUT_LAYER 3
  11. #define TVOUT_WIDTH 720
  12. #define TVOUT_HEIGHT 480
  13. #define MEMALLOC_MODULE_PATH "/dev/memalloc"
  14. #define MAX_STREAM_BUFFER_SIZE (1024*1024)
  15. #define SOFT_DECODEC 0
  16. struct VideoFrame{
  17. int handle;
  18. int offset_x;
  19. int offset_y;
  20. int src_width;
  21. int src_height;
  22. int dst_width;
  23. int dst_height;
  24. };
  25. struct display_info{
  26. disp_handle *display_handle;
  27. int lay_id;
  28. unsigned int disp_posx;
  29. unsigned int disp_posy;
  30. unsigned int disp_width;
  31. unsigned int disp_height;
  32. struct ark_reqbuf reqbuf;
  33. };
  34. struct test_info{
  35. int platform;
  36. int pic_format;
  37. char filepath[64];
  38. };
  39. class VideoDecoder
  40. {
  41. public:
  42. VideoDecoder();
  43. static VideoDecoder *instance();
  44. //init decoder
  45. bool Init(VideoFrame* pVideoFrame);
  46. void Uninit();
  47. //open video layer
  48. bool Open(VideoFrame* pVideoFrame);
  49. bool Close();
  50. bool Show(bool bVisible);
  51. int InputDecoder(const void *data, int length);
  52. private:
  53. int DrawLayer(display_info *pinfo);
  54. int MallocMemory();
  55. int FreeMemory();
  56. display_info * disp_layer_init(enum ark_disp_layer layer, int format, int width, int height, int buf_cnt);
  57. private:
  58. static VideoDecoder *mInstance;
  59. int m_nDecodeFrame;
  60. VideoFrame *mpVideoFrame;
  61. MFCHandle *mMFCHanle;
  62. memalloc_handle * mMemHandle;
  63. int m_mapSize;
  64. //save bus add y address
  65. unsigned int myBusAddress;
  66. int mFdMemalloc;
  67. // display_info *overlay;
  68. display_info *overlay;
  69. OutFrameBuffer mOutBuffer;
  70. DWLLinearMem_t mInBuffer;
  71. bool m_bReady;
  72. };
  73. #endif // VIDEODECODER_H