]> granicus.if.org Git - handbrake/commitdiff
MacGui: add a "name" property to HBCore to easy debugging multiple instances. Add...
authorritsuka <damiog@gmail.com>
Sat, 20 Dec 2014 09:18:22 +0000 (09:18 +0000)
committerritsuka <damiog@gmail.com>
Sat, 20 Dec 2014 09:18:22 +0000 (09:18 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6616 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/HBCore.h
macosx/HBCore.m

index a9dd127e4ef7c10a4c5875f31d44db17f37e3283..a0a831e5bfc2d3c5182b93a4e4a46a2d5df6e39c 100644 (file)
@@ -75,6 +75,10 @@ extern NSString *HBCoreMuxingNotification;
  */
 @property (nonatomic, readonly) hb_handle_t *hb_handle;
 
+/**
+ *  The name of the core, used in for debugging purpose.
+ */
+@property (nonatomic, copy) NSString *name;
 
 /**
  *  Determines whether the scan operation can scan a particural URL or whether an additional decription lib is needed..
index d506fcb815da2788e807ae61240eddb230c01498..33edef41d27c7aca40255ea354dd73fbbf7682cc 100644 (file)
@@ -45,7 +45,8 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
 /// Timer used to poll libhb for state changes.
 @property (nonatomic, readwrite, retain) NSTimer *updateTimer;
 
-@property (nonatomic, readwrite) NSArray *titles;
+/// Current scanned titles.
+@property (nonatomic, readwrite, retain) NSArray *titles;
 
 - (void)stateUpdateTimer:(NSTimer *)timer;
 
@@ -84,6 +85,7 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
     self = [super init];
     if (self)
     {
+        _name = @"HBCore";
         _state = HBStateIdle;
         _hb_state = malloc(sizeof(struct hb_state_s));
 
@@ -132,23 +134,25 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
         // The chosen path was actually on a DVD, so use the raw block
         // device path instead.
 
-        [HBUtilities writeToActivityLog: "trying to open a physical dvd at: %s", [url.path UTF8String]];
+        [HBUtilities writeToActivityLog:"%@ trying to open a physical dvd at: %s", self.name.UTF8String, url.path.UTF8String];
 
         // Notify the user that we don't support removal of copy protection.
         void *dvdcss = dlopen("libdvdcss.2.dylib", RTLD_LAZY);
         if (dvdcss)
         {
             // libdvdcss was found so all is well
-            [HBUtilities writeToActivityLog: "libdvdcss.2.dylib found for decrypting physical dvd"];
+            [HBUtilities writeToActivityLog:"%@ libdvdcss.2.dylib found for decrypting physical dvd", self.name.UTF8String];
             dlclose(dvdcss);
         }
         else
         {
             // compatible libdvdcss not found
-            [HBUtilities writeToActivityLog: "libdvdcss.2.dylib not found for decrypting physical dvd"];
+            [HBUtilities writeToActivityLog:"%@, libdvdcss.2.dylib not found for decrypting physical dvd", self.name.UTF8String];
 
             if (error) {
-                *error = [NSError errorWithDomain:@"HBErrorDomain" code:101 userInfo:@{ NSLocalizedDescriptionKey: @"libdvdcss.2.dylib not found for decrypting physical dvd" }];
+                *error = [NSError errorWithDomain:@"HBErrorDomain"
+                                             code:101
+                                         userInfo:@{ NSLocalizedDescriptionKey: @"libdvdcss.2.dylib not found for decrypting physical dvd" }];
             }
         }
     }
@@ -178,13 +182,13 @@ NSString *HBCoreMuxingNotification = @"HBCoreMuxingNotification";
     // which causes the default behavior of a full source scan
     if (titleNum > 0)
     {
-        [HBUtilities writeToActivityLog: "scanning specifically for title: %d", titleNum];
+        [HBUtilities writeToActivityLog:"%s scanning specifically for title: %d", self.name.UTF8String, titleNum];
     }
     else
     {
         // minimum title duration doesn't apply to title-specific scan
         // it doesn't apply to batch scan either, but we can't tell it apart from DVD & BD folders here
-        [HBUtilities writeToActivityLog: "scanning titles with a duration of %d seconds or more", minTitleDuration];
+        [HBUtilities writeToActivityLog:"%s scanning titles with a duration of %d seconds or more", self.name.UTF8String, minTitleDuration];
     }
 
     hb_system_sleep_prevent(_hb_handle);