[FFmpeg-devel] [PATCH 2/3] Fix Decklink for Mac

Ramiro Polla ramiro.polla at gmail.com
Sun Jan 11 17:22:54 CET 2015


2015-01-11 15:38 GMT+01:00 Georg Lippitsch <georg.lippitsch at gmx.at>:
> ---
>  libavdevice/decklink_common.cpp | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp
> index 07e1651..82b8bdb 100644
> --- a/libavdevice/decklink_common.cpp
> +++ b/libavdevice/decklink_common.cpp
> @@ -70,6 +70,16 @@ static char *dup_wchar_to_utf8(wchar_t *w)
>  #define DECKLINK_STR    OLECHAR *
>  #define DECKLINK_STRDUP dup_wchar_to_utf8
>  #define DECKLINK_FREE(s) SysFreeString(s)
> +#elif __APPLE__
> +static char *dup_cfstring_to_utf8(CFStringRef w)
> +{
> +    char s[256];
> +    CFStringGetCString(w, s, 255, kCFStringEncodingUTF8);
> +    return av_strdup(s);
> +}

Is it not possible to get the string's real length? You could also try
using CFStringGetCStringPtr() first.

> +#define DECKLINK_STR    const __CFString *
> +#define DECKLINK_STRDUP dup_cfstring_to_utf8
> +#define DECKLINK_FREE(s) free((void *) s)
>  #else
>  #define DECKLINK_STR    const char *
>  #define DECKLINK_STRDUP av_strdup
> --
> 1.8.4.5


More information about the ffmpeg-devel mailing list