QGAnimatedImageDecodeManager.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // QGAnimatedImageDecodeManager.h
  2. // Tencent is pleased to support the open source community by making vap available.
  3. //
  4. // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
  5. //
  6. // Licensed under the MIT License (the "License"); you may not use this file except in
  7. // compliance with the License. You may obtain a copy of the License at
  8. //
  9. // http://opensource.org/licenses/MIT
  10. //
  11. // Unless required by applicable law or agreed to in writing, software distributed under the License is
  12. // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  13. // either express or implied. See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. #import <Foundation/Foundation.h>
  16. #import "QGBaseDecoder.h"
  17. #import "QGBaseAnimatedImageFrame.h"
  18. #import "QGAnimatedImageDecodeConfig.h"
  19. @class QGAnimatedImageDecodeManager;
  20. @protocol QGAnimatedImageDecoderDelegate <NSObject>
  21. /**
  22. 必须实现该方法 用以实例化解码器
  23. @param manager 解码控制器
  24. @return class
  25. */
  26. - (Class)decoderClassForManager:(QGAnimatedImageDecodeManager *)manager;
  27. @optional
  28. - (BOOL)shouldSetupAudioPlayer;
  29. /**
  30. 到文件末尾时被调用
  31. @param decoder 解码器
  32. */
  33. - (void)decoderDidFinishDecode:(QGBaseDecoder *)decoder;
  34. - (void)decoderDidFailDecode:(QGBaseDecoder *)decoder error:(NSError *)error;
  35. @end
  36. @interface QGAnimatedImageDecodeManager : NSObject
  37. @property (nonatomic, weak) id<QGAnimatedImageDecoderDelegate> decoderDelegate;
  38. - (instancetype)initWith:(QGBaseDFileInfo *)fileInfo
  39. config:(QGAnimatedImageDecodeConfig *)config
  40. delegate:(id<QGAnimatedImageDecoderDelegate>)delegate;
  41. - (QGBaseAnimatedImageFrame *)consumeDecodedFrame:(NSInteger)frameIndex;
  42. - (void)tryToStartAudioPlay;
  43. - (void)tryToStopAudioPlay;
  44. - (void)tryToPauseAudioPlay;
  45. - (void)tryToResumeAudioPlay;
  46. - (BOOL)containsThisDeocder:(id)decoder;
  47. @end