Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Commit

Permalink
add metadata parser and switch for enable auto fill id3tag info for N…
Browse files Browse the repository at this point in the history
…owPlayingCenter
  • Loading branch information
Lincoln Law committed Mar 20, 2017
1 parent 8279b26 commit 1bc45e5
Show file tree
Hide file tree
Showing 20 changed files with 672 additions and 116 deletions.
Binary file modified .DS_Store
Binary file not shown.
5 changes: 3 additions & 2 deletions FPDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
StreamConfiguration.shared.cacheEnabled = false
StreamConfiguration.shared.autoFillID3InfoToNowPlayingCenter = true
view.addSubview(_butttonReset)
view.addSubview(_butttonClear)
view.addSubview(_butttonSeek)
Expand All @@ -45,10 +46,10 @@ class ViewController: UIViewController {
// FPLogger.shared.logToFile = false
// StreamConfiguration.shared.requireNetworkChecking = false
// print(StreamConfiguration.shared)
// _localMP3 = Bundle.main.url(forResource: "久远-光と波の记忆", withExtension: "mp3")
_localMP3 = Bundle.main.url(forResource: "久远-光と波の记忆", withExtension: "mp3")
//"http://mp3-cdn.luoo.net/low/luoo/radio895/03.mp3"
//"http://199.180.75.58:9061/stream"
_localMP3 = URL(string: "http://mp3-cdn.luoo.net/low/luoo/radio895/03.mp3")
// _localMP3 = URL(string: "http://mp3-cdn.luoo.net/low/package/neoclassic01/radio01/03.mp3")
// Do any additional setup after loading the view, typically from a nib.
}

Expand Down
Binary file added FPDemo/id3v1.1.mp3
Binary file not shown.
Binary file added FPDemo/id3v2.3.mp3
Binary file not shown.
Binary file added FPDemo/id3v2.4.mp3
Binary file not shown.
Binary file modified FPDemo/久远-光と波の记忆.mp3
Binary file not shown.
16 changes: 16 additions & 0 deletions FreePlayer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
10A64C251E5958BA004F77BC /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 10A64C241E5958BA004F77BC /* CFNetwork.framework */; };
10A64C271E5968C3004F77BC /* AudioStream.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10A64C261E5968C3004F77BC /* AudioStream.swift */; };
10A64C291E5968EA004F77BC /* AudioQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10A64C281E5968EA004F77BC /* AudioQueue.swift */; };
10F67C591E7FE30B0097EF4C /* ID3Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10F67C581E7FE30B0097EF4C /* ID3Parser.swift */; };
10F67C5D1E7FE8070097EF4C /* id3v1.1.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 10F67C5A1E7FE8070097EF4C /* id3v1.1.mp3 */; };
10F67C5E1E7FE8070097EF4C /* id3v2.3.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 10F67C5B1E7FE8070097EF4C /* id3v2.3.mp3 */; };
10F67C5F1E7FE8070097EF4C /* id3v2.4.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 10F67C5C1E7FE8070097EF4C /* id3v2.4.mp3 */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -98,6 +102,10 @@
10A64C241E5958BA004F77BC /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
10A64C261E5968C3004F77BC /* AudioStream.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AudioStream.swift; sourceTree = "<group>"; };
10A64C281E5968EA004F77BC /* AudioQueue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AudioQueue.swift; sourceTree = "<group>"; };
10F67C581E7FE30B0097EF4C /* ID3Parser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ID3Parser.swift; sourceTree = "<group>"; };
10F67C5A1E7FE8070097EF4C /* id3v1.1.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = id3v1.1.mp3; sourceTree = "<group>"; };
10F67C5B1E7FE8070097EF4C /* id3v2.3.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = id3v2.3.mp3; sourceTree = "<group>"; };
10F67C5C1E7FE8070097EF4C /* id3v2.4.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = id3v2.4.mp3; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -133,6 +141,9 @@
isa = PBXGroup;
children = (
106086611E5C16CA00A6F7CB /* 久远-光と波の记忆.mp3 */,
10F67C5A1E7FE8070097EF4C /* id3v1.1.mp3 */,
10F67C5B1E7FE8070097EF4C /* id3v2.3.mp3 */,
10F67C5C1E7FE8070097EF4C /* id3v2.4.mp3 */,
1060864C1E5C167500A6F7CB /* AppDelegate.swift */,
1060864E1E5C167500A6F7CB /* ViewController.swift */,
106086501E5C167500A6F7CB /* Main.storyboard */,
Expand All @@ -157,6 +168,7 @@
106086421E5BEFE400A6F7CB /* CachingStream.swift */,
106086441E5BEFEC00A6F7CB /* FileStream.swift */,
1048351F1E5D5CA400CED749 /* Log.swift */,
10F67C581E7FE30B0097EF4C /* ID3Parser.swift */,
);
name = Internal;
sourceTree = "<group>";
Expand Down Expand Up @@ -350,7 +362,10 @@
106086621E5C16CA00A6F7CB /* 久远-光と波の记忆.mp3 in Resources */,
106086571E5C167500A6F7CB /* LaunchScreen.storyboard in Resources */,
106086541E5C167500A6F7CB /* Assets.xcassets in Resources */,
10F67C5D1E7FE8070097EF4C /* id3v1.1.mp3 in Resources */,
10F67C5E1E7FE8070097EF4C /* id3v2.3.mp3 in Resources */,
106086521E5C167500A6F7CB /* Main.storyboard in Resources */,
10F67C5F1E7FE8070097EF4C /* id3v2.4.mp3 in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -395,6 +410,7 @@
106AD7EA1E6521E70020357C /* FreePlayer.swift in Sources */,
10A64C271E5968C3004F77BC /* AudioStream.swift in Sources */,
10A64C291E5968EA004F77BC /* AudioQueue.swift in Sources */,
10F67C591E7FE30B0097EF4C /* ID3Parser.swift in Sources */,
106086451E5BEFEC00A6F7CB /* FileStream.swift in Sources */,
10A64C1A1E593C8F004F77BC /* StreamOutput.swift in Sources */,
106086411E5BEFD700A6F7CB /* HttpStream.swift in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Features

- [x] Prepared for tough network conditions: adjustable buffer sizes, stream pre-buffering and restart on failures,restart on not full content streamed when end of stream

- [ ] Metadata support: ShoutCast metadata, IDv2 tags
- [x] Metadata support: ShoutCast metadata, IDv2 tags

- [x] Local disk caching: user only needs to stream a file once and after that it can be played from a local cache

Expand All @@ -28,6 +28,6 @@ Features

- [ ] Access the PCM audio samples: as an example, a visualizer is included

- [x] logging to file supported
- [x] custom logging module and logging into file supported

- [ ] FLAC support
6 changes: 3 additions & 3 deletions Sources/AudioQueue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ final class AudioQueue {

var currentState: State {
var s = State.unknown
OSSpinLockLock(&_mutex)
_mutex.lock()
s = _state
OSSpinLockUnlock(&_mutex)
_mutex.unlock()
return s
}

Expand Down Expand Up @@ -163,7 +163,7 @@ extension AudioQueue {
get { return _state }
set {
OSSpinLockLock(&_mutex)
if (_state == state) {
if (_state == newValue) {
OSSpinLockUnlock(&_mutex)
/* We are already in this state! */
return
Expand Down
Loading

0 comments on commit 1bc45e5

Please sign in to comment.