encoder_listener.h 3.1 KB

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