Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added an init method to initialize the dictionary using data from a C…

…MSampleBufferRef
  • Loading branch information...
commit f2cbd444cb75910c6b0200f5edcc4133a144ad6e 1 parent 5b6a1f2
@gpambrozio authored
View
3  GusUtils/NSMutableDictionary+ImageMetadata.h
@@ -5,11 +5,14 @@
//
#import <Foundation/Foundation.h>
+#import <CoreMedia/CoreMedia.h>
#import <CoreLocation/CoreLocation.h>
#import <UIKit/UIKit.h>
@interface NSMutableDictionary (ImageMetadataCategory)
+- (id)initWithImageSampleBuffer:(CMSampleBufferRef) imageDataSampleBuffer;
+
- (void)setLocation:(CLLocation *)currentLocation;
- (void)setUserComment:(NSString*)comment;
- (void)setDateOriginal:(NSDate *)date;
View
8 GusUtils/NSMutableDictionary+ImageMetadata.m
@@ -19,8 +19,14 @@ @implementation FIX_CATEGORY_BUG_ImageMetadataCategory @end
@implementation NSMutableDictionary (ImageMetadataCategory)
-// Mostly from here: http://stackoverflow.com/questions/3884060/need-help-in-saving-geotag-info-with-photo-on-ios4-1
+- (id)initWithImageSampleBuffer:(CMSampleBufferRef) imageDataSampleBuffer {
+ CFDictionaryRef metadataDict = CMCopyDictionaryOfAttachments(NULL, imageDataSampleBuffer, kCMAttachmentMode_ShouldPropagate);
+ self = [self initWithDictionary:(NSDictionary*)metadataDict];
+ CFRelease(metadataDict);
+ return self;
+}
+// Mostly from here: http://stackoverflow.com/questions/3884060/need-help-in-saving-geotag-info-with-photo-on-ios4-1
- (void)setLocation:(CLLocation *)currentLocation {
if (currentLocation) {
Please sign in to comment.
Something went wrong with that request. Please try again.