All pastes #978623 Raw Edit

mac cli optical scanning

public text v1 · immutable
·published 2008-04-09 18:18 UTC
rendered paste body
Index: test/test.c
===================================================================
--- test/test.c	(revision 1397)
+++ test/test.c	(working copy)
@@ -13,6 +13,10 @@
 #include "hb.h"
 #include "parsecsv.h"
 
+#ifdef __APPLE_CC__
+#import <CoreServices/CoreServices.h>
+#endif
+
 /* Options */
 static int    debug       = HB_DEBUG_NONE;
 static int    update      = 0;
@@ -1641,6 +1645,45 @@
                 break;
             case 'i':
                 input = strdup( optarg );
+                #ifdef __APPLE_CC__
+                    fprintf(stderr, "input was: %s", input);
+                    if( strcmp("/dev/", input) > 0 )
+                    {
+                        OSStatus err;
+                        FSRef ref;
+                        err = FSPathMakeRef( (const UInt8 *) input,
+                                             &ref, NULL );	
+                        if( err != noErr )
+                        {
+                            return 0;
+                        }
+        
+                        // Get the volume reference number.
+                        FSCatalogInfo catalogInfo;
+                        err = FSGetCatalogInfo( &ref, kFSCatInfoVolume, &catalogInfo, NULL, NULL,
+                                                NULL);
+                        if( err != noErr )
+                        {
+                            return 0;
+                        }
+                        FSVolumeRefNum volRefNum = catalogInfo.volume;
+        
+                        // Now let's get the device name
+                        GetVolParmsInfoBuffer volumeParms;
+                        // Let's use FSGetVolumeParms
+                        err = FSGetVolumeParms ( volRefNum, &volumeParms, sizeof( volumeParms ) );
+        
+                        if( err != noErr )
+                        {
+                            return 0;
+                        }
+        
+                        // A version 4 GetVolParmsInfoBuffer contains the BSD node name in the vMDeviceID field.
+                        // It is actually a char * value. This is mentioned in the header CoreServices/CarbonCore/Files.h.
+                        sprintf(input, "/dev/%s", volumeParms.vMDeviceID);
+                    }
+                #endif
+                
                 break;
             case 'o':
                 output = strdup( optarg );
Index: macosx/HandBrake.xcodeproj/project.pbxproj
===================================================================
--- macosx/HandBrake.xcodeproj/project.pbxproj	(revision 1397)
+++ macosx/HandBrake.xcodeproj/project.pbxproj	(working copy)
@@ -90,6 +90,7 @@
 		593034EC0BBA39A100172349 /* ChapterTitles.m in Sources */ = {isa = PBXBuildFile; fileRef = 593034EA0BBA39A100172349 /* ChapterTitles.m */; };
 		59CBD2370BBB44DA004A3BE3 /* parsecsv.c in Sources */ = {isa = PBXBuildFile; fileRef = 59CBD2360BBB44DA004A3BE3 /* parsecsv.c */; };
 		59CBD2650BBB4D1B004A3BE3 /* ChapterTitles.m in Sources */ = {isa = PBXBuildFile; fileRef = 593034EA0BBA39A100172349 /* ChapterTitles.m */; };
+		74B6022F0DAD226C00C2C8E5 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 74B6022E0DAD226C00C2C8E5 /* CoreServices.framework */; };
 		A22C85EC0D05D35000C10E36 /* HBPresets.h in Headers */ = {isa = PBXBuildFile; fileRef = A22C85EA0D05D35000C10E36 /* HBPresets.h */; };
 		A22C85ED0D05D35100C10E36 /* HBPresets.m in Sources */ = {isa = PBXBuildFile; fileRef = A22C85EB0D05D35000C10E36 /* HBPresets.m */; };
 		A25289E60D87A27D00461D5B /* enctheora.c in Sources */ = {isa = PBXBuildFile; fileRef = A25289E50D87A27D00461D5B /* enctheora.c */; };
@@ -258,6 +259,7 @@
 		593034E90BBA39A100172349 /* ChapterTitles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChapterTitles.h; sourceTree = "<group>"; };
 		593034EA0BBA39A100172349 /* ChapterTitles.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChapterTitles.m; sourceTree = "<group>"; };
 		59CBD2360BBB44DA004A3BE3 /* parsecsv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parsecsv.c; path = ../test/parsecsv.c; sourceTree = SOURCE_ROOT; };
+		74B6022E0DAD226C00C2C8E5 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
 		A22C85EA0D05D35000C10E36 /* HBPresets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBPresets.h; sourceTree = "<group>"; };
 		A22C85EB0D05D35000C10E36 /* HBPresets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBPresets.m; sourceTree = "<group>"; };
 		A25289E50D87A27D00461D5B /* enctheora.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = enctheora.c; path = ../libhb/enctheora.c; sourceTree = SOURCE_ROOT; };
@@ -346,6 +348,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				74B6022F0DAD226C00C2C8E5 /* CoreServices.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -476,6 +479,7 @@
 		526FBC920B4CAA120064E04C /* HandBrakeCLI Sources */ = {
 			isa = PBXGroup;
 			children = (
+				74B6022E0DAD226C00C2C8E5 /* CoreServices.framework */,
 				0DF377970B7BF99A00115CB0 /* fakexcode.cpp */,
 				526FBC760B4CA8F40064E04C /* test.c */,
 				59CBD2360BBB44DA004A3BE3 /* parsecsv.c */,