isp_venc_shake.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2021-2022 Alibaba Group. All rights reserved.
  3. * License-Identifier: Apache-2.0
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  6. * not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. #include <stdio.h>
  18. #include <unistd.h>
  19. #include "isp_venc_shake_hal.h"
  20. #ifndef NULL
  21. #define NULL ((void *)0)
  22. #endif
  23. int main(void)
  24. {
  25. void *ivs = NULL;
  26. IvsConfig config;
  27. IvsStatus status = IVS_STATUS_OK;
  28. do
  29. {
  30. status = createIspVencShake(&ivs);
  31. if (status != IVS_STATUS_OK)
  32. break;
  33. status = resetIspVencShake(ivs);
  34. config.mode = IVS_BUFFER_MODE_FRAME;
  35. config.encode = IVS_ENCODER_FORMAT_H264;
  36. config.pic_width = 640;
  37. config.pic_height = 480;
  38. config.encode_width = 640;
  39. config.encode_height = 480;
  40. config.buffer_height = 240;
  41. config.stride_y = 640;
  42. config.stride_uv = 640;
  43. config.encode_x = 0;
  44. config.encode_y = 0;
  45. status = configIspVencShake(ivs, &config);
  46. if (status != IVS_STATUS_OK)
  47. break;
  48. status = startIspVencShake(ivs);
  49. if (status != IVS_STATUS_OK)
  50. break;
  51. sleep(90);
  52. status = resetIspVencShake(ivs);
  53. if (status != IVS_STATUS_OK)
  54. break;
  55. } while (0);
  56. destroyIspVencShake(ivs);
  57. if (status != IVS_STATUS_OK)
  58. printf("ERROR: ivs_test exit with error!\n");
  59. else
  60. printf("ivs_test done!\n");
  61. return (status == IVS_STATUS_OK ? 0 : 1);
  62. }