1 /*
2 * Copyright (C) 2023 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 #include "avmuxer_demo_common.h"
17 #include <sys/time.h>
18 #include <time.h>
19
20 struct AudioTrackParam g_audioMpegPar = {
21 .fileName = "mpeg_44100_2.dat",
22 .mimeType = "audio/mpeg",
23 .sampleRate = 44100,
24 .channels = 2,
25 .frameSize = 1152,
26 };
27
28 struct AudioTrackParam g_audioAacPar = {
29 .fileName = "aac_44100_2.dat",
30 .mimeType = "audio/mp4a-latm",
31 .sampleRate = 44100,
32 .channels = 2,
33 .frameSize = 1024,
34 };
35
36 struct VideoTrackParam g_videoH264Par = {
37 .fileName = "h264_720_480.dat",
38 .mimeType = "video/avc",
39 .width = 720,
40 .height = 480,
41 .frameRate = 60,
42 .videoDelay = 0,
43 };
44
45 struct VideoTrackParam g_videoMpeg4Par = {
46 .fileName = "mpeg4_720_480.dat",
47 .mimeType = "video/mp4v-es",
48 .width = 720,
49 .height = 480,
50 .frameRate = 60,
51 .videoDelay = 0,
52 };
53
54 struct VideoTrackParam g_videoH265Par = {
55 .fileName = "h265_720_480.dat",
56 .mimeType = "video/hevc",
57 .width = 720,
58 .height = 480,
59 .frameRate = 60,
60 .videoDelay = 2,
61 };
62
63 struct VideoTrackParam g_jpegCoverPar = {
64 .fileName = "greatwall.jpg",
65 .mimeType = "image/jpeg",
66 .width = 352,
67 .height = 288,
68 };
69
70 struct VideoTrackParam g_pngCoverPar = {
71 .fileName = "greatwall.png",
72 .mimeType = "image/png",
73 .width = 352,
74 .height = 288,
75 };
76
77 struct VideoTrackParam g_bmpCoverPar = {
78 .fileName = "greatwall.bmp",
79 .mimeType = "image/bmp",
80 .width = 352,
81 .height = 288,
82 };
83
84 const char *RUN_NORMAL = "normal";
85 const char *RUN_MUL_THREAD = "multhrd";
86
GetTimestamp(void)87 long long GetTimestamp(void)
88 {
89 static const int timeScaleUs = 1000000;
90 long long tmp;
91 struct timeval tv;
92
93 gettimeofday(&tv, NULL);
94 tmp = tv.tv_sec;
95 tmp = tmp * timeScaleUs;
96 tmp = tmp + tv.tv_usec;
97
98 return tmp;
99 }