Skip to content
Permalink
Browse files

Merge pull request #179 from abuharsky/master

Added support for Icecast stream metadata
  • Loading branch information...
derpoliuk committed Mar 5, 2018
2 parents 12e7218 + ece165a commit 3b071cb5ff965c953fcbd14f94965a564e3f78bd
@@ -30,6 +30,41 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
1D5086651A711D060030B19C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1D50865D1A711D050030B19C /* StreamingKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = A1E7C4C8188D57F50010896F;
remoteInfo = StreamingKit;
};
1D5086671A711D060030B19C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1D50865D1A711D050030B19C /* StreamingKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = A1E7C4D8188D57F60010896F;
remoteInfo = StreamingKitTests;
};
1D5086691A711D060030B19C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1D50865D1A711D050030B19C /* StreamingKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = A1A49969189E744400E2A2E2;
remoteInfo = StreamingKitMac;
};
1D50866B1A711D060030B19C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1D50865D1A711D050030B19C /* StreamingKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = A1A4997A189E744500E2A2E2;
remoteInfo = StreamingKitMacTests;
};
1D50866D1A711D160030B19C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1D50865D1A711D050030B19C /* StreamingKit.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = A1E7C4C7188D57F50010896F;
remoteInfo = StreamingKit;
};
A1115951188D686000641365 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = A1115929188D686000641365 /* Project object */;
@@ -40,6 +75,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
1D50865D1A711D050030B19C /* StreamingKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = StreamingKit.xcodeproj; path = ../StreamingKit/StreamingKit.xcodeproj; sourceTree = "<group>"; };
A1115931188D686000641365 /* ExampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ExampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
A1115934188D686000641365 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
A1115936188D686000641365 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
@@ -97,6 +133,17 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
1D50865E1A711D050030B19C /* Products */ = {
isa = PBXGroup;
children = (
1D5086661A711D060030B19C /* libStreamingKit.a */,
1D5086681A711D060030B19C /* StreamingKitTests.xctest */,
1D50866A1A711D060030B19C /* libStreamingKitMac.a */,
1D50866C1A711D060030B19C /* StreamingKitMacTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
A1115928188D686000641365 = {
isa = PBXGroup;
children = (
@@ -119,6 +166,7 @@
A1115933188D686000641365 /* Frameworks */ = {
isa = PBXGroup;
children = (
1D50865D1A711D050030B19C /* StreamingKit.xcodeproj */,
A17FFB6218A0028300BAA7FF /* AudioToolbox.framework */,
A1F5E491189EB3F20070B03F /* AVFoundation.framework */,
A1F5E48F189EB3CB0070B03F /* AudioUnit.framework */,
@@ -200,6 +248,7 @@
buildRules = (
);
dependencies = (
1D50866E1A711D160030B19C /* PBXTargetDependency */,
);
name = ExampleApp;
productName = ExampleApp;
@@ -248,6 +297,12 @@
mainGroup = A1115928188D686000641365;
productRefGroup = A1115932188D686000641365 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 1D50865E1A711D050030B19C /* Products */;
ProjectRef = 1D50865D1A711D050030B19C /* StreamingKit.xcodeproj */;
},
);
projectRoot = "";
targets = (
A1115930188D686000641365 /* ExampleApp */,
@@ -256,6 +311,37 @@
};
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
1D5086661A711D060030B19C /* libStreamingKit.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libStreamingKit.a;
remoteRef = 1D5086651A711D060030B19C /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1D5086681A711D060030B19C /* StreamingKitTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = StreamingKitTests.xctest;
remoteRef = 1D5086671A711D060030B19C /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1D50866A1A711D060030B19C /* libStreamingKitMac.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libStreamingKitMac.a;
remoteRef = 1D5086691A711D060030B19C /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
1D50866C1A711D060030B19C /* StreamingKitMacTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = StreamingKitMacTests.xctest;
remoteRef = 1D50866B1A711D060030B19C /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
A111592F188D686000641365 /* Resources */ = {
isa = PBXResourcesBuildPhase;
@@ -301,6 +387,11 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
1D50866E1A711D160030B19C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = StreamingKit;
targetProxy = 1D50866D1A711D160030B19C /* PBXContainerItemProxy */;
};
A1115952188D686000641365 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = A1115930188D686000641365 /* ExampleApp */;
@@ -70,7 +70,7 @@ -(void) audioPlayerViewPlayFromHTTPSelected:(AudioPlayerView*)audioPlayerView

-(void) audioPlayerViewPlayFromIcecastSelected:(AudioPlayerView *)audioPlayerView
{
NSURL* url = [NSURL URLWithString:@"http://shoutmedia.abc.net.au:10326"];
NSURL* url = [NSURL URLWithString:@"http://nashe.streamr.ru/jazz-128.mp3"];

STKDataSource* dataSource = [STKAudioPlayer dataSourceFromURL:url];

@@ -50,6 +50,7 @@
@private
NSTimer* timer;
UILabel* label;
UILabel* metadataLabel;
UILabel* statusLabel;
UISlider* slider;
UISwitch* enableEqSwitch;
@@ -111,6 +111,11 @@ - (id)initWithFrame:(CGRect)frame andAudioPlayer:(STKAudioPlayer*)audioPlayerIn

[enableEqSwitch addTarget:self action:@selector(onEnableEqSwitch) forControlEvents:UIControlEventAllTouchEvents];

metadataLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, slider.frame.origin.y + slider.frame.size.height + 10, frame.size.width, 25)];

metadataLabel.textAlignment = NSTextAlignmentCenter;
metadataLabel.font = [UIFont boldSystemFontOfSize:17.0f];

label = [[UILabel alloc] initWithFrame:CGRectMake(0, slider.frame.origin.y + slider.frame.size.height + 40, frame.size.width, 25)];

label.textAlignment = NSTextAlignmentCenter;
@@ -131,6 +136,7 @@ - (id)initWithFrame:(CGRect)frame andAudioPlayer:(STKAudioPlayer*)audioPlayerIn
[self addSubview:queueShortFileButton];
[self addSubview:queuePcmWaveFileFromHTTPButton];
[self addSubview:repeatSwitch];
[self addSubview:metadataLabel];
[self addSubview:label];
[self addSubview:statusLabel];
[self addSubview:stopButton];
@@ -218,26 +224,31 @@ -(void) tick
-(void) playFromHTTPButtonTouched
{
[self.delegate audioPlayerViewPlayFromHTTPSelected:self];
metadataLabel.text = nil;
}

-(void) playFromIcecasButtonTouched
{
[self.delegate audioPlayerViewPlayFromIcecastSelected:self];
metadataLabel.text = nil;
}

-(void) playFromLocalFileButtonTouched
{
[self.delegate audioPlayerViewPlayFromLocalFileSelected:self];
metadataLabel.text = nil;
}

-(void) queueShortFileButtonTouched
{
[self.delegate audioPlayerViewQueueShortFileSelected:self];
metadataLabel.text = nil;
}

-(void) queuePcmWaveFileButtonTouched
{
[self.delegate audioPlayerViewQueuePcmWaveFileSelected:self];
metadataLabel.text = nil;
}

-(void) muteButtonPressed
@@ -375,4 +386,9 @@ -(void) audioPlayer:(STKAudioPlayer *)audioPlayer logInfo:(NSString *)line
NSLog(@"%@", line);
}

- (void)audioPlayer:(STKAudioPlayer *)audioPlayer didReadStreamMetadata:(NSDictionary *)dictionary
{
metadataLabel.text = dictionary[@"StreamTitle"];
}

@end
@@ -10,29 +10,29 @@
<string>ExampleAppMac</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>DD310C30-B3D0-4BD7-9565-9F29F09CC4F8</key>
<key>3E9414865BAE5433092B9D136FFC1F054EA505C2</key>
<string>https://github.com/tumtumtum/StreamingKit.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>ExampleAppMac/ExampleAppMac.xcodeproj/project.xcworkspace</string>
<string>ExampleAppMac/ExampleAppMac.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>DD310C30-B3D0-4BD7-9565-9F29F09CC4F8</key>
<key>3E9414865BAE5433092B9D136FFC1F054EA505C2</key>
<string>../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/tumtumtum/StreamingKit.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>DD310C30-B3D0-4BD7-9565-9F29F09CC4F8</string>
<string>3E9414865BAE5433092B9D136FFC1F054EA505C2</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>DD310C30-B3D0-4BD7-9565-9F29F09CC4F8</string>
<string>3E9414865BAE5433092B9D136FFC1F054EA505C2</string>
<key>IDESourceControlWCCName</key>
<string>StreamingKit</string>
</dict>
@@ -135,6 +135,9 @@ typedef void(^STKFrameFilter)(UInt32 channelsPerFrame, UInt32 bytesPerFrame, UIn
/// Raised when items queued items are cleared (usually because of a call to play, setDataSource or stop)
-(void) audioPlayer:(STKAudioPlayer*)audioPlayer didCancelQueuedItems:(NSArray*)queuedItems;

/// Raised when datasource read stream metadata
-(void) audioPlayer:(STKAudioPlayer*)audioPlayer didReadStreamMetadata:(NSDictionary*)dictionary;

@end

@interface STKAudioPlayer : NSObject<STKDataSourceDelegate>
@@ -1673,6 +1673,12 @@ -(void) dataSourceEof:(STKDataSource*)dataSourceIn
[self processRunloop];
}

-(void)dataSource:(STKDataSource *)dataSource didReadStreamMetadata:(NSDictionary *)metadata
{
if([self.delegate respondsToSelector:@selector(audioPlayer:didReadStreamMetadata:)])
[self.delegate audioPlayer:self didReadStreamMetadata:metadata];
}

-(void) pause
{
pthread_mutex_lock(&playerMutex);
@@ -43,6 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
-(void) dataSourceDataAvailable:(STKDataSource*)dataSource;
-(void) dataSourceErrorOccured:(STKDataSource*)dataSource;
-(void) dataSourceEof:(STKDataSource*)dataSource;
-(void) dataSource:(STKDataSource*)dataSource didReadStreamMetadata:(NSDictionary*)metadata;
@end

@interface STKDataSource : NSObject
@@ -117,4 +117,9 @@ -(void) dataSourceEof:(STKDataSource*)dataSource
[self.delegate dataSourceEof:self];
}

- (void)dataSource:(STKDataSource *)dataSource didReadStreamMetadata:(NSDictionary *)metadata
{
[self.delegate dataSource:self didReadStreamMetadata:metadata];
}

@end
Oops, something went wrong.

0 comments on commit 3b071cb

Please sign in to comment.
You can’t perform that action at this time.