MeiCam SDK For iOS  3.10.0
NvsMediaFileVideoRetriever.h
Go to the documentation of this file.
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 16. 2019
11 // Author: NewAuto video team
12 //================================================================================
13 #pragma once
14 
15 #import <Foundation/Foundation.h>
16 #import "NvsAVFileInfo.h"
17 
18 
19 //private final String TAG = "NvsMediaFileVideoRetriever";
20 
21 /*
22  * 无压缩数据收集器
23  * 这个接口可以在不同线程中使用。如果确定接口不使用了,请调用release()方法
24  */
25 
26 typedef enum {
35 
36 
37 //public static final int VIDEO_RETRIEVER_FLAG_ONE_FRAME_IN_SEGMENT = 1;
38 
39 /*
40  *数据收集器回调接口
41  */
43 
44 /* \brief 通知数据
45  * \param taskId 任何id
46  * \param data 存储解码的无压缩数据,格式为YUV420P,YUV 4:2:0 12bpp ( 3通道, 一个亮度通道, 另两个为U分量和V分量通道, 所有通道都是连续的 )
47  * \param width 解码无压缩数据中图像宽度, 这里的宽度指的是420P中Y平面的宽度
48  * \param height 解码无压缩数据中图像高度, 这里的高度指的是420P中Y平面的高度
49  * \param rotation 解码输出数据的显示方向
50  * \param videoFrameSize 每一帧无压缩数据大小,字节为单位。(考虑内存对齐,有可能比实际的大)
51  */
52 - (void)notifySengmentData:(int64_t)taskId data:(void *)data width:(int)width height:(int)height rotation:(int)rotation videoFrameSize:(int)videoFrameSize;
53 
54 /* \brief 通知数据
55  * \param taskId 任何id
56  * \param videoFrameInfo 视频帧数据信息
57  */
58 - (void)notifySengmentData:(int64_t)taskId videoFrameInfo:(NvsVideoFrameInfo *)videoFrameInfo;
59 
60 /* \brief 通知进度
61  * \param taskId 任何id
62  * \param progress 已经完成的进度(范围是0到1.0)
63  */
64 - (void)notifyProgress:(int64_t)taskId progress:(float)progress;
65 /* \brief 通知进度
66  * \param taskId 任何id
67  * \param errorType 错误类型,请参考:RETRIEVER_ERROR_xxxx
68  */
69 - (void)notifyFinsih:(int64_t)taskId errorType:(NvsMediaFileVideoRetrieverError)errorType;
70 
71 @end
72 
74 
75 @property (nonatomic, weak) id<NvsMediaFileVideoRetrieverDelegate> delegate;
76 
77 
78 - (void)close;
79 - (BOOL)isClosed;
80 - (NvsAVFileInfo*)getAVFileInfo:(NSString *)avFilePath;
81 
82 /* \brief 解码部分区域
83  * \param fromPositon 需要解码的起始位置单位是毫秒
84  * \param toPosition 需要解码的结束位置单位是毫秒
85  * \param costomHeight 解码输出数据的高度,如果小于0,输出的高度和原始大小一下,最大值不能大于2160
86  * \param grabInterval 解码输出数据的间隔时间,如果小于等于0,和原始视频的一直。
87  * \param flags 解码输出的标志,参考VIDEO_RETRIEVER_FLAG_xxxx
88  * \return 返回获取的当前解码任务的id
89  */
90 - (int64_t)decodeVideoSegment:(NSString *)srcFile
91  fromPosition:(int64_t)fromPosition
92  toPosition:(int64_t)toPosition
93  customHeight:(int)customHeight
94  grabInterval:(int)grabInterval
95  flags:(int)flags;
96 
97 /* \brief 解码部分区域
98  * \param fromPositon 需要解码的起始位置单位是毫秒
99  * \param toPosition 需要解码的结束位置单位是毫秒
100  * \param outputPixelFormat 解码输出的数据格式
101  * \param costomHeight 解码输出数据的高度,如果小于0,输出的高度和原始大小一下,最大值不能大于2160
102  * \param grabInterval 解码输出数据的间隔时间,如果小于等于0,和原始视频的一直。
103  * \param flags 解码输出的标志,参考VIDEO_RETRIEVER_FLAG_xxxx
104  * \return 返回获取的当前解码任务的id
105  */
106 - (int64_t)decodeVideoSegment:(NSString *)srcFile
107  fromPosition:(int64_t)fromPosition
108  toPosition:(int64_t)toPosition
109  outputPixelFormat:(NvsVideoFramePixelFormat)outputPixelFormat
110  customHeight:(int)customHeight
111  grabInterval:(int)grabInterval
112  flags:(int)flags;
113 
114 - (void)cancelTask:(int64_t)taskId;
115 
116 @end
-[NvsMediaFileVideoRetriever close]
void close()
NvsMediaFileVideoRetrieverError_Code_No_Error
@ NvsMediaFileVideoRetrieverError_Code_No_Error
no error
Definition: NvsMediaFileVideoRetriever.h:27
NvsMediaFileVideoRetrieverError_Code_No_Cancel
@ NvsMediaFileVideoRetrieverError_Code_No_Cancel
task is canceled
Definition: NvsMediaFileVideoRetriever.h:28
NvsVideoFrameInfo
Video frame information.
Definition: NvsCommonDef.h:377
NvsMediaFileVideoRetrieverError_Video_Decoding_Error
@ NvsMediaFileVideoRetrieverError_Video_Decoding_Error
video decode error
Definition: NvsMediaFileVideoRetriever.h:32
NvsAVFileInfo
Audio and video file information.
Definition: NvsAVFileInfo.h:34
NvsMediaFileVideoRetrieverError_Video_Encode_Setup_Error
@ NvsMediaFileVideoRetrieverError_Video_Encode_Setup_Error
video encoder setup error
Definition: NvsMediaFileVideoRetriever.h:29
NvsMediaFileVideoRetriever::delegate
id< NvsMediaFileVideoRetrieverDelegate > delegate
Definition: NvsMediaFileVideoRetriever.h:75
NvsVideoFramePixelFormat
NvsVideoFramePixelFormat
Video frame pixel format.
Definition: NvsCommonDef.h:187
NvsMediaFileVideoRetrieverError
NvsMediaFileVideoRetrieverError
Definition: NvsMediaFileVideoRetriever.h:26
NvsAVFileInfo.h
NvsMediaFileVideoRetrieverError_Video_Encoding_Error
@ NvsMediaFileVideoRetrieverError_Video_Encoding_Error
video encoder error
Definition: NvsMediaFileVideoRetriever.h:30
NVS_EXPORT
#define NVS_EXPORT
Definition: NvsCommonDef.h:20
NvsMediaFileVideoRetrieverDelegate-p
Definition: NvsMediaFileVideoRetriever.h:42
NvsMediaFileVideoRetrieverError_Video_Decoder_Error
@ NvsMediaFileVideoRetrieverError_Video_Decoder_Error
video decoder setup error
Definition: NvsMediaFileVideoRetriever.h:31
NvsMediaFileVideoRetrieverError_Unknown
@ NvsMediaFileVideoRetrieverError_Unknown
task has unknown error
Definition: NvsMediaFileVideoRetriever.h:33
NvsMediaFileVideoRetriever
Definition: NvsMediaFileVideoRetriever.h:74
-[NvsMediaFileVideoRetriever isClosed]
BOOL isClosed()