[FFmpeg-devel] Patch for device list error in decklink_common.cpp
Jon bae
jonbae77 at gmail.com
Wed Dec 3 16:44:38 CET 2014
2014-12-03 15:46 GMT+01:00 Ramiro Polla <ramiro.polla at gmail.com>:
>
> On 03.12.2014 12:06, Jon bae wrote:
>
>> Thanks Ramiro for the correction!
>> Here is the new patch. (Is it better to post directly the patch, or is ok
>> as a attachment?)
>>
>
> Attachment is better. But please avoid top-posting in this mailing-list.
>
>
> 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".
>>>
>>
>
> From 3c3d5dda659fe30c68a81b0a711cb09bcb5be443 Mon Sep 17 00:00:00 2001
>> From: Jonathan Baecker <jonbae77 at gmail.com>
>> Date: Wed, 3 Dec 2014 12:03:12 +0100
>> Subject: [PATCH] fix COM initialization failed
>>
>> Signed-off-by: Jonathan Baecker <jonbae77 at gmail.com>
>> ---
>> libavdevice/decklink_common.cpp | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavdevice/decklink_common.cpp
>> b/libavdevice/decklink_common.cpp
>> index 6899bd2..4252552 100644
>> --- a/libavdevice/decklink_common.cpp
>> +++ b/libavdevice/decklink_common.cpp
>> @@ -42,13 +42,13 @@ IDeckLinkIterator *CreateDeckLinkIteratorInstance
>> (void)
>> {
>> IDeckLinkIterator *iter;
>>
>> - if (CoInitialize(NULL) != S_OK) {
>> + if (CoInitialize(NULL) < 0) {
>> 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)
>> {
>> + IID_IDeckLinkIterator, (void**) &iter) < 0) {
>> av_log(NULL, AV_LOG_ERROR, "DeckLink drivers not installed.\n");
>> return NULL;
>> }
>>
>
> The CoCreateInstance check doesn't need to be changed.
Ok finally... Here now only the first line changed. Sorry for the mess, I
'm not the right person for that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-COM-initialization-failed.patch
Type: application/octet-stream
Size: 821 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141203/d58008b5/attachment.obj>
More information about the ffmpeg-devel
mailing list