提交 ee1e34c8 编写于 作者: Z Zhang Rui

ios: add category OptionConvenience

上级 3d9b3b94
......@@ -26,6 +26,8 @@
E6716E4E1807EA5000B3FBC1 /* IJKFFMrl.m in Sources */ = {isa = PBXBuildFile; fileRef = E6716E4D1807EA5000B3FBC1 /* IJKFFMrl.m */; };
E672D6F318D3445100C51FF9 /* IJKMediaModule.m in Sources */ = {isa = PBXBuildFile; fileRef = E672D6F218D3445100C51FF9 /* IJKMediaModule.m */; };
E672D6F418D345C100C51FF9 /* IJKMediaModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E672D6F118D3445100C51FF9 /* IJKMediaModule.h */; };
E6794BCA1B1FFA9B000560C4 /* IJKFFMoviePlayerController+OptionConvenience.m in Sources */ = {isa = PBXBuildFile; fileRef = E6794BC91B1FFA9B000560C4 /* IJKFFMoviePlayerController+OptionConvenience.m */; };
E6794BCB1B1FFB13000560C4 /* IJKFFMoviePlayerController+OptionConvenience.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E6794BC81B1FFA9B000560C4 /* IJKFFMoviePlayerController+OptionConvenience.h */; };
E67B91AF1A3801DB00717EA9 /* ff_ffpipeline.c in Sources */ = {isa = PBXBuildFile; fileRef = E67B91AB1A3801DB00717EA9 /* ff_ffpipeline.c */; };
E67B91B01A3801DB00717EA9 /* ff_ffpipenode.c in Sources */ = {isa = PBXBuildFile; fileRef = E67B91AD1A3801DB00717EA9 /* ff_ffpipenode.c */; };
E67B91B81A3801E600717EA9 /* ffpipeline_ffplay.c in Sources */ = {isa = PBXBuildFile; fileRef = E67B91B21A3801E600717EA9 /* ffpipeline_ffplay.c */; };
......@@ -77,6 +79,7 @@
dstPath = "include/${PRODUCT_NAME}";
dstSubfolderSpec = 16;
files = (
E6794BCB1B1FFB13000560C4 /* IJKFFMoviePlayerController+OptionConvenience.h in CopyFiles */,
E67C4E0A19D2BFF100415CEE /* IJKAVMoviePlayerController.h in CopyFiles */,
E672D6F418D345C100C51FF9 /* IJKMediaModule.h in CopyFiles */,
E62139BF180FAE5F00553533 /* IJKFFOptions.h in CopyFiles */,
......@@ -127,6 +130,8 @@
E6716E4D1807EA5000B3FBC1 /* IJKFFMrl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJKFFMrl.m; sourceTree = "<group>"; };
E672D6F118D3445100C51FF9 /* IJKMediaModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IJKMediaModule.h; path = IJKMediaPlayer/IJKMediaModule.h; sourceTree = "<group>"; };
E672D6F218D3445100C51FF9 /* IJKMediaModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IJKMediaModule.m; path = IJKMediaPlayer/IJKMediaModule.m; sourceTree = "<group>"; };
E6794BC81B1FFA9B000560C4 /* IJKFFMoviePlayerController+OptionConvenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "IJKFFMoviePlayerController+OptionConvenience.h"; sourceTree = "<group>"; };
E6794BC91B1FFA9B000560C4 /* IJKFFMoviePlayerController+OptionConvenience.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "IJKFFMoviePlayerController+OptionConvenience.m"; sourceTree = "<group>"; };
E67B91AB1A3801DB00717EA9 /* ff_ffpipeline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ff_ffpipeline.c; sourceTree = "<group>"; };
E67B91AC1A3801DB00717EA9 /* ff_ffpipeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ff_ffpipeline.h; sourceTree = "<group>"; };
E67B91AD1A3801DB00717EA9 /* ff_ffpipenode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ff_ffpipenode.c; sourceTree = "<group>"; };
......@@ -413,15 +418,17 @@
E6903EBE17EAF6C500CFD954 /* IJKFFMoviePlayerController */ = {
isa = PBXGroup;
children = (
E6716E4C1807EA4F00B3FBC1 /* IJKFFMrl.h */,
E6716E4D1807EA5000B3FBC1 /* IJKFFMrl.m */,
E62139BC180FA89A00553533 /* IJKFFOptions.h */,
E62139BD180FA89A00553533 /* IJKFFOptions.m */,
E6903F7617EAFC2C00CFD954 /* ffmpeg */,
E66F8DE517EFD9C300354D80 /* IJKFFMoviePlayerController.h */,
E66F8DE617EFD9C300354D80 /* IJKFFMoviePlayerController.m */,
E6794BC81B1FFA9B000560C4 /* IJKFFMoviePlayerController+OptionConvenience.h */,
E6794BC91B1FFA9B000560C4 /* IJKFFMoviePlayerController+OptionConvenience.m */,
E6F727B917F2D9D30043623F /* IJKFFMoviePlayerDef.h */,
E6F727BA17F2D9D30043623F /* IJKFFMoviePlayerDef.m */,
E6903F7617EAFC2C00CFD954 /* ffmpeg */,
E6716E4C1807EA4F00B3FBC1 /* IJKFFMrl.h */,
E6716E4D1807EA5000B3FBC1 /* IJKFFMrl.m */,
E62139BC180FA89A00553533 /* IJKFFOptions.h */,
E62139BD180FA89A00553533 /* IJKFFOptions.m */,
E6903FCC17EAFC6100CFD954 /* ijkmedia */,
E6903EBF17EAF6C500CFD954 /* Supporting Files */,
);
......@@ -793,6 +800,7 @@
E690402017EAFC6100CFD954 /* ff_ffplay.c in Sources */,
E690402717EAFC6100CFD954 /* image_convert.c in Sources */,
E690402D17EAFC6100CFD954 /* ijksdl_vout_overlay_ffmpeg.c in Sources */,
E6794BCA1B1FFA9B000560C4 /* IJKFFMoviePlayerController+OptionConvenience.m in Sources */,
E690402E17EAFC6100CFD954 /* ijksdl_aout.c in Sources */,
E690402F17EAFC6100CFD954 /* ijksdl_error.c in Sources */,
E672D6F318D3445100C51FF9 /* IJKMediaModule.m in Sources */,
......
//
// IJKFFMoviePlayerController+OptionConvenience.h
// IJKMediaPlayer
//
// Created by Zhang Rui on 15/6/4.
// Copyright (c) 2015年 bilibili. All rights reserved.
//
#import "IJKFFMoviePlayerController.h"
@interface IJKFFMoviePlayerController (OptionConvenience)
- (void)setFormatOptionValue: (NSString *)value forKey:(NSString *)key;
- (void)setCodecOptionValue: (NSString *)value forKey:(NSString *)key;
- (void)setSwsOptionValue: (NSString *)value forKey:(NSString *)key;
- (void)setPlayerOptionValue: (NSString *)value forKey:(NSString *)key;
- (void)setFormatOptionIntValue: (NSInteger)value forKey:(NSString *)key;
- (void)setCodecOptionIntValue: (NSInteger)value forKey:(NSString *)key;
- (void)setSwsOptionIntValue: (NSInteger)value forKey:(NSString *)key;
- (void)setPlayerOptionIntValue: (NSInteger)value forKey:(NSString *)key;
- (void)setMaxBufferSize:(int)maxBufferSize; // -1 for default size
@end
//
// IJKFFMoviePlayerController+OptionConvenience.m
// IJKMediaPlayer
//
// Created by Zhang Rui on 15/6/4.
// Copyright (c) 2015年 bilibili. All rights reserved.
//
#import "IJKFFMoviePlayerController+OptionConvenience.h"
@implementation IJKFFMoviePlayerController (OptionConvenience)
- (void)setFormatOptionValue:(NSString *)value forKey:(NSString *)key
{
[self setOptionValue:value forKey:key ofCategory:kIJKFFOptionCategoryFormat];
}
- (void)setCodecOptionValue:(NSString *)value forKey:(NSString *)key
{
[self setOptionValue:value forKey:key ofCategory:kIJKFFOptionCategoryCodec];
}
- (void)setSwsOptionValue:(NSString *)value forKey:(NSString *)key
{
[self setOptionValue:value forKey:key ofCategory:kIJKFFOptionCategorySws];
}
- (void)setPlayerOptionValue:(NSString *)value forKey:(NSString *)key
{
[self setOptionValue:value forKey:key ofCategory:kIJKFFOptionCategoryPlayer];
}
- (void)setFormatOptionIntValue:(NSInteger)value forKey:(NSString *)key
{
[self setOptionIntValue:value forKey:key ofCategory:kIJKFFOptionCategoryFormat];
}
- (void)setCodecOptionIntValue:(NSInteger)value forKey:(NSString *)key
{
[self setOptionIntValue:value forKey:key ofCategory:kIJKFFOptionCategoryCodec];
}
- (void)setSwsOptionIntValue:(NSInteger)value forKey:(NSString *)key
{
[self setOptionIntValue:value forKey:key ofCategory:kIJKFFOptionCategorySws];
}
- (void)setPlayerOptionIntValue:(NSInteger)value forKey:(NSString *)key
{
[self setOptionIntValue:value forKey:key ofCategory:kIJKFFOptionCategoryPlayer];
}
- (void)setMaxBufferSize:(int)maxBufferSize
{
[self setPlayerOptionIntValue:maxBufferSize forKey:@"max-buffer-size"];
}
@end
......@@ -75,13 +75,27 @@
- (void)setPauseInBackground:(BOOL)pause;
- (BOOL)isVideoToolboxOpen;
- (void)setMaxBufferSize:(int)maxBufferSize; // -1 for default size
+ (void)setLogReport:(BOOL)preferLogReport;
@property(nonatomic, readonly) CGFloat fpsInMeta;
@property(nonatomic, readonly) CGFloat fpsAtOutput;
typedef enum IJKFFOptionCategory {
kIJKFFOptionCategoryFormat = 1,
kIJKFFOptionCategoryCodec = 2,
kIJKFFOptionCategorySws = 3,
kIJKFFOptionCategoryPlayer = 4,
} IJKFFOptionCategory;
- (void)setOptionValue:(NSString *)value
forKey:(NSString *)key
ofCategory:(IJKFFOptionCategory)category;
- (void)setOptionIntValue:(NSInteger)value
forKey:(NSString *)key
ofCategory:(IJKFFOptionCategory)category;
@end
#define IJK_FF_IO_TYPE_READ (1)
......
......@@ -302,12 +302,48 @@ void IJKFFIOStatCompleteRegister(void (*cb)(const char *url,
return _isVideoToolboxOpen;
}
- (void)setMaxBufferSize:(int)maxBufferSize
inline static int getPlayerOption(IJKFFOptionCategory category)
{
int mp_category = -1;
switch (category) {
case kIJKFFOptionCategoryFormat:
mp_category = IJKMP_OPT_CATEGORY_FORMAT;
break;
case kIJKFFOptionCategoryCodec:
mp_category = IJKMP_OPT_CATEGORY_CODEC;
break;
case kIJKFFOptionCategorySws:
mp_category = IJKMP_OPT_CATEGORY_SWS;
break;
case kIJKFFOptionCategoryPlayer:
mp_category = IJKMP_OPT_CATEGORY_PLAYER;
break;
default:
NSLog(@"unknown option category: %d\n", category);
}
return mp_category;
}
- (void)setOptionValue:(NSString *)value
forKey:(NSString *)key
ofCategory:(IJKFFOptionCategory)category
{
assert(_mediaPlayer);
if (!_mediaPlayer)
return;
ijkmp_set_option(_mediaPlayer, getPlayerOption(category), [key UTF8String], [value UTF8String]);
}
- (void)setOptionIntValue:(NSInteger)value
forKey:(NSString *)key
ofCategory:(IJKFFOptionCategory)category
{
assert(_mediaPlayer);
if (!_mediaPlayer)
return;
ijkmp_set_option_int(_mediaPlayer, IJKMP_OPT_CATEGORY_PLAYER, "max-buffer-size", maxBufferSize);
ijkmp_set_option_int(_mediaPlayer, getPlayerOption(category), [key UTF8String], value);
}
+ (void)setLogReport:(BOOL)preferLogReport
......
......@@ -25,6 +25,7 @@
#import "IJKFFOptions.h"
#import "IJKFFMoviePlayerController.h"
#import "IJKFFMoviePlayerController+OptionConvenience.h"
#import "IJKAVMoviePlayerController.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册