提交 ecb21ae7 编写于 作者: B bbcallen

ios: set skip_loopfilter, skip_frame from objc level

上级 0fe547ba
......@@ -1683,8 +1683,11 @@ static int stream_component_open(FFPlayer *ffp, int stream_index)
return -1;
}
// FIXME: android set these from outside
#ifndef __APPLE__
avctx->skip_frame = ffp->skip_frame;
avctx->skip_loop_filter = ffp->skip_loop_filter;
#endif
avctx->codec_id = codec->id;
avctx->workaround_bugs = ffp->workaround_bugs;
......
......@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
E62139BE180FA89B00553533 /* IJKFFOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = E62139BD180FA89A00553533 /* IJKFFOptions.m */; };
E62139BF180FAE5F00553533 /* IJKFFOptions.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E62139BC180FA89A00553533 /* IJKFFOptions.h */; };
E63FC26917EFF39E003551EB /* ijksdl_aout_ios_audiounit.m in Sources */ = {isa = PBXBuildFile; fileRef = E63FC26817EFF39E003551EB /* ijksdl_aout_ios_audiounit.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
E63FC26F17EFF79F003551EB /* IJKSDLAudioUnitController.m in Sources */ = {isa = PBXBuildFile; fileRef = E63FC26E17EFF79F003551EB /* IJKSDLAudioUnitController.m */; };
E63FC27117F01143003551EB /* ijksdl_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = E63FC27017F01143003551EB /* ijksdl_audio.c */; };
......@@ -55,6 +57,7 @@
dstPath = "include/${PRODUCT_NAME}";
dstSubfolderSpec = 16;
files = (
E62139BF180FAE5F00553533 /* IJKFFOptions.h in CopyFiles */,
E6F727BF17F40C4A0043623F /* IJKMediaModule.h in CopyFiles */,
E6F727BE17F40C390043623F /* IJKFFMoviePlayerController.h in CopyFiles */,
E6F727BD17F40C360043623F /* IJKMPMoviePlayerController.h in CopyFiles */,
......@@ -66,6 +69,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
E62139BC180FA89A00553533 /* IJKFFOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJKFFOptions.h; sourceTree = "<group>"; };
E62139BD180FA89A00553533 /* IJKFFOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJKFFOptions.m; sourceTree = "<group>"; };
E63FC26717EFF38C003551EB /* ijksdl_aout_ios_audiounit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ijksdl_aout_ios_audiounit.h; path = ijkmedia/ijksdl/ios/ijksdl_aout_ios_audiounit.h; sourceTree = "<group>"; };
E63FC26817EFF39E003551EB /* ijksdl_aout_ios_audiounit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ijksdl_aout_ios_audiounit.m; path = ijkmedia/ijksdl/ios/ijksdl_aout_ios_audiounit.m; sourceTree = "<group>"; };
E63FC26D17EFF79F003551EB /* IJKSDLAudioUnitController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IJKSDLAudioUnitController.h; path = ijkmedia/ijksdl/ios/IJKSDLAudioUnitController.h; sourceTree = "<group>"; };
......@@ -332,6 +337,8 @@
children = (
E6716E4C1807EA4F00B3FBC1 /* IJKFFMrl.h */,
E6716E4D1807EA5000B3FBC1 /* IJKFFMrl.m */,
E62139BC180FA89A00553533 /* IJKFFOptions.h */,
E62139BD180FA89A00553533 /* IJKFFOptions.m */,
E66F8DE517EFD9C300354D80 /* IJKFFMoviePlayerController.h */,
E66F8DE617EFD9C300354D80 /* IJKFFMoviePlayerController.m */,
E6F727B917F2D9D30043623F /* IJKFFMoviePlayerDef.h */,
......@@ -687,6 +694,7 @@
E6F727C217F7C9BA0043623F /* IJKMediaPlayback.m in Sources */,
E6716E4B1807E5FC00B3FBC1 /* IJKMediaUtils.m in Sources */,
E6716E4E1807EA5000B3FBC1 /* IJKFFMrl.m in Sources */,
E62139BE180FA89B00553533 /* IJKFFOptions.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -21,10 +21,11 @@
*/
#import "IJKMediaPlayback.h"
#import "IJKFFOptions.h"
@interface IJKFFMoviePlayerController : NSObject <IJKMediaPlayback>
- (id)initWithContentURL:(NSURL *)aUrl;
- (id)initWithContentURL:(NSURL *)aUrl withOptions:(IJKFFOptions *)options;
- (void)prepareToPlay;
- (void)play;
......
......@@ -58,7 +58,7 @@
@synthesize initialPlaybackTime = _initialPlaybackTime;
@synthesize endPlaybackTime = _endPlaybackTime;
- (id)initWithContentURL:(NSURL *)aUrl
- (id)initWithContentURL:(NSURL *)aUrl withOptions:(IJKFFOptions *)options
{
self = [super init];
if (self) {
......@@ -84,6 +84,8 @@
ijkmp_ios_set_glview(_mediaPlayer, glView);
ijkmp_set_overlay_format(_mediaPlayer, SDL_FCC_I420);
[options applyTo:_mediaPlayer];
}
return self;
}
......
//
// IJKFFOptions.h
// IJKMediaPlayer
//
// Created by ZhangRui on 13-10-17.
// Copyright (c) 2013年 bilibili. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef enum IJKAVDiscard{
/* We leave some space between them for extensions (drop some
* keyframes for intra-only or drop just some bidir frames). */
IJK_AVDISCARD_NONE =-16, ///< discard nothing
IJK_AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi
IJK_AVDISCARD_NONREF = 8, ///< discard all non reference
IJK_AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames
IJK_AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
IJK_AVDISCARD_ALL = 48, ///< discard all
} IJKAVDiscard;
typedef struct IjkMediaPlayer IjkMediaPlayer;
@interface IJKFFOptions : NSObject
+(IJKFFOptions *)optionsByDefault;
-(void)applyTo:(IjkMediaPlayer *)mediaPlayer;
@property(nonatomic) IJKAVDiscard skipLoopFilter;
@property(nonatomic) IJKAVDiscard skipFrame;
@end
//
// IJKFFOptions.m
// IJKMediaPlayer
//
// Created by ZhangRui on 13-10-17.
// Copyright (c) 2013年 bilibili. All rights reserved.
//
#import "IJKFFOptions.h"
#include "ijkplayer/ios/ijkplayer_ios.h"
@implementation IJKFFOptions
+(IJKFFOptions *)optionsByDefault
{
IJKFFOptions *options = [[IJKFFOptions alloc] init];
options.skipLoopFilter = IJK_AVDISCARD_ALL;
options.skipFrame = IJK_AVDISCARD_NONREF;
return options;
}
-(void)applyTo:(IjkMediaPlayer *)mediaPlayer
{
[self setCodecOption:@"skip_loop_filter"
withInteger:self.skipLoopFilter
to:mediaPlayer];
[self setCodecOption:@"skip_frame"
withInteger:self.skipFrame
to:mediaPlayer];
}
-(void)setCodecOption:(NSString *)optionName
withInteger:(NSInteger)value
to:(IjkMediaPlayer *)mediaPlayer
{
ijkmp_set_codec_option(mediaPlayer,
[optionName UTF8String],
[[NSString stringWithFormat:@"%d", value] UTF8String]);
}
@end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册