X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmodules%2Fdecklink%2Fcommon.cpp;fp=src%2Fmodules%2Fdecklink%2Fcommon.cpp;h=84ef72fb8aa41ac47a9f5c501dc2a5dbf9ecb579;hb=b39198884603dd87583b21c840eb595dcaf3708c;hp=0000000000000000000000000000000000000000;hpb=3e2c57731b396081ee8c012c73994e65d8a693e7;p=mlt diff --git a/src/modules/decklink/common.cpp b/src/modules/decklink/common.cpp new file mode 100644 index 00000000..84ef72fb --- /dev/null +++ b/src/modules/decklink/common.cpp @@ -0,0 +1,59 @@ +/* + * common.cpp -- Blackmagic Design DeckLink common functions + * Copyright (C) 2012 Dan Dennedy + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with consumer library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "common.h" +#include + +#ifdef __DARWIN__ + +char* getCString( DLString aDLString ) +{ + char* CString = (char*) malloc( 64 ); + CFStringGetCString( aDLString, CString, 64, kCFStringEncodingMacRoman ); + return CString; +} + +void freeCString( char* aCString ) +{ + if ( aCString ) free( aCString ); +} + +void freeDLString( DLString aDLString ) +{ + if ( aDLString ) CFRelease( aDLString ); +} + +#else + +char* getCString( DLString aDLString ) +{ + return aDLString? (char*) aDLString : NULL; +} + +void freeCString( char* aCString ) +{ +} + +void freeDLString( DLString aDLString ) +{ + if ( aDLString ) free( (void*) aDLString ); +} + +#endif +