Skip to content

Commit a288ab0

Browse files
committed
First Commit!
1 parent 65541e5 commit a288ab0

17 files changed

Lines changed: 866 additions & 1 deletion

.gitattributes

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