Skip to content

Commit

Permalink
Update library to v1.0.12 (Fix issue #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
wseemann committed Nov 17, 2016
1 parent 7d29cb0 commit 4b0873a
Show file tree
Hide file tree
Showing 29 changed files with 939 additions and 335 deletions.
26 changes: 25 additions & 1 deletion FMMRDemo/FMMRDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
AD96D85D1A30B73F00BAB585 /* libz.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AD96D85C1A30B73F00BAB585 /* libz.1.dylib */; };
AD96D8621A30B95F00BAB585 /* libFMMRLibrary.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AD96D8611A30B95F00BAB585 /* libFMMRLibrary.a */; };
AD96D8641A30B9F200BAB585 /* libbz2.1.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AD96D8631A30B9F200BAB585 /* libbz2.1.0.dylib */; };
ADEE3C0B1DDD50B9004DDCA6 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADEE3C0A1DDD50B9004DDCA6 /* CoreMedia.framework */; };
ADEE3C0D1DDD50C6004DDCA6 /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADEE3C0C1DDD50C6004DDCA6 /* VideoToolbox.framework */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -48,13 +50,17 @@
AD96D85C1A30B73F00BAB585 /* libz.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.dylib; path = usr/lib/libz.1.dylib; sourceTree = SDKROOT; };
AD96D8611A30B95F00BAB585 /* libFMMRLibrary.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libFMMRLibrary.a; sourceTree = "<group>"; };
AD96D8631A30B9F200BAB585 /* libbz2.1.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbz2.1.0.dylib; path = usr/lib/libbz2.1.0.dylib; sourceTree = SDKROOT; };
ADEE3C0A1DDD50B9004DDCA6 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
ADEE3C0C1DDD50C6004DDCA6 /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
AD5266571A3042F7005FC268 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
ADEE3C0D1DDD50C6004DDCA6 /* VideoToolbox.framework in Frameworks */,
ADEE3C0B1DDD50B9004DDCA6 /* CoreMedia.framework in Frameworks */,
AD96D8641A30B9F200BAB585 /* libbz2.1.0.dylib in Frameworks */,
AD96D8621A30B95F00BAB585 /* libFMMRLibrary.a in Frameworks */,
AD96D85D1A30B73F00BAB585 /* libz.1.dylib in Frameworks */,
Expand All @@ -75,6 +81,8 @@
AD5266511A3042F7005FC268 = {
isa = PBXGroup;
children = (
ADEE3C0C1DDD50C6004DDCA6 /* VideoToolbox.framework */,
ADEE3C0A1DDD50B9004DDCA6 /* CoreMedia.framework */,
AD96D8631A30B9F200BAB585 /* libbz2.1.0.dylib */,
AD96D8611A30B95F00BAB585 /* libFMMRLibrary.a */,
AD96D85C1A30B73F00BAB585 /* libz.1.dylib */,
Expand Down Expand Up @@ -137,6 +145,16 @@
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
ADEE3BFE1DDD4ACA004DDCA6 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */

/* Begin PBXNativeTarget section */
AD5266591A3042F7005FC268 /* FMMRDemo */ = {
isa = PBXNativeTarget;
Expand All @@ -145,6 +163,7 @@
AD5266561A3042F7005FC268 /* Sources */,
AD5266571A3042F7005FC268 /* Frameworks */,
AD5266581A3042F7005FC268 /* Resources */,
ADEE3BFE1DDD4ACA004DDCA6 /* Headers */,
);
buildRules = (
);
Expand Down Expand Up @@ -179,7 +198,7 @@
AD5266521A3042F7005FC268 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = "William Seemann";
TargetAttributes = {
AD5266591A3042F7005FC268 = {
Expand Down Expand Up @@ -299,6 +318,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -369,6 +389,7 @@
"$(inherited)",
"$(PROJECT_DIR)",
);
PRODUCT_BUNDLE_IDENTIFIER = "wseemann.media.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
Expand All @@ -385,6 +406,7 @@
"$(inherited)",
"$(PROJECT_DIR)",
);
PRODUCT_BUNDLE_IDENTIFIER = "wseemann.media.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand All @@ -403,6 +425,7 @@
);
INFOPLIST_FILE = FMMRDemoTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "wseemann.media.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FMMRDemo.app/FMMRDemo";
};
Expand All @@ -418,6 +441,7 @@
);
INFOPLIST_FILE = FMMRDemoTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "wseemann.media.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FMMRDemo.app/FMMRDemo";
};
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -37,10 +37,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -62,17 +62,21 @@
ReferencedContainer = "container:FMMRDemo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AD5266591A3042F7005FC268"
Expand All @@ -85,12 +89,13 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AD5266591A3042F7005FC268"
Expand Down
7 changes: 4 additions & 3 deletions FMMRDemo/FMMRDemo/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
Expand Down
9 changes: 5 additions & 4 deletions FMMRDemo/FMMRDemo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
Expand All @@ -17,7 +18,7 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter a URI (http/mmsh/file/etc.)" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="hdr-uz-aKs">
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="http://98.212.85.121:53042/A Day to Remember/Homesick/01 - The Downfall Of Us All.mp3" borderStyle="roundedRect" placeholder="Enter a URI (http/mmsh/file/etc.)" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="hdr-uz-aKs">
<rect key="frame" x="16" y="33" width="490" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
Expand Down
2 changes: 1 addition & 1 deletion FMMRDemo/FMMRDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>wseemann.media.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
2 changes: 1 addition & 1 deletion FMMRDemo/FMMRDemoTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>wseemann.media.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
23 changes: 23 additions & 0 deletions FMMRDemo/include/FMMRLibrary/FFmpegMediaMetadataRetriever.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@
// Copyright (c) 2014 William Seemann. All rights reserved.
//

/*
* FFmpegMediaMetadataRetriever-iOS: Port of FFmpegMediaMetadataRetriever for
* iOS. A unified interface for retrieving frame and meta data from an
* input media file.
*
* Copyright 2014 William Seemann
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

Expand Down Expand Up @@ -39,6 +59,8 @@ static const NSString * METADATA_KEY_ICY_METADATA = @"icy_metadata";
static const NSString * METADATA_KEY_FRAMERATE = @"framerate";
static const NSString * METADATA_KEY_CHAPTER_START_TIME = @"chapter_start_time";
static const NSString * METADATA_KEY_CHAPTER_END_TIME = @"chapter_end_time";
static const NSString * METADATA_CHAPTER_COUNT = @"chapter_count";
static const NSString * METADATA_KEY_FILESIZE = @"filesize";

@interface FFmpegMediaMetadataRetriever : NSObject

Expand All @@ -51,6 +73,7 @@ static const NSString * METADATA_KEY_CHAPTER_END_TIME = @"chapter_end_time";
- (UIImage *)getFrameAtTimeWithOptions:(int64_t)timeUs option:(NSInteger)option;
- (UIImage *)getFrameAtTime:(int64_t)timeUs;
- (UIImage *)getFrame;
- (UIImage *)getScaledFrameAtTime:(int64_t)timeUs width:(NSInteger)width height:(NSInteger)height;
- (UIImage *)getEmbeddedPicture;
+ (void)release;

Expand Down
22 changes: 18 additions & 4 deletions FMMRDemo/include/FMMRLibrary/ffmpeg_mediametadataretriever.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/*
* FFmpegMediaMetadataRetriever: A unified interface for retrieving frame
* and meta data from an input media file.
* FFmpegMediaMetadataRetriever-iOS: Port of FFmpegMediaMetadataRetriever for
* iOS. A unified interface for retrieving frame and meta data from an
* input media file.
*
* Copyright 2016 William Seemann
*
* Copyright 2014 William Seemann
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand All @@ -22,6 +23,7 @@

#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/dict.h>

// Keep these in synch with the constants defined in FFmpegMediaMetadataRetriever.java
// class.
Expand All @@ -43,14 +45,26 @@ typedef struct State {
int fd;
int64_t offset;
const char *headers;
struct SwsContext *sws_ctx;
AVCodecContext *codecCtx;

struct SwsContext *scaled_sws_ctx;
AVCodecContext *scaled_codecCtx;
} State;

struct AVDictionary {
int count;
AVDictionaryEntry *elems;
};

int set_data_source_uri(State **ps, const char* path, const char* headers);
int set_data_source_fd(State **ps, int fd, int64_t offset, int64_t length);
const char* extract_metadata(State **ps, const char* key);
const char* extract_metadata_from_chapter(State **ps, const char* key, int chapter);
int get_metadata(State **ps, AVDictionary **metadata);
int get_embedded_picture(State **ps, AVPacket *pkt);
int get_frame_at_time(State **ps, int64_t timeUs, int option, AVPacket *pkt);
int get_scaled_frame_at_time(State **ps, int64_t timeUs, int option, AVPacket *pkt, int width, int height);
void release(State **ps);

#endif /*FFMPEG_MEDIAMETADATARETRIEVER_H_*/
53 changes: 53 additions & 0 deletions FMMRDemo/include/FMMRLibrary/ffmpeg_utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* FFmpegMediaMetadataRetriever: A unified interface for retrieving frame
* and meta data from an input media file.
*
* Copyright 2016 William Seemann
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef FFMPEG_UTILS_H_
#define FFMPEG_UTILS_H_

#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavutil/opt.h>

static const char *DURATION = "duration";
static const char *AUDIO_CODEC = "audio_codec";
static const char *VIDEO_CODEC = "video_codec";
static const char *ICY_METADATA = "icy_metadata";
static const char *ROTATE = "rotate";
static const char *FRAMERATE = "framerate";
static const char *CHAPTER_START_TIME = "chapter_start_time";
static const char *CHAPTER_END_TIME = "chapter_end_time";
static const char *CHAPTER_COUNT = "chapter_count";
static const char *FILESIZE = "filesize";

static const int SUCCESS = 0;
static const int FAILURE = -1;

void set_shoutcast_metadata(AVFormatContext *ic);
void set_duration(AVFormatContext *ic);
void set_codec(AVFormatContext *ic, int i);
void set_rotation(AVFormatContext *ic, AVStream *audio_st, AVStream *video_st);
void set_framerate(AVFormatContext *ic, AVStream *audio_st, AVStream *video_st);
void set_filesize(AVFormatContext *ic);
void set_chapter_count(AVFormatContext *ic);
const char* extract_metadata_internal(AVFormatContext *ic, AVStream *audio_st, AVStream *video_st, const char* key);
int get_metadata_internal(AVFormatContext *ic, AVDictionary **metadata);
const char* extract_metadata_from_chapter_internal(AVFormatContext *ic, AVStream *audio_st, AVStream *video_st, const char* key, int chapter);

#endif /*FFMPEG_UTILS_H_*/
Loading

0 comments on commit 4b0873a

Please sign in to comment.