kolyvan / kxmovie

movie player for iOS using ffmpeg
2.84k stars 919 forks source link

IOS7 depreciations. #72

Open jtoronto opened 10 years ago

jtoronto commented 10 years ago

There seems to be a lot of depreciated code when building for iOS7. Here's a few examples:

KxMovieDecoder.m:1393:25: 'avpicture_deinterlace' is deprecated

KxAudioManager.m:102:20: 'AudioSessionGetProperty' is deprecated: first deprecated in iOS 7.0

/KxAudioManager.m:126:20: 'AudioSessionAddPropertyListener' is deprecated: first deprecated in iOS 7.0

It seems to run fine in the simulator, so I was wondering if they were anything to be concerned about.

mrodalgaard commented 10 years ago

The code will still work fine on all platforms for now. Apple is just making the switch from C-style code to more ObjC-style of the audio session handling using AVFoundation/AVAudioSession.h, which has some benefits, like clear syntax and change events.

UInt32 category = kAudioSessionCategory_MediaPlayback ;
OSStatus result = AudioSessionSetProperty(
  kAudioSessionProperty_AudioCategory, sizeof(category), &category ) ;

is equivalent to

NSError *nsError;
[[AVAudioSession sharedInstance]
  setCategory:AVAudioSessionCategoryPlayback error:&nsError];

Making the whole switch to AVAudioSession is not cumbersome, but there is some work. Moreover it is only supported on iOS6 and above (but this framework is iOS7 and above, so nevermind).

trungnguyen1791 commented 8 years ago

Hi, Did anyone try switch to AVAudioSession ( ObjC style) instead of current C- style ?