1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef XTS_ACTS_MEDIA_TEST_UTILS_H
17#define XTS_ACTS_MEDIA_TEST_UTILS_H
18
19#include <stdio.h>
20#include <stdlib.h>
21#include <unistd.h>
22#include <cstring>
23#include <fcntl.h>
24#include <fstream>
25#include <iostream>
26#include <sstream>
27#include <sys/stat.h>
28#include <sys/time.h>
29#include <sys/types.h>
30#include <unistd.h>
31
32const int32_t RET_OK = 0;
33const int32_t RET_ERR = -1;
34const int32_t FrameErrCode = -1;         // frame error code
35const int32_t RecoderSourceMaxCount = 4; // max recorder source setting
36const int32_t FdNull = -1;               // fd is null
37
38/* *
39 * get current dir
40 * @return  string - current file path of the test suits
41 */
42std::string GetCurDir();
43
44/* *
45 * check if file exist
46 * @param filename filename
47 * @return  check result RET_OK or RET_ERR
48 */
49int32_t FileCheck(const char *filename);
50
51/* *
52 * Save Capture picture
53 * @param p char ptr
54 * @param size char size
55 * @return pic saved success or failed retur RET_OK or RET_ERR
56 */
57int32_t SampleSaveCapture(std::string g_testPath, const char *p, uint32_t size);
58
59/* *
60 * get recorder fd
61 * @return fd
62 */
63int32_t SampleGetRecordFd(std::string &recordFilePath);
64
65#endif // XTS_ACTS_MEDIA_TEST_UTILS_H