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 GST_COMMON_UTILS_H 17 #define GST_COMMON_UTILS_H 18 19 #include <stdint.h> 20 #include <gst/gst.h> 21 22 // only C style code is accepted in this file 23 struct VideoFrameBuffer { 24 uint32_t keyFrameFlag; 25 uint64_t timeStamp; 26 uint64_t duration; 27 uint64_t size; 28 uint32_t pixelFormat; 29 GstBuffer *gstBuffer; 30 }; 31 32 struct EsAvcCodecBuffer { 33 uint32_t width; 34 uint32_t height; 35 uint64_t segmentStart; 36 GstBuffer *gstCodecBuffer; 37 }; 38 39 enum VideoStreamType { 40 VIDEO_STREAM_TYPE_UNKNOWN = 0, 41 VIDEO_STREAM_TYPE_ES_AVC, 42 VIDEO_STREAM_TYPE_YUV_420, 43 }; 44 45 enum CodecBinType { 46 CODEC_BIN_TYPE_UNKNOWN = -1, 47 CODEC_BIN_TYPE_VIDEO_ENCODER = 0, 48 CODEC_BIN_TYPE_VIDEO_DECODER, 49 CODEC_BIN_TYPE_AUDIO_ENCODER, 50 CODEC_BIN_TYPE_AUDIO_DECODER, 51 }; 52 53 struct AudioBuffer { 54 uint64_t timestamp; 55 uint32_t dataSeq; 56 uint32_t dataLen; 57 uint64_t duration; 58 GstBuffer *gstBuffer; 59 }; 60 61 enum AudioStreamType { 62 AUDIO_STREAM_TYPE_UNKNOWN = 0, 63 AUDIO_STREAM_TYPE_PCM_S32_LE, 64 }; 65 66 enum AudioSourceType { 67 AUDIO_SOURCE_TYPE_UNKNOWN = -1, 68 AUDIO_SOURCE_TYPE_DEFAULT = 0, 69 AUDIO_SOURCE_TYPE_MIC = 1, 70 }; 71 #endif // GST_COMMON_UTILS_H 72