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