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

[WIP] add sample #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions Example/HPLibRTMP.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; };
7DF2FEFA2448AA7D000755A2 /* big_buck_bunny.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 7DF2FEF92448AA7D000755A2 /* big_buck_bunny.mp4 */; };
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -61,6 +62,7 @@
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
71719F9E1E33DC2100824A3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
744865401D101376ADAF927F /* Pods-HPLibRTMP_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HPLibRTMP_Tests.release.xcconfig"; path = "Target Support Files/Pods-HPLibRTMP_Tests/Pods-HPLibRTMP_Tests.release.xcconfig"; sourceTree = "<group>"; };
7DF2FEF92448AA7D000755A2 /* big_buck_bunny.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = big_buck_bunny.mp4; sourceTree = "<group>"; };
85C58D449EB182B557AFA00E /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
8E80C07EC6CC5140CFA6F2DB /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
Expand Down Expand Up @@ -134,6 +136,7 @@
children = (
6003F59C195388D20070C39A /* HPAppDelegate.h */,
6003F59D195388D20070C39A /* HPAppDelegate.m */,
7DF2FEF92448AA7D000755A2 /* big_buck_bunny.mp4 */,
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
6003F5A5195388D20070C39A /* HPViewController.h */,
6003F5A6195388D20070C39A /* HPViewController.m */,
Expand Down Expand Up @@ -279,6 +282,7 @@
files = (
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */,
71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */,
7DF2FEFA2448AA7D000755A2 /* big_buck_bunny.mp4 in Resources */,
6003F5A9195388D20070C39A /* Images.xcassets in Resources */,
6003F598195388D20070C39A /* InfoPlist.strings in Resources */,
);
Expand Down
48 changes: 47 additions & 1 deletion Example/HPLibRTMP/HPViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@
//

#import "HPViewController.h"
#import "HPRTMP.h"
#import <AVFoundation/AVFoundation.h>

@interface HPViewController ()
NSString const* kRTMP = @"rtmp://10.0.1.14/live?key=huiping";
NSString const* kSourceMP4 = @"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";

@interface HPViewController ()

@property(nonatomic,retain) HPRTMP *rtmp;

@end

@implementation HPViewController
Expand All @@ -18,8 +25,47 @@ - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

self.rtmp = [[HPRTMP alloc] initWithRTMPURL:kRTMP];
}

//-(void)test {
// AVAsset *set = [AVAsset assetWithURL:url];
//
// AVAssetReader *assetReader = [[AVAssetReader alloc] initWithAsset:set error:nil];
//
// NSArray *videoTracks = [set tracksWithMediaType:AVMediaTypeVideo];
// // Decompression settings for ARGB.
// NSDictionary *decompressionVideoSettings = @{ (id)kCVPixelBufferPixelFormatTypeKey : [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32ARGB], (id)kCVPixelBufferIOSurfacePropertiesKey : [NSDictionary dictionary] };
//
// // self.trackOutput = AVAssetReaderTrackOutput(track: tracks[0] as AVAssetTrack, outputSettings: outputSetting)
//
// AVAssetReaderTrackOutput *output = [AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:videoTracks[0] outputSettings:decompressionVideoSettings];
//
// if ([assetReader canAddOutput:output]) {
// [assetReader addOutput:output];
// }
//
// [assetReader startReading];
//
// BOOL done = NO;
// while (!done) {
// // Copy the next sample buffer from the reader output.
// CMSampleBufferRef sampleBuffer = [output copyNextSampleBuffer];
// if (sampleBuffer) {
// // Do something with sampleBuffer here.
//
// [self.rtmp sendVideoWithVideoData:<#(NSData *)#> timestamp:CMSampleBufferGetPresentationTimeStamp(sampleBuffer) isKeyFrame:isKeyFrame(sampleBuffer)]
//
// CFRelease(sampleBuffer);
// sampleBuffer = NULL;
// } else{
// // The asset reader output has read all of its samples.
// done = YES;
// }
// }
//}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
Expand Down
6 changes: 6 additions & 0 deletions Example/HPLibRTMP/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file added Example/HPLibRTMP/big_buck_bunny.mp4
Binary file not shown.