IJKFFMoviePlayerController.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. * IJKFFMoviePlayerController.h
  3. *
  4. * Copyright (c) 2013 Bilibili
  5. * Copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
  6. *
  7. * This file is part of ijkPlayer.
  8. *
  9. * ijkPlayer is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * ijkPlayer is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with ijkPlayer; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. #import "IJKMediaPlayback.h"
  24. #import "IJKFFMonitor.h"
  25. #import "IJKFFOptions.h"
  26. #import "IJKSDLGLViewProtocol.h"
  27. // media meta
  28. #define k_IJKM_KEY_FORMAT @"format"
  29. #define k_IJKM_KEY_DURATION_US @"duration_us"
  30. #define k_IJKM_KEY_START_US @"start_us"
  31. #define k_IJKM_KEY_BITRATE @"bitrate"
  32. // stream meta
  33. #define k_IJKM_KEY_TYPE @"type"
  34. #define k_IJKM_VAL_TYPE__VIDEO @"video"
  35. #define k_IJKM_VAL_TYPE__AUDIO @"audio"
  36. #define k_IJKM_VAL_TYPE__UNKNOWN @"unknown"
  37. #define k_IJKM_KEY_CODEC_NAME @"codec_name"
  38. #define k_IJKM_KEY_CODEC_PROFILE @"codec_profile"
  39. #define k_IJKM_KEY_CODEC_LONG_NAME @"codec_long_name"
  40. // stream: video
  41. #define k_IJKM_KEY_WIDTH @"width"
  42. #define k_IJKM_KEY_HEIGHT @"height"
  43. #define k_IJKM_KEY_FPS_NUM @"fps_num"
  44. #define k_IJKM_KEY_FPS_DEN @"fps_den"
  45. #define k_IJKM_KEY_TBR_NUM @"tbr_num"
  46. #define k_IJKM_KEY_TBR_DEN @"tbr_den"
  47. #define k_IJKM_KEY_SAR_NUM @"sar_num"
  48. #define k_IJKM_KEY_SAR_DEN @"sar_den"
  49. // stream: audio
  50. #define k_IJKM_KEY_SAMPLE_RATE @"sample_rate"
  51. #define k_IJKM_KEY_CHANNEL_LAYOUT @"channel_layout"
  52. #define kk_IJKM_KEY_STREAMS @"streams"
  53. typedef enum IJKLogLevel {
  54. k_IJK_LOG_UNKNOWN = 0,
  55. k_IJK_LOG_DEFAULT = 1,
  56. k_IJK_LOG_VERBOSE = 2,
  57. k_IJK_LOG_DEBUG = 3,
  58. k_IJK_LOG_INFO = 4,
  59. k_IJK_LOG_WARN = 5,
  60. k_IJK_LOG_ERROR = 6,
  61. k_IJK_LOG_FATAL = 7,
  62. k_IJK_LOG_SILENT = 8,
  63. } IJKLogLevel;
  64. @interface IJKFFMoviePlayerController : NSObject <IJKMediaPlayback>
  65. - (id)initWithContentURL:(NSURL *)aUrl
  66. withOptions:(IJKFFOptions *)options;
  67. - (id)initWithContentURLString:(NSString *)aUrlString
  68. withOptions:(IJKFFOptions *)options;
  69. - (id)initWithMoreContent:(NSURL *)aUrl
  70. withOptions:(IJKFFOptions *)options
  71. withGLView:(UIView<IJKSDLGLViewProtocol> *)glView;
  72. - (id)initWithMoreContentString:(NSString *)aUrlString
  73. withOptions:(IJKFFOptions *)options
  74. withGLView:(UIView<IJKSDLGLViewProtocol> *)glView;
  75. - (void)prepareToPlay;
  76. - (void)play;
  77. - (void)pause;
  78. - (void)stop;
  79. - (BOOL)isPlaying;
  80. - (int64_t)trafficStatistic;
  81. - (float)dropFrameRate;
  82. - (void)setPauseInBackground:(BOOL)pause;
  83. - (BOOL)isVideoToolboxOpen;
  84. //add for flutter
  85. - (CVPixelBufferRef)framePixelbuffer;
  86. - (void)framePixelbufferLock;
  87. - (void)framePixelbufferUnlock;
  88. //end
  89. - (void)setHudValue:(NSString *)value forKey:(NSString *)key;
  90. + (void)setLogReport:(BOOL)preferLogReport;
  91. + (void)setLogLevel:(IJKLogLevel)logLevel;
  92. + (BOOL)checkIfFFmpegVersionMatch:(BOOL)showAlert;
  93. + (BOOL)checkIfPlayerVersionMatch:(BOOL)showAlert
  94. version:(NSString *)version;
  95. @property(nonatomic, readonly) CGFloat fpsInMeta;
  96. @property(nonatomic, readonly) CGFloat fpsAtOutput;
  97. @property(nonatomic) BOOL shouldShowHudView;
  98. - (void)setOptionValue:(NSString *)value
  99. forKey:(NSString *)key
  100. ofCategory:(IJKFFOptionCategory)category;
  101. - (void)setOptionIntValue:(int64_t)value
  102. forKey:(NSString *)key
  103. ofCategory:(IJKFFOptionCategory)category;
  104. - (void)setFormatOptionValue: (NSString *)value forKey:(NSString *)key;
  105. - (void)setCodecOptionValue: (NSString *)value forKey:(NSString *)key;
  106. - (void)setSwsOptionValue: (NSString *)value forKey:(NSString *)key;
  107. - (void)setPlayerOptionValue: (NSString *)value forKey:(NSString *)key;
  108. - (void)setFormatOptionIntValue: (int64_t)value forKey:(NSString *)key;
  109. - (void)setCodecOptionIntValue: (int64_t)value forKey:(NSString *)key;
  110. - (void)setSwsOptionIntValue: (int64_t)value forKey:(NSString *)key;
  111. - (void)setPlayerOptionIntValue: (int64_t)value forKey:(NSString *)key;
  112. @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> segmentOpenDelegate;
  113. @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> tcpOpenDelegate;
  114. @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> httpOpenDelegate;
  115. @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> liveOpenDelegate;
  116. @property (nonatomic, retain) id<IJKMediaNativeInvokeDelegate> nativeInvokeDelegate;
  117. - (void)didShutdown;
  118. #pragma mark KVO properties
  119. @property (nonatomic, readonly) IJKFFMonitor *monitor;
  120. @end
  121. #define IJK_FF_IO_TYPE_READ (1)
  122. void IJKFFIOStatDebugCallback(const char *url, int type, int bytes);
  123. void IJKFFIOStatRegister(void (*cb)(const char *url, int type, int bytes));
  124. void IJKFFIOStatCompleteDebugCallback(const char *url,
  125. int64_t read_bytes, int64_t total_size,
  126. int64_t elpased_time, int64_t total_duration);
  127. void IJKFFIOStatCompleteRegister(void (*cb)(const char *url,
  128. int64_t read_bytes, int64_t total_size,
  129. int64_t elpased_time, int64_t total_duration));