fakesink.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*************************************************************************
  2. * Copyright (C) [2020] by Cambricon, Inc. All rights reserved
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  15. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. * THE SOFTWARE.
  19. *************************************************************************/
  20. #ifndef MODULES_CONTRIB_FAKESINK_HPP_
  21. #define MODULES_CONTRIB_FAKESINK_HPP_
  22. #include <memory>
  23. #include <string>
  24. #include "cnstream_module.hpp"
  25. namespace cnstream {
  26. /**
  27. * @brief FakeSink is a module for synchronization.
  28. */
  29. class FakeSink : public Module, public ModuleCreator<FakeSink> {
  30. public:
  31. /**
  32. * @brief Generate FakeSink
  33. *
  34. * @param Name : module name
  35. *
  36. * @return None
  37. */
  38. explicit FakeSink(const std::string& name);
  39. /**
  40. * @brief Release FakeSink
  41. *
  42. * @param None
  43. *
  44. * @return None
  45. */
  46. ~FakeSink() {}
  47. /**
  48. * @brief Called by pipeline when pipeline start.
  49. *
  50. * @param paramSet : void
  51. *
  52. * @return if module open succeed
  53. */
  54. bool Open(ModuleParamSet paramSet) override;
  55. /**
  56. * @brief Called by pipeline when pipeline stop
  57. *
  58. * @param None
  59. *
  60. * @return None
  61. */
  62. void Close() override;
  63. /**
  64. * @brief Process data
  65. *
  66. * @param data : data to be processed
  67. *
  68. * @return whether process succeed
  69. * @retval 0: succeed and do no intercept data
  70. */
  71. int Process(std::shared_ptr<CNFrameInfo> data) override;
  72. /**
  73. * @brief Check ParamSet for a module.
  74. *
  75. * @param paramSet Parameters for this module.
  76. *
  77. * @return Returns true if this API run successfully. Otherwise, returns false.
  78. */
  79. bool CheckParamSet(const ModuleParamSet& paramSet) const override;
  80. }; // class FakeSink
  81. } // namespace cnstream
  82. #endif // MODULES_CONTRIB_FAKESINK_HPP_