Skip to content

Commit de02f9d

Browse files
committed
ijkplayer支持https
1 parent d9571ab commit de02f9d

16 files changed

+887
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* IJKAVMoviePlayerController.h
3+
*
4+
* Copyright (c) 2014 Bilibili
5+
* Copyright (c) 2014 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+
/*
25+
File: AVPlayerDemoPlaybackViewController.h
26+
Abstract: UIViewController managing a playback view, thumbnail view, and associated playback UI.
27+
Version: 1.3
28+
29+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
30+
Inc. ("Apple") in consideration of your agreement to the following
31+
terms, and your use, installation, modification or redistribution of
32+
this Apple software constitutes acceptance of these terms. If you do
33+
not agree with these terms, please do not use, install, modify or
34+
redistribute this Apple software.
35+
36+
In consideration of your agreement to abide by the following terms, and
37+
subject to these terms, Apple grants you a personal, non-exclusive
38+
license, under Apple's copyrights in this original Apple software (the
39+
"Apple Software"), to use, reproduce, modify and redistribute the Apple
40+
Software, with or without modifications, in source and/or binary forms;
41+
provided that if you redistribute the Apple Software in its entirety and
42+
without modifications, you must retain this notice and the following
43+
text and disclaimers in all such redistributions of the Apple Software.
44+
Neither the name, trademarks, service marks or logos of Apple Inc. may
45+
be used to endorse or promote products derived from the Apple Software
46+
without specific prior written permission from Apple. Except as
47+
expressly stated in this notice, no other rights or licenses, express or
48+
implied, are granted by Apple herein, including but not limited to any
49+
patent rights that may be infringed by your derivative works or by other
50+
works in which the Apple Software may be incorporated.
51+
52+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
53+
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
54+
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
55+
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
56+
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
57+
58+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
59+
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
60+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
61+
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
62+
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
63+
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
64+
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
65+
POSSIBILITY OF SUCH DAMAGE.
66+
67+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
68+
69+
*/
70+
71+
#import "IJKMediaPlayback.h"
72+
73+
@interface IJKAVMoviePlayerController : NSObject <IJKMediaPlayback>
74+
75+
- (id)initWithContentURL:(NSURL *)aUrl;
76+
- (id)initWithContentURLString:(NSString *)aUrl;
77+
+ (id)getInstance:(NSString *)aUrl;
78+
79+
@end
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright (c) 2016 Bilibili
3+
* Copyright (c) 2016 Zhang Rui <bbcallen@gmail.com>
4+
*
5+
* This file is part of ijkPlayer.
6+
*
7+
* ijkPlayer is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* ijkPlayer is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with ijkPlayer; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*/
21+
22+
#import <Foundation/Foundation.h>
23+
24+
@interface IJKFFMonitor : NSObject
25+
26+
- (instancetype)init;
27+
28+
@property(nonatomic) NSDictionary *mediaMeta;
29+
@property(nonatomic) NSDictionary *videoMeta;
30+
@property(nonatomic) NSDictionary *audioMeta;
31+
32+
@property(nonatomic, readonly) int64_t duration; // milliseconds
33+
@property(nonatomic, readonly) int64_t bitrate; // bit / sec
34+
@property(nonatomic, readonly) float fps; // frame / sec
35+
@property(nonatomic, readonly) int width; // width
36+
@property(nonatomic, readonly) int height; // height
37+
@property(nonatomic, readonly) NSString *vcodec; // video codec
38+
@property(nonatomic, readonly) NSString *acodec; // audio codec
39+
@property(nonatomic, readonly) int sampleRate;
40+
@property(nonatomic, readonly) int64_t channelLayout;
41+
42+
@property(nonatomic) NSString *vdecoder;
43+
44+
@property(nonatomic) int tcpError;
45+
@property(nonatomic) NSString *remoteIp;
46+
47+
@property(nonatomic) int httpError;
48+
@property(nonatomic) NSString *httpUrl;
49+
@property(nonatomic) NSString *httpHost;
50+
@property(nonatomic) int httpCode;
51+
@property(nonatomic) int64_t httpOpenTick;
52+
@property(nonatomic) int64_t httpSeekTick;
53+
@property(nonatomic) int httpOpenCount;
54+
@property(nonatomic) int httpSeekCount;
55+
@property(nonatomic) int64_t lastHttpOpenDuration;
56+
@property(nonatomic) int64_t lastHttpSeekDuration;
57+
@property(nonatomic) int64_t filesize;
58+
59+
@property(nonatomic) int64_t prepareStartTick;
60+
@property(nonatomic) int64_t prepareDuration;
61+
@property(nonatomic) int64_t firstVideoFrameLatency;
62+
@property(nonatomic) int64_t lastPrerollStartTick;
63+
@property(nonatomic) int64_t lastPrerollDuration;
64+
65+
@end
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
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));
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* IJKFFOptions.h
3+
*
4+
* Copyright (c) 2013-2015 Bilibili
5+
* Copyright (c) 2013-2015 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 <Foundation/Foundation.h>
25+
26+
typedef enum IJKFFOptionCategory {
27+
kIJKFFOptionCategoryFormat = 1,
28+
kIJKFFOptionCategoryCodec = 2,
29+
kIJKFFOptionCategorySws = 3,
30+
kIJKFFOptionCategoryPlayer = 4,
31+
kIJKFFOptionCategorySwr = 5,
32+
} IJKFFOptionCategory;
33+
34+
// for codec option 'skip_loop_filter' and 'skip_frame'
35+
typedef enum IJKAVDiscard {
36+
/* We leave some space between them for extensions (drop some
37+
* keyframes for intra-only or drop just some bidir frames). */
38+
IJK_AVDISCARD_NONE =-16, ///< discard nothing
39+
IJK_AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
40+
IJK_AVDISCARD_NONREF = 8, ///< discard all non reference
41+
IJK_AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
42+
IJK_AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
43+
IJK_AVDISCARD_ALL = 48, ///< discard all
44+
} IJKAVDiscard;
45+
46+
struct IjkMediaPlayer;
47+
48+
@interface IJKFFOptions : NSObject
49+
50+
+(IJKFFOptions *)optionsByDefault;
51+
52+
-(void)applyTo:(struct IjkMediaPlayer *)mediaPlayer;
53+
54+
- (void)setOptionValue:(NSString *)value
55+
forKey:(NSString *)key
56+
ofCategory:(IJKFFOptionCategory)category;
57+
58+
- (void)setOptionIntValue:(int64_t)value
59+
forKey:(NSString *)key
60+
ofCategory:(IJKFFOptionCategory)category;
61+
62+
63+
-(void)setFormatOptionValue: (NSString *)value forKey:(NSString *)key;
64+
-(void)setCodecOptionValue: (NSString *)value forKey:(NSString *)key;
65+
-(void)setSwsOptionValue: (NSString *)value forKey:(NSString *)key;
66+
-(void)setPlayerOptionValue: (NSString *)value forKey:(NSString *)key;
67+
68+
-(void)setFormatOptionIntValue: (int64_t)value forKey:(NSString *)key;
69+
-(void)setCodecOptionIntValue: (int64_t)value forKey:(NSString *)key;
70+
-(void)setSwsOptionIntValue: (int64_t)value forKey:(NSString *)key;
71+
-(void)setPlayerOptionIntValue: (int64_t)value forKey:(NSString *)key;
72+
73+
@property(nonatomic) BOOL showHudView;
74+
75+
@end

0 commit comments

Comments
 (0)