Skip to content

Commit 471a3fb

Browse files
committed
fix: localized mp4 demuxer
1 parent 189701d commit 471a3fb

4 files changed

Lines changed: 248 additions & 257 deletions

File tree

iOS/APIExample/APIExample/Common/Utils/KFMP4Demuxer.h

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010
#import <AVFoundation/AVFoundation.h>
1111
#import <CoreMedia/CoreMedia.h>
1212

13-
1413
typedef NS_ENUM(NSInteger, KFMediaType) {
1514
KFMediaNone = 0,
16-
KFMediaAudio = 1 << 0, // 仅音频。
17-
KFMediaVideo = 1 << 1, // 仅视频。
18-
KFMediaAV = KFMediaAudio | KFMediaVideo, // 音视频都有。
15+
KFMediaAudio = 1 << 0, // Audio only.
16+
KFMediaVideo = 1 << 1, // Video only.
17+
KFMediaAV = KFMediaAudio | KFMediaVideo, // Both audio and video.
1918
};
2019

2120
typedef NS_ENUM(NSInteger, KFMP4DemuxerStatus) {
@@ -28,8 +27,8 @@ typedef NS_ENUM(NSInteger, KFMP4DemuxerStatus) {
2827

2928

3029
@interface KFDemuxerConfig : NSObject
31-
@property (nonatomic, strong) AVAsset *asset; // 待解封装的资源。
32-
@property (nonatomic, assign) KFMediaType demuxerType; // 解封装类型。
30+
@property (nonatomic, strong) AVAsset *asset; // The resource to be demuxed.
31+
@property (nonatomic, assign) KFMediaType demuxerType; // The type of demuxing.
3332
@end
3433

3534
@interface KFVideoPacketExtraData : NSObject
@@ -46,23 +45,23 @@ typedef NS_ENUM(NSInteger, KFMP4DemuxerStatus) {
4645

4746
@property (nonatomic, strong, readonly) KFDemuxerConfig *config;
4847
@property (nonatomic, copy) void (^errorCallBack)(NSError *error);
49-
@property (nonatomic, assign, readonly) BOOL hasAudioTrack; // 是否包含音频数据。
50-
@property (nonatomic, assign, readonly) BOOL hasVideoTrack; // 是否包含视频数据。
51-
@property (nonatomic, assign, readonly) CGSize videoSize; // 视频大小。
52-
@property (nonatomic, assign, readonly) CMTime duration; // 媒体时长。
53-
@property (nonatomic, assign, readonly) CMVideoCodecType codecType; // 编码类型。
54-
@property (nonatomic, assign, readonly) KFMP4DemuxerStatus demuxerStatus; // 解封装器状态。
55-
@property (nonatomic, assign, readonly) BOOL audioEOF; // 是否音频结束。
56-
@property (nonatomic, assign, readonly) BOOL videoEOF; // 是否视频结束。
57-
@property (nonatomic, assign, readonly) CGAffineTransform preferredTransform; // 图像的变换信息。比如:视频图像旋转。
58-
@property (nonatomic, copy) void (^dataCallBack)(NSData *data, CMSampleBufferRef sampleBuffer); // 解码完成的数据回调
48+
@property (nonatomic, assign, readonly) BOOL hasAudioTrack; // Indicates whether audio data is included.
49+
@property (nonatomic, assign, readonly) BOOL hasVideoTrack; // Indicates whether video data is included.
50+
@property (nonatomic, assign, readonly) CGSize videoSize; // Size of the video.
51+
@property (nonatomic, assign, readonly) CMTime duration; // Duration of the media.
52+
@property (nonatomic, assign, readonly) CMVideoCodecType codecType; // Encoding type.
53+
@property (nonatomic, assign, readonly) KFMP4DemuxerStatus demuxerStatus; // Status of the demuxer.
54+
@property (nonatomic, assign, readonly) BOOL audioEOF; // Indicates whether audio has ended.
55+
@property (nonatomic, assign, readonly) BOOL videoEOF; // Indicates whether video has ended.
56+
@property (nonatomic, assign, readonly) CGAffineTransform preferredTransform; // Transformation information for the image, e.g., video image rotation.
57+
@property (nonatomic, copy) void (^dataCallBack)(NSData *data, CMSampleBufferRef sampleBuffer); // Callback for decoded data
5958

60-
- (void)startReading; // 开始读取数据解封装。
61-
- (void)cancelReading; // 取消读取。
59+
- (void)startReading; // Start reading data for demuxing.
60+
- (void)cancelReading; // Cancel reading.
6261

63-
- (BOOL)hasAudioSampleBuffer; // 是否还有音频数据。
64-
- (CMSampleBufferRef)copyNextAudioSampleBuffer CF_RETURNS_RETAINED; // 拷贝下一份音频采样。
62+
- (BOOL)hasAudioSampleBuffer; // Indicates whether there are more audio samples.
63+
- (CMSampleBufferRef)copyNextAudioSampleBuffer CF_RETURNS_RETAINED; // Copy the next audio sample.
6564

66-
- (BOOL)hasVideoSampleBuffer; // 是否还有视频数据。
67-
- (CMSampleBufferRef)copyNextVideoSampleBuffer CF_RETURNS_RETAINED; // 拷贝下一份视频采样。
65+
- (BOOL)hasVideoSampleBuffer; // Indicates whether there are more video samples.
66+
- (CMSampleBufferRef)copyNextVideoSampleBuffer CF_RETURNS_RETAINED; // Copy the next video sample.
6867
@end

0 commit comments

Comments
 (0)