美摄SDK For iOS  3.7.2
NvsMediaFileConvertor.h
浏览该文件的文档.
1 //================================================================================
2 //
3 // (c) Copyright China Digital Video (Beijing) Limited, 2019. All rights reserved.
4 //
5 // This code and information is provided "as is" without warranty of any kind,
6 // either expressed or implied, including but not limited to the implied
7 // warranties of merchantability and/or fitness for a particular purpose.
8 //
9 //--------------------------------------------------------------------------------
10 // Birth Date: Apr 20. 2019
11 // Author: NewAuto video team
12 //================================================================================
13 #pragma once
14 
15 #import <UIKit/UIImage.h>
16 #import "NvsCommonDef.h"
17 
18 
27 typedef enum {
28  keNvsMediaConvertorErrorType_NoError = 0,
29  keNvsMediaConvertorErrorType_Cancled,
30  keNvsMediaConvertorErrorType_HardwareVideoEncoderSetupError,
31  keNvsMediaConvertorErrorType_HardwareVideoEncodingError,
32  keNvsMediaConvertorErrorType_HardwareVideoDecoderSetupError,
33  keNvsMediaConvertorErrorType_HardwareVideoDecodingError,
34  keNvsMediaConvertorErrorType_ProcessVideoError,
35  keNvsMediaConvertorErrorType_ProcessAudioError,
36  keNvsMediaConvertorErrorType_ReadFileEof,
37  keNvsMediaConvertorErrorType_UnkownError = 65535
38 } NvsMediaConvertorErrorType;
39 
48 #define NVS_MEDIA_CONVERTOR_CUSTOM_HEIGHT @"custom-video-height"
50 #define NVS_MEDIA_CONVERTOR_CUSTOM_AUDIO_SAMPLE_RATE @"custom-audio-sample-rate"
51 #define NVS_MEDIA_CONVERTOR_NO_VIDEO @"convertor-no-video"
52 #define NVS_MEDIA_CONVERTOR_NO_AUDIO @"convertor-no-audio"
53 #define NVS_MEDIA_CONVERTOR_CUSTOM_AUDIO_CHANNEL @"custom-audio-channel"
54 #define NVS_MEDIA_CONVERTOR_REVERSE_AUDIO_STREAM @"convertor-reverse-audio"
55 #define NVS_MEDIA_CONVERTOR_MAX_CACHE_SIZE_IN_MEMORY @"max_cache_size_in_memory"
56 #define NVS_MEDIA_CONVERTOR_CUSTOM_FRAME_RATE @"custom-video-frame-rate"
57 #define NVS_MEDIA_CONVERTOR_CUSTOM_AUDIO_PCM_FILE @"custom-audio-pcm-file"
58 #define NVS_MEDIA_CONVERTOR_COMPILE_GOP_SIZE @"gopsize"
59 #define NVS_MEDIA_CONVERTOR_COMPILE_BITRATE @"bitrate"
60 #define NVS_MEDIA_CONVERTOR_COMPILE_AUDIO_BITRATE @"audio bitrate"
61 
64 @protocol NvsMediaFileConvertorDelegate<NSObject>
65 
66 - (void)didConvertorProgress:(int64_t)taskId progress:(float)progress;
67 
68 - (void)didConvertorFinish:(int64_t)taskId sourceFile:(NSString*)src outputFile:(NSString*)dst errorCode:(NvsMediaConvertorErrorType)error;
69 
70 - (void)didAudioMuteRage:(int64_t)taskId muteStart:(int64_t)start muteEnd:(int64_t)end;
71 
72 @end
73 
74 
75 NVS_EXPORT @interface NvsMediaFileConvertor : NSObject
76 
77 @property (nonatomic, weak) id<NvsMediaFileConvertorDelegate> delegate;
78 
79 - (instancetype)init;
80 
81 - (int64_t)convertMeidaFile:(NSString *)srcFilePath
82  outputFile:(NSString *)outputFilePath
83  isReverseConvert:(bool)isReverse
84  fromPosition:(int64_t)from
85  toPosition:(int64_t)to
86  options:(NSMutableDictionary *)options;
87 
88 - (void)cancelTask:(int64_t)taskId;
89 
90 @end
NVS_EXPORT
#define NVS_EXPORT
Definition: NvsCommonDef.h:20
NvsCommonDef.h