Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correction of issue #3 and update to latest version of FFmpeg #10

Merged
merged 3 commits into from
Mar 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 35 additions & 21 deletions DFURTSPPlayer/DFURTSPPlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@
0649AB5516E92055001323D2 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 0649AB5216E92055001323D2 /* [email protected] */; };
0649AB5616E92055001323D2 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 0649AB5316E92055001323D2 /* Default.png */; };
0649AB5716E92055001323D2 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 0649AB5416E92055001323D2 /* [email protected] */; };
0649ABB716E928BA001323D2 /* libavcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABAF16E928BA001323D2 /* libavcodec.a */; };
0649ABB816E928BA001323D2 /* libavdevice.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB016E928BA001323D2 /* libavdevice.a */; };
0649ABB916E928BA001323D2 /* libavfilter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB116E928BA001323D2 /* libavfilter.a */; };
0649ABBA16E928BA001323D2 /* libavformat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB216E928BA001323D2 /* libavformat.a */; };
0649ABBB16E928BA001323D2 /* libavresample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB316E928BA001323D2 /* libavresample.a */; };
0649ABBC16E928BA001323D2 /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB416E928BA001323D2 /* libavutil.a */; };
0649ABBD16E928BA001323D2 /* libswresample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB516E928BA001323D2 /* libswresample.a */; };
0649ABBE16E928BA001323D2 /* libswscale.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB616E928BA001323D2 /* libswscale.a */; };
0649ABC016E928DF001323D2 /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABBF16E928DF001323D2 /* libbz2.dylib */; };
0649ABC216E928E6001323D2 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABC116E928E6001323D2 /* libz.dylib */; };
0649ABC816E92C9F001323D2 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABC716E92C9F001323D2 /* AVFoundation.framework */; };
Expand All @@ -44,6 +36,14 @@
0649ABDD16E93103001323D2 /* RTSPPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 0649ABDA16E93103001323D2 /* RTSPPlayer.m */; };
0649ABDF16E93112001323D2 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABDE16E93112001323D2 /* AudioToolbox.framework */; };
0649ABE116E93227001323D2 /* sophie.mov in Resources */ = {isa = PBXBuildFile; fileRef = 0649ABE016E93227001323D2 /* sophie.mov */; };
75601E3E1AB9FC3400C57B81 /* libavcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABAF16E928BA001323D2 /* libavcodec.a */; };
75601E3F1AB9FC3400C57B81 /* libavdevice.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB016E928BA001323D2 /* libavdevice.a */; };
75601E401AB9FC3400C57B81 /* libavfilter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB116E928BA001323D2 /* libavfilter.a */; };
75601E411AB9FC3400C57B81 /* libavformat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB216E928BA001323D2 /* libavformat.a */; };
75601E421AB9FC3400C57B81 /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB416E928BA001323D2 /* libavutil.a */; };
75601E431AB9FC3400C57B81 /* libswresample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB516E928BA001323D2 /* libswresample.a */; };
75601E441AB9FC3400C57B81 /* libswscale.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0649ABB616E928BA001323D2 /* libswscale.a */; };
75601E461ABA00DF00C57B81 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 75601E451ABA00DF00C57B81 /* libiconv.dylib */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -177,13 +177,22 @@
0649ABDA16E93103001323D2 /* RTSPPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RTSPPlayer.m; sourceTree = "<group>"; };
0649ABDE16E93112001323D2 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
0649ABE016E93227001323D2 /* sophie.mov */ = {isa = PBXFileReference; lastKnownFileType = video.quicktime; path = sophie.mov; sourceTree = "<group>"; };
75601E451ABA00DF00C57B81 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
0649AB0D16E9200D001323D2 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
75601E461ABA00DF00C57B81 /* libiconv.dylib in Frameworks */,
75601E3E1AB9FC3400C57B81 /* libavcodec.a in Frameworks */,
75601E3F1AB9FC3400C57B81 /* libavdevice.a in Frameworks */,
75601E401AB9FC3400C57B81 /* libavfilter.a in Frameworks */,
75601E411AB9FC3400C57B81 /* libavformat.a in Frameworks */,
75601E421AB9FC3400C57B81 /* libavutil.a in Frameworks */,
75601E431AB9FC3400C57B81 /* libswresample.a in Frameworks */,
75601E441AB9FC3400C57B81 /* libswscale.a in Frameworks */,
0649ABDF16E93112001323D2 /* AudioToolbox.framework in Frameworks */,
0649ABD016E92CBE001323D2 /* CoreVideo.framework in Frameworks */,
0649ABCE16E92CB8001323D2 /* CoreImage.framework in Frameworks */,
Expand All @@ -195,14 +204,6 @@
0649AB1416E9200D001323D2 /* UIKit.framework in Frameworks */,
0649AB1616E9200D001323D2 /* Foundation.framework in Frameworks */,
0649AB1816E9200D001323D2 /* CoreGraphics.framework in Frameworks */,
0649ABB716E928BA001323D2 /* libavcodec.a in Frameworks */,
0649ABB816E928BA001323D2 /* libavdevice.a in Frameworks */,
0649ABB916E928BA001323D2 /* libavfilter.a in Frameworks */,
0649ABBA16E928BA001323D2 /* libavformat.a in Frameworks */,
0649ABBB16E928BA001323D2 /* libavresample.a in Frameworks */,
0649ABBC16E928BA001323D2 /* libavutil.a in Frameworks */,
0649ABBD16E928BA001323D2 /* libswresample.a in Frameworks */,
0649ABBE16E928BA001323D2 /* libswscale.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -241,6 +242,7 @@
0649AB1216E9200D001323D2 /* Frameworks */ = {
isa = PBXGroup;
children = (
75601E451ABA00DF00C57B81 /* libiconv.dylib */,
0649ABC116E928E6001323D2 /* libz.dylib */,
0649ABBF16E928DF001323D2 /* libbz2.dylib */,
0649ABDE16E93112001323D2 /* AudioToolbox.framework */,
Expand Down Expand Up @@ -542,7 +544,7 @@
name = DFURTSPPlayerTests;
productName = DFURTSPPlayerTests;
productReference = 0649AB3916E9200D001323D2 /* DFURTSPPlayerTests.octest */;
productType = "com.apple.product-type.bundle";
productType = "com.apple.product-type.bundle.ocunit-test";
};
/* End PBXNativeTarget section */

Expand Down Expand Up @@ -707,7 +709,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -731,7 +733,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -742,39 +744,51 @@
0649AB4C16E9200D001323D2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DFURTSPPlayer/DFURTSPPlayer-Prefix.pch";
HEADER_SEARCH_PATHS = "$(SRCROOT)/FFMpegiOS/include/**";
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/FFMpegiOS/include/**",
"$(PROJECT_DIR)/DFURTSPPlayer/FFMpegiOS/include",
);
INFOPLIST_FILE = "DFURTSPPlayer/DFURTSPPlayer-Info.plist";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/DFURTSPPlayer/FFMpegiOS/lib\"",
"$(PROJECT_DIR)/DFURTSPPlayer/FFMpegiOS/lib",
);
OTHER_LDFLAGS = (
"-all_load",
"-Objc",
);
PRODUCT_NAME = "$(TARGET_NAME)";
USER_HEADER_SEARCH_PATHS = "";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
0649AB4D16E9200D001323D2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "DFURTSPPlayer/DFURTSPPlayer-Prefix.pch";
HEADER_SEARCH_PATHS = "$(SRCROOT)/FFMpegiOS/include/**";
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/FFMpegiOS/include/**",
"$(PROJECT_DIR)/DFURTSPPlayer/FFMpegiOS/include",
);
INFOPLIST_FILE = "DFURTSPPlayer/DFURTSPPlayer-Info.plist";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/DFURTSPPlayer/FFMpegiOS/lib\"",
"$(PROJECT_DIR)/DFURTSPPlayer/FFMpegiOS/lib",
);
OTHER_LDFLAGS = (
"-all_load",
"-Objc",
);
PRODUCT_NAME = "$(TARGET_NAME)";
USER_HEADER_SEARCH_PATHS = "";
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
2 changes: 2 additions & 0 deletions DFURTSPPlayer/DFURTSPPlayer/DFUViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
//http://www.wowza.com/_h264/BigBuckBunny_115k.mov
//rtsp://media1.law.harvard.edu/Media/policy_a/2012/02/02_unger.mov
//rtsp://streaming.parliament.act.gov.au/medium

video = [[RTSPPlayer alloc] initWithVideo:@"http://112.65.235.145/vlive.qqvideo.tc.qq.com/v00113mzdsr.mp4?vkey=03BDF0A68787D1B7937B386F359603E71EB7DD4C2F924DCCD1A956178BAAD4C5B958596242EB5FF8&br=72&platform=0&fmt=mp4&level=3" usesTcp:NO];
video.outputWidth = 426;
video.outputHeight = 320;
Expand Down Expand Up @@ -58,6 +59,7 @@ - (void)viewDidLoad
[super viewDidLoad];

[imageView setContentMode:UIViewContentModeScaleAspectFit];
[self playButtonAction:nil];
}

- (void)didReceiveMemoryWarning
Expand Down
23 changes: 9 additions & 14 deletions DFURTSPPlayer/DFURTSPPlayer/FFMpegDecoder/AudioStreamer.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ void audioQueueIsRunningCallback(void *inClientData, AudioQueueRef inAQ,
void audioQueueOutputCallback(void *inClientData, AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer) {

AudioStreamer *audioController = (AudioStreamer*)inClientData;
AudioStreamer *audioController = (__bridge AudioStreamer*)inClientData;
[audioController audioQueueOutputCallback:inAQ inBuffer:inBuffer];
}

void audioQueueIsRunningCallback(void *inClientData, AudioQueueRef inAQ,
AudioQueuePropertyID inID) {

AudioStreamer *audioController = (AudioStreamer*)inClientData;
AudioStreamer *audioController = (__bridge AudioStreamer*)inClientData;
[audioController audioQueueIsRunningCallback];
}

Expand All @@ -41,11 +41,6 @@ - (id)initWithStreamer:(RTSPPlayer*)streamer {
return self;
}

- (void)dealloc
{
[self removeAudioQueue];
[super dealloc];
}

- (IBAction)playAudio:(UIButton*)sender
{
Expand Down Expand Up @@ -96,7 +91,6 @@ - (BOOL)createAudioQueue

if (decodeLock_) {
[decodeLock_ unlock];
[decodeLock_ release];
decodeLock_ = nil;
}

Expand All @@ -121,11 +115,13 @@ - (BOOL)createAudioQueue
{
audioStreamBasicDesc_.mFormatID = kAudioFormatMPEG4AAC;
audioStreamBasicDesc_.mFormatFlags = kMPEG4Object_AAC_LC;
audioStreamBasicDesc_.mSampleRate = 44100;
audioStreamBasicDesc_.mChannelsPerFrame = 2;
audioStreamBasicDesc_.mSampleRate = _audioCodecContext->sample_rate;
audioStreamBasicDesc_.mChannelsPerFrame = _audioCodecContext->channels;
audioStreamBasicDesc_.mBitsPerChannel = 0;
audioStreamBasicDesc_.mFramesPerPacket = 1024;
audioStreamBasicDesc_.mFramesPerPacket =_audioCodecContext->frame_size;
audioStreamBasicDesc_.mBytesPerPacket = 0;
audioStreamBasicDesc_.mBytesPerFrame = _audioCodecContext->frame_bits;
audioStreamBasicDesc_.mReserved = 0;
NSLog(@"audio format %s (%d) is supported", _audioCodecContext->codec_descriptor->name, _audioCodecContext->codec_id);

break;
Expand Down Expand Up @@ -164,13 +160,13 @@ - (BOOL)createAudioQueue
// audioStreamBasicDesc_.mBitsPerChannel = 0;
// }

OSStatus status = AudioQueueNewOutput(&audioStreamBasicDesc_, audioQueueOutputCallback, (void*)self, NULL, NULL, 0, &audioQueue_);
OSStatus status = AudioQueueNewOutput(&audioStreamBasicDesc_, audioQueueOutputCallback, (__bridge void*)self, NULL, NULL, 0, &audioQueue_);
if (status != noErr) {
NSLog(@"Could not create new output.");
return NO;
}

status = AudioQueueAddPropertyListener(audioQueue_, kAudioQueueProperty_IsRunning, audioQueueIsRunningCallback, (void*)self);
status = AudioQueueAddPropertyListener(audioQueue_, kAudioQueueProperty_IsRunning, audioQueueIsRunningCallback, (__bridge void*)self);
if (status != noErr) {
NSLog(@"Could not add propery listener. (kAudioQueueProperty_IsRunning)");
return NO;
Expand Down Expand Up @@ -203,7 +199,6 @@ - (void)removeAudioQueue

if (decodeLock_) {
[decodeLock_ unlock];
[decodeLock_ release];
decodeLock_ = nil;
}
}
Expand Down
4 changes: 4 additions & 0 deletions DFURTSPPlayer/DFURTSPPlayer/FFMpegDecoder/RTSPPlayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#import "Utilities.h"
#import "AudioStreamer.h"

#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
# define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
#endif

@interface RTSPPlayer ()
@property (nonatomic, retain) AudioStreamer *audioController;
@end
Expand Down
Loading