IJKFFMoviePlayerController.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. // media meta
  27. #define k_IJKM_KEY_FORMAT @"format"
  28. #define k_IJKM_KEY_DURATION_US @"duration_us"
  29. #define k_IJKM_KEY_START_US @"start_us"
  30. #define k_IJKM_KEY_BITRATE @"bitrate"
  31. // stream meta
  32. #define k_IJKM_KEY_TYPE @"type"
  33. #define k_IJKM_VAL_TYPE__VIDEO @"video"
  34. #define k_IJKM_VAL_TYPE__AUDIO @"audio"
  35. #define k_IJKM_VAL_TYPE__UNKNOWN @"unknown"
  36. #define k_IJKM_KEY_CODEC_NAME @"codec_name"
  37. #define k_IJKM_KEY_CODEC_PROFILE @"codec_profile"
  38. #define k_IJKM_KEY_CODEC_LONG_NAME @"codec_long_name"
  39. // stream: video
  40. #define k_IJKM_KEY_WIDTH @"width"
  41. #define k_IJKM_KEY_HEIGHT @"height"
  42. #define k_IJKM_KEY_FPS_NUM @"fps_num"
  43. #define k_IJKM_KEY_FPS_DEN @"fps_den"
  44. #define k_IJKM_KEY_TBR_NUM @"tbr_num"
  45. #define k_IJKM_KEY_TBR_DEN @"tbr_den"
  46. #define k_IJKM_KEY_SAR_NUM @"sar_num"
  47. #define k_IJKM_KEY_SAR_DEN @"sar_den"
  48. // stream: audio
  49. #define k_IJKM_KEY_SAMPLE_RATE @"sample_rate"
  50. #define k_IJKM_KEY_CHANNEL_LAYOUT @"channel_layout"
  51. #define kk_IJKM_KEY_STREAMS @"streams"
  52. typedef enum IJKLogLevel {
  53. k_IJK_LOG_UNKNOWN = 0,
  54. k_IJK_LOG_DEFAULT = 1,
  55. k_IJK_LOG_VERBOSE = 2,
  56. k_IJK_LOG_DEBUG = 3,
  57. k_IJK_LOG_INFO = 4,
  58. k_IJK_LOG_WARN = 5,
  59. k_IJK_LOG_ERROR = 6,
  60. k_IJK_LOG_FATAL = 7,
  61. k_IJK_LOG_SILENT = 8,
  62. } IJKLogLevel;
  63. @interface IJKFFMoviePlayerController : NSObject <IJKMediaPlayback>
  64. - (id)initWithContentURL:(NSURL *)aUrl
  65. withOptions:(IJKFFOptions *)options;
  66. - (id)initWithContentURLString:(NSString *)aUrlString
  67. withOptions:(IJKFFOptions *)options;
  68. - (void)prepareToPlay;
  69. - (void)play;
  70. - (void)pause;
  71. - (void)stop;
  72. - (BOOL)isPlaying;
  73. - (int64_t)trafficStatistic;
  74. - (float)dropFrameRate;
  75. - (void)setPauseInBackground:(BOOL)pause;
  76. - (BOOL)isVideoToolboxOpen;
  77. + (void)setLogReport:(BOOL)preferLogReport;
  78. + (void)setLogLevel:(IJKLogLevel)logLevel;
  79. + (BOOL)checkIfFFmpegVersionMatch:(BOOL)showAlert;
  80. + (BOOL)checkIfPlayerVersionMatch:(BOOL)showAlert
  81. version:(NSString *)version;
  82. @property(nonatomic, readonly) CGFloat fpsInMeta;
  83. @property(nonatomic, readonly) CGFloat fpsAtOutput;
  84. @property(nonatomic) BOOL shouldShowHudView;
  85. - (void)setOptionValue:(NSString *)value
  86. forKey:(NSString *)key
  87. ofCategory:(IJKFFOptionCategory)category;
  88. - (void)setOptionIntValue:(int64_t)value
  89. forKey:(NSString *)key
  90. ofCategory:(IJKFFOptionCategory)category;
  91. - (void)setFormatOptionValue: (NSString *)value forKey:(NSString *)key;
  92. - (void)setCodecOptionValue: (NSString *)value forKey:(NSString *)key;
  93. - (void)setSwsOptionValue: (NSString *)value forKey:(NSString *)key;
  94. - (void)setPlayerOptionValue: (NSString *)value forKey:(NSString *)key;
  95. - (void)setFormatOptionIntValue: (int64_t)value forKey:(NSString *)key;
  96. - (void)setCodecOptionIntValue: (int64_t)value forKey:(NSString *)key;
  97. - (void)setSwsOptionIntValue: (int64_t)value forKey:(NSString *)key;
  98. - (void)setPlayerOptionIntValue: (int64_t)value forKey:(NSString *)key;
  99. @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> segmentOpenDelegate;
  100. @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> tcpOpenDelegate;
  101. @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> httpOpenDelegate;
  102. @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> liveOpenDelegate;
  103. @property (nonatomic, retain) id<IJKMediaNativeInvokeDelegate> nativeInvokeDelegate;
  104. - (void)didShutdown;
  105. #pragma mark KVO properties
  106. @property (nonatomic, readonly) IJKFFMonitor *monitor;
  107. @end
  108. #define IJK_FF_IO_TYPE_READ (1)
  109. void IJKFFIOStatDebugCallback(const char *url, int type, int bytes);
  110. void IJKFFIOStatRegister(void (*cb)(const char *url, int type, int bytes));
  111. void IJKFFIOStatCompleteDebugCallback(const char *url,
  112. int64_t read_bytes, int64_t total_size,
  113. int64_t elpased_time, int64_t total_duration);
  114. void IJKFFIOStatCompleteRegister(void (*cb)(const char *url,
  115. int64_t read_bytes, int64_t total_size,
  116. int64_t elpased_time, int64_t total_duration));