[FFmpeg-devel] Patch for device list error in decklink_common.cpp

Jon bae jonbae77 at gmail.com
Wed Dec 3 12:06:35 CET 2014


Thanks Ramiro for the correction!
Here is the new patch. (Is it better to post directly the patch, or is ok
as a attachment?)

Regards
Jonathan

2014-12-02 22:19 GMT+01:00 Ramiro Polla <ramiro.polla at gmail.com>:

>
> On 02.12.2014 20:30, Jon bae wrote:
>
>> Here is the other patch for decklink_common.cpp. It fix the error:
>>
>>     COM initialization failed
>>     [decklink @ 02e5b520] Could not create DeckLink iterator
>>     dummy: Immediate exit request
>>
>
>  From 203eba2fad14dd6d84552d6c22899792e80b53bb Mon Sep 17 00:00:00 2001
>> From: Jonathan Baecker <jonbae77 at gmail.com>
>> Date: Tue, 2 Dec 2014 20:12:38 +0100
>> Subject: [PATCH 2/2] device list error in decklink_common
>>
>> Signed-off-by: Jonathan Baecker <jonbae77 at gmail.com>
>> ---
>>  libavdevice/decklink_common.cpp | 24 ++++++++++++++----------
>>  1 file changed, 14 insertions(+), 10 deletions(-)
>>
>> diff --git a/libavdevice/decklink_common.cpp
>> b/libavdevice/decklink_common.cpp
>> index 8eff910..8f7e32a 100644
>> --- a/libavdevice/decklink_common.cpp
>> +++ b/libavdevice/decklink_common.cpp
>> @@ -42,16 +42,20 @@ IDeckLinkIterator *CreateDeckLinkIteratorInstance
>> (void)
>>  {
>>      IDeckLinkIterator *iter;
>>
>> -    if (CoInitialize(NULL) != S_OK) {
>> -        av_log(NULL, AV_LOG_ERROR, "COM initialization failed.\n");
>> -        return NULL;
>> -    }
>> -
>> -    if (CoCreateInstance(CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL,
>> -                         IID_IDeckLinkIterator, (void**) &iter) != S_OK)
>> {
>> -        av_log(NULL, AV_LOG_ERROR, "DeckLink drivers not installed.\n");
>> -        return NULL;
>> -    }
>> +    HRESULT result;
>> +    /* Initialize COM on this thread */
>> +    result = CoInitialize(NULL);
>> +    if (FAILED(result)) {
>> +        av_log(NULL, AV_LOG_ERROR, "COM initialization failed.\n");
>> +        return NULL;
>> +    }
>> +
>> +    /* Create an IDeckLinkIterator object to enumerate all DeckLink
>> cards in the system */
>> +    result = CoCreateInstance(CLSID_CDeckLinkIterator, NULL,
>> CLSCTX_ALL, IID_IDeckLinkIterator, (void**)&iter);
>> +    if (FAILED(result)) {
>> +        av_log(NULL, AV_LOG_ERROR, "DeckLink drivers not installed.\n");
>> +        return NULL;
>> +    }
>>
>>      return iter;
>>  }
>> --
>> 2.2.0
>>
>
> This code is Copyright (c) Blackmagic Design. Try just changing the check
> for CoInitialize(NULL) from "!= S_OK" to "< 0".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-COM-initialization-failed.patch
Type: application/octet-stream
Size: 1149 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141203/77cc4421/attachment.obj>


More information about the ffmpeg-devel mailing list