encoder_listener.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (c) 2019, Chips&Media
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright notice, this
  9. * list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright notice,
  11. * this list of conditions and the following disclaimer in the documentation
  12. * and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  18. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifdef USE_FEEDING_METHOD_BUFFER
  26. #include "wave511/sample_v2/component/cnm_app.h"
  27. #include "wave511/sample_v2/helper/misc/bw_monitor.h"
  28. #else
  29. #include "cnm_app.h"
  30. #include "misc/bw_monitor.h"
  31. #endif
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif /* __cplusplus */
  35. typedef struct EncListenerContext {
  36. Uint32 coreIdx;
  37. Comparator es;
  38. BOOL match;
  39. BOOL matchOtherInfo;
  40. EndianMode streamEndian;
  41. Uint32 reconWidth;
  42. Uint32 reconHeight;
  43. /* performance & bandwidth */
  44. BOOL performance;
  45. BOOL bandwidth;
  46. PFCtx pfCtx;
  47. BWCtx* bwCtx;
  48. Uint32 fps;
  49. Uint32 pfClock;
  50. char cfgFileName[MAX_FILE_PATH];
  51. BOOL headerEncDone[MAX_NUM_INSTANCE];
  52. BOOL ringBufferEnable;
  53. BOOL ringBufferWrapEnable;
  54. } EncListenerContext;
  55. void EncoderListener(
  56. Component com,
  57. Uint64 event,
  58. void* data,
  59. void* context
  60. );
  61. BOOL SetupEncListenerContext(
  62. EncListenerContext* ctx,
  63. CNMComponentConfig* config
  64. );
  65. void ClearEncListenerContext(
  66. EncListenerContext* ctx
  67. );
  68. void HandleEncFullEvent(
  69. Component com,
  70. CNMComListenerEncFull* param,
  71. EncListenerContext* ctx
  72. );
  73. void HandleEncGetOutputEvent(
  74. Component com,
  75. CNMComListenerEncDone* param,
  76. EncListenerContext* ctx
  77. );
  78. void HandleEncCompleteSeqEvent(
  79. Component com,
  80. CNMComListenerEncCompleteSeq* param,
  81. EncListenerContext* ctx
  82. );
  83. void HandleEncGetEncCloseEvent(
  84. Component com,
  85. CNMComListenerEncClose* param,
  86. EncListenerContext* ctx
  87. );
  88. #ifdef __cplusplus
  89. }
  90. #endif /* __cplusplus */