mpp_opt.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2021 Rockchip Electronics Co. LTD
  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. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef __MPP_OPT_H__
  17. #define __MPP_OPT_H__
  18. #include "rk_type.h"
  19. /*
  20. * return zero or positive for option parser aproach step
  21. * return negative for failure or option help
  22. */
  23. typedef RK_S32 (*OptParser)(void *ctx, const char *next);
  24. typedef struct MppOptInfo_t {
  25. const char* name;
  26. const char* full_name;
  27. const char* help;
  28. OptParser proc;
  29. } MppOptInfo;
  30. typedef void* MppOpt;
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. MPP_RET mpp_opt_init(MppOpt *opt);
  35. MPP_RET mpp_opt_deinit(MppOpt opt);
  36. MPP_RET mpp_opt_setup(MppOpt opt, void *ctx);
  37. /* Add NULL info to mark end of options */
  38. MPP_RET mpp_opt_add(MppOpt opt, MppOptInfo *info);
  39. MPP_RET mpp_opt_parse(MppOpt opt, int argc, char **argv);
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif /*__MPP_OPT_H__*/