]> git.sesse.net Git - mlt/blob - src/modules/decklink/common.cpp
fix decklink build for OS X
[mlt] / src / modules / decklink / common.cpp
1 /*
2  * common.cpp -- Blackmagic Design DeckLink common functions
3  * Copyright (C) 2012 Dan Dennedy <dan@dennedy.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with consumer library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 #include "common.h"
21 #include <stdlib.h>
22
23 #ifdef __DARWIN__
24
25 char* getCString( DLString aDLString )
26 {
27         char* CString = (char*) malloc( 64 );
28         CFStringGetCString( aDLString, CString, 64, kCFStringEncodingMacRoman );
29         return CString;
30 }
31
32 void freeCString( char* aCString )
33 {
34         if ( aCString ) free( aCString );
35 }
36
37 void freeDLString( DLString aDLString )
38 {
39         if ( aDLString ) CFRelease( aDLString );
40 }
41
42 #else
43
44 char* getCString( DLString aDLString )
45 {
46         return aDLString? (char*) aDLString : NULL;
47 }
48
49 void freeCString( char* aCString )
50 {
51 }
52
53 void freeDLString( DLString aDLString )
54 {
55         if ( aDLString ) free( (void*) aDLString );
56 }
57
58 #endif
59