1 /* 2 * Copyright (c) 2020-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 HI_DEMUXER_H 17 #define HI_DEMUXER_H 18 19 #include "format_type.h" 20 21 /** \addtogroup PLAYER */ 22 /** @{ */ /** <!-- [PLAYER] */ 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif /* End of #ifdef __cplusplus */ 29 30 #define HI_DEMUXER_NAME_LEN 20 31 #define HI_DEMUXER_SUPPORT_NAMES_LEN 56 32 #define HI_DEMUXER_RESOLUTION_CNT 5 33 #define HI_DEMUXER_NO_MEDIA_STREAM (-1) 34 35 #define HI_DEMUXER_ENTRY_NAME "g_stFormatEntry" 36 37 #define HI_DEMUXER_SEEK_FORWARD 1 38 #define HI_DEMUXER_SEEK_BACKWARD 2 39 40 #define HI_RET_FILE_EOF 2 41 #define HI_RET_NODATA 3 42 43 typedef struct { 44 int32_t s32VidStreamId; /**< Video stream ID. */ 45 int32_t s32AudStreamId; /**< Audio stream ID. */ 46 } FormatMediaAttr; 47 48 typedef enum { 49 HI_FORMAT_VIDEO_TYPE_H264, 50 HI_FORMAT_VIDEO_TYPE_H265, 51 HI_FORMAT_VIDEO_TYPE_JPEG, 52 HI_FORMAT_VIDEO_TYPE_BUTT 53 } HI_FORMAT_VIDEO_TYPE_E; 54 55 typedef enum { 56 HI_FORMAT_AUDIO_TYPE_AAC, 57 HI_FORMAT_AUDIO_TYPE_PCM, 58 HI_FORMAT_AUDIO_TYPE_G711A, 59 HI_FORMAT_AUDIO_TYPE_G711U, 60 HI_FORMAT_AUDIO_TYPE_MP3, 61 HI_FORMAT_AUDIO_TYPE_BUTT 62 } HI_FORMAT_AUDIO_TYPE_E; 63 64 typedef struct { 65 int32_t s32VideoStreamIndex; /**< the index of the video stream */ 66 uint32_t u32Width; /**< The height of the media file's resolution */ 67 uint32_t u32Height; /**< The width of the media file's resolution */ 68 CodecFormat enVideoType; 69 } StreamResolution; 70 71 typedef struct { 72 char *formatName; /**< File format name, in the unit of byte. */ 73 int64_t s64FileSize; /**< File size, in the unit of byte. */ 74 int64_t s64StartTime; /* the media file begin time */ 75 int64_t s64Duration; /**< Total duration of a file, in the unit of ms. */ 76 StreamResolution stSteamResolution[HI_DEMUXER_RESOLUTION_CNT]; 77 int32_t s32UsedVideoStreamIndex; /* <default used video index> */ 78 float fFrameRate; /**< the frame rate of the stream */ 79 uint32_t u32Bitrate; /**< File bit rate, in the unit of bit/s. */ 80 uint32_t u32AudioChannelCnt; 81 uint32_t u32SampleRate; /**< the sample rate of the audio stream */ 82 int32_t s32UsedAudioStreamIndex; /**< the index of the audio stream. one file may have many audio streams */ 83 uint32_t u32Width; /**< The height of the media file's resolution */ 84 uint32_t u32Height; /**< The width of the media file's resolution */ 85 CodecFormat enVideoType; 86 CodecFormat enAudioType; 87 } FormatFileInfo; 88 89 #ifdef __cplusplus 90 #if __cplusplus 91 } 92 #endif 93 #endif /* End of #ifdef __cplusplus */ 94 95 #endif 96