summaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2012-12-17 03:44:51 -0200
committerRamiro Polla <ramiro.polla@gmail.com>2012-12-17 03:44:51 -0200
commit83a9f29f60d9f442989232bacb70d954ffbdc316 (patch)
tree6211093bcb39828acefea588195b52b21b76848f /libavdevice
parent190f6135b48a97dadd7586f154640bec6468df1b (diff)
dshow: call CoUninitialize() on dshow_read_close()
Every call to CoInitialize should have a matching CoUnititalize. Based on patch by Don Moir <donmoir@comcast.net>.
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/dshow.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 6f7e95b1bc..83b5e01042 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -181,6 +181,8 @@ dshow_read_close(AVFormatContext *s)
pktl = next;
}
+ CoUninitialize();
+
return 0;
}
@@ -793,7 +795,6 @@ dshow_add_device(AVFormatContext *avctx,
if (codec->codec_id == AV_CODEC_ID_NONE) {
av_log(avctx, AV_LOG_ERROR, "Unknown compression type. "
"Please report verbose (-v 9) debug information.\n");
- dshow_read_close(avctx);
return AVERROR_PATCHWELCOME;
}
codec->bits_per_coded_sample = bih->biBitCount;
@@ -883,6 +884,8 @@ static int dshow_read_header(AVFormatContext *avctx)
int ret = AVERROR(EIO);
int r;
+ CoInitialize(0);
+
if (!ctx->list_devices && !parse_device_name(avctx)) {
av_log(avctx, AV_LOG_ERROR, "Malformed dshow input string.\n");
goto error;
@@ -906,8 +909,6 @@ static int dshow_read_header(AVFormatContext *avctx)
}
}
- CoInitialize(0);
-
r = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
&IID_IGraphBuilder, (void **) &graph);
if (r != S_OK) {
@@ -1007,12 +1008,12 @@ static int dshow_read_header(AVFormatContext *avctx)
error:
- if (ret < 0)
- dshow_read_close(avctx);
-
if (devenum)
ICreateDevEnum_Release(devenum);
+ if (ret < 0)
+ dshow_read_close(avctx);
+
return ret;
}