~ubuntu-branches/ubuntu/natty/mythtv/natty

« back to all changes in this revision

Viewing changes to libs/libmyth/mediamonitor-darwin.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello, Mario Limonciello, Thomas Mashos
  • Date: 2010-06-20 00:11:00 UTC
  • mfrom: (1.1.53 upstream)
  • Revision ID: james.westby@ubuntu.com-20100620001100-yulpns6qg4ksmay6
Tags: 0.23.0+fixes25138-0ubuntu1
[ Mario Limonciello ]
* new upstream checkout (25138)

[ Thomas Mashos ]
* Added missingok for mirobridge log in logrotate (LP: #581283)
* Backend now waits for udev to finish (LP: #556204)
* Added patch to properly detect dbus during compile (LP: #574877)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
2
 * \file     mediamonitor-darwin.cpp
3
3
 * \brief    MythMediaMonitor for Darwin/Mac OS X.
4
 
 * \version  $Id: mediamonitor-darwin.cpp 22911 2009-11-28 15:55:09Z danielk $
 
4
 * \version  $Id: mediamonitor-darwin.cpp 25132 2010-06-18 03:48:36Z nigel $
5
5
 * \author   Andrew Kimpton, Nigel Pearson
6
6
 */
7
7
 
178
178
 
179
179
    name = (CFStringRef)
180
180
           CFDictionaryGetValue(diskDetails, kDADiskDescriptionVolumeNameKey);
181
 
    if (name)
182
 
        size = CFStringGetLength(name) + 1;
183
 
    else
184
 
        size = 9;  // 'Untitled\0'
185
 
 
 
181
 
 
182
    if (!name)
 
183
        return NULL;
 
184
 
 
185
    size = CFStringGetLength(name) + 1;
186
186
    volName = (char *) malloc(size);
187
187
    if (!volName)
188
188
    {
191
191
        return NULL;
192
192
    }
193
193
 
194
 
    if (!name || !CFStringGetCString(name, volName, size,
195
 
                                     kCFStringEncodingUTF8))
196
 
        strcpy(volName, "Untitled");
 
194
    if (!CFStringGetCString(name, volName, size, kCFStringEncodingUTF8))
 
195
    {
 
196
        free(volName);
 
197
        return NULL;
 
198
    }
197
199
 
198
200
    return volName;
199
201
}
291
293
 
292
294
    // Get the volume and model name for more user-friendly interaction
293
295
    volName = getVolName(details);
294
 
    model   = getModel(details);
 
296
    if (!volName)
 
297
    {
 
298
        VERBOSE(VB_MEDIA, msg + "No volume name for dev " + BSDname);
 
299
        CFRelease(details);
 
300
        return;
 
301
    }
295
302
 
 
303
    model     = getModel(details);
296
304
    mediaType = MediaTypeForBSDName(BSDname);
297
305
    isCDorDVD = (mediaType == MEDIATYPE_DVD) || (mediaType == MEDIATYPE_AUDIO);
298
306
 
326
334
        CFDictionaryRef details = DADiskCopyDescription(disk);
327
335
        char           *volName = getVolName(details);
328
336
 
 
337
        VERBOSE(VB_MEDIA, QString("Disk %1 - changed name to '%2'.")
 
338
                          .arg(BSDname).arg(volName));
 
339
 
329
340
        reinterpret_cast<MonitorThreadDarwin *>(context)
330
341
            ->diskRename(BSDname, volName);
331
342
        CFRelease(details);