|
@@ -48,6 +48,7 @@ NSInteger const VapMaxCompatibleVersion = 2;
|
|
|
@property (nonatomic, strong) QGAnimatedImageDecodeConfig *hwd_decodeConfig; //线程数与buffer数
|
|
@property (nonatomic, strong) QGAnimatedImageDecodeConfig *hwd_decodeConfig; //线程数与buffer数
|
|
|
@property (nonatomic, strong) NSOperationQueue *hwd_callbackQueue; //回调执行队列
|
|
@property (nonatomic, strong) NSOperationQueue *hwd_callbackQueue; //回调执行队列
|
|
|
@property (nonatomic, assign) BOOL hwd_onPause; //标记是否暂停中
|
|
@property (nonatomic, assign) BOOL hwd_onPause; //标记是否暂停中
|
|
|
|
|
+@property (nonatomic, assign) BOOL hwd_onSeek; //正在seek当中,此时继续播放会导致时序混乱
|
|
|
@property (nonatomic, strong) QGHWDMP4OpenGLView *hwd_openGLView; //opengl绘制图层
|
|
@property (nonatomic, strong) QGHWDMP4OpenGLView *hwd_openGLView; //opengl绘制图层
|
|
|
@property (nonatomic, strong) QGHWDMetalView *hwd_metalView; //metal绘制图层
|
|
@property (nonatomic, strong) QGHWDMetalView *hwd_metalView; //metal绘制图层
|
|
|
@property (nonatomic, strong) QGVAPMetalView *vap_metalView; //vap格式mp4渲染图层
|
|
@property (nonatomic, strong) QGVAPMetalView *vap_metalView; //vap格式mp4渲染图层
|
|
@@ -66,12 +67,27 @@ NSInteger const VapMaxCompatibleVersion = 2;
|
|
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] hwd_addSafeObserver:self selector:@selector(hwd_didReceiveEnterBackgroundNotification:) name:UIApplicationDidEnterBackgroundNotification object:nil];
|
|
[[NSNotificationCenter defaultCenter] hwd_addSafeObserver:self selector:@selector(hwd_didReceiveEnterBackgroundNotification:) name:UIApplicationDidEnterBackgroundNotification object:nil];
|
|
|
[[NSNotificationCenter defaultCenter] hwd_addSafeObserver:self selector:@selector(hwd_didReceiveWillEnterForegroundNotification:) name:UIApplicationWillEnterForegroundNotification object:nil];
|
|
[[NSNotificationCenter defaultCenter] hwd_addSafeObserver:self selector:@selector(hwd_didReceiveWillEnterForegroundNotification:) name:UIApplicationWillEnterForegroundNotification object:nil];
|
|
|
|
|
+
|
|
|
|
|
+ [[NSNotificationCenter defaultCenter] hwd_addSafeObserver:self selector:@selector(hwd_didReceiveSeekStartNotification:) name:kQGVAPDecoderSeekStart object:nil];
|
|
|
|
|
+ [[NSNotificationCenter defaultCenter] hwd_addSafeObserver:self selector:@selector(hwd_didReceiveSeekFinishNotification:) name:kQGVAPDecoderSeekFinish object:nil];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)hwd_didReceiveEnterBackgroundNotification:(NSNotification *)notification {
|
|
- (void)hwd_didReceiveEnterBackgroundNotification:(NSNotification *)notification {
|
|
|
[self pauseHWDMP4];
|
|
[self pauseHWDMP4];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+- (void)hwd_didReceiveSeekStartNotification:(NSNotification *)notification {
|
|
|
|
|
+ if ([self.hwd_decodeManager containsThisDeocder:notification.object]) {
|
|
|
|
|
+ self.hwd_onSeek = YES;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)hwd_didReceiveSeekFinishNotification:(NSNotification *)notification {
|
|
|
|
|
+ if ([self.hwd_decodeManager containsThisDeocder:notification.object]) {
|
|
|
|
|
+ self.hwd_onSeek = NO;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
//结束播放
|
|
//结束播放
|
|
|
- (void)hwd_stopHWDMP4 {
|
|
- (void)hwd_stopHWDMP4 {
|
|
|
|
|
|
|
@@ -350,7 +366,7 @@ NSInteger const VapMaxCompatibleVersion = 2;
|
|
|
if (self.hwd_isFinish) {
|
|
if (self.hwd_isFinish) {
|
|
|
break ;
|
|
break ;
|
|
|
}
|
|
}
|
|
|
- if (self.hwd_onPause) {
|
|
|
|
|
|
|
+ if (self.hwd_onPause || self.hwd_onSeek) {
|
|
|
lastRenderingInterval = NSDate.timeIntervalSinceReferenceDate;
|
|
lastRenderingInterval = NSDate.timeIntervalSinceReferenceDate;
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
@@ -427,12 +443,13 @@ NSInteger const VapMaxCompatibleVersion = 2;
|
|
|
|
|
|
|
|
VAP_Info(kQGVAPModuleCommon, @"pauseHWDMP4");
|
|
VAP_Info(kQGVAPModuleCommon, @"pauseHWDMP4");
|
|
|
self.hwd_onPause = YES;
|
|
self.hwd_onPause = YES;
|
|
|
- [self.hwd_callbackQueue addOperationWithBlock:^{
|
|
|
|
|
- //此处必须延迟释放,避免野指针
|
|
|
|
|
- if ([self.hwd_Delegate respondsToSelector:@selector(viewDidStopPlayMP4:view:)]) {
|
|
|
|
|
- [self.hwd_Delegate viewDidStopPlayMP4:self.hwd_currentFrame.frameIndex view:self];
|
|
|
|
|
- }
|
|
|
|
|
- }];
|
|
|
|
|
|
|
+// pause回调stop会导致一般使用场景将view移除,无法resume,因此暂时去掉该回调触发
|
|
|
|
|
+// [self.hwd_callbackQueue addOperationWithBlock:^{
|
|
|
|
|
+// //此处必须延迟释放,避免野指针
|
|
|
|
|
+// if ([self.hwd_Delegate respondsToSelector:@selector(viewDidStopPlayMP4:view:)]) {
|
|
|
|
|
+// [self.hwd_Delegate viewDidStopPlayMP4:self.hwd_currentFrame.frameIndex view:self];
|
|
|
|
|
+// }
|
|
|
|
|
+// }];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)resumeHWDMP4 {
|
|
- (void)resumeHWDMP4 {
|
|
@@ -542,6 +559,7 @@ NSInteger const VapMaxCompatibleVersion = 2;
|
|
|
|
|
|
|
|
//category methods
|
|
//category methods
|
|
|
HWDSYNTH_DYNAMIC_PROPERTY_CTYPE(hwd_onPause, setHwd_onPause, BOOL)
|
|
HWDSYNTH_DYNAMIC_PROPERTY_CTYPE(hwd_onPause, setHwd_onPause, BOOL)
|
|
|
|
|
+HWDSYNTH_DYNAMIC_PROPERTY_CTYPE(hwd_onSeek, setHwd_onSeek, BOOL)
|
|
|
HWDSYNTH_DYNAMIC_PROPERTY_CTYPE(hwd_renderByOpenGL, setHwd_renderByOpenGL, BOOL)
|
|
HWDSYNTH_DYNAMIC_PROPERTY_CTYPE(hwd_renderByOpenGL, setHwd_renderByOpenGL, BOOL)
|
|
|
HWDSYNTH_DYNAMIC_PROPERTY_CTYPE(hwd_isFinish, setHwd_isFinish, BOOL)
|
|
HWDSYNTH_DYNAMIC_PROPERTY_CTYPE(hwd_isFinish, setHwd_isFinish, BOOL)
|
|
|
HWDSYNTH_DYNAMIC_PROPERTY_CTYPE(hwd_fps, setHwd_fps, NSInteger)
|
|
HWDSYNTH_DYNAMIC_PROPERTY_CTYPE(hwd_fps, setHwd_fps, NSInteger)
|