Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
Ramiro Polla authored on 2011/09/14 02:56:28... | ... |
@@ -112,6 +112,22 @@ dshow_read_close(AVFormatContext *s) |
112 | 112 |
IMediaControl_Release(ctx->control); |
113 | 113 |
} |
114 | 114 |
|
115 |
+ if (ctx->graph) { |
|
116 |
+ IEnumFilters *fenum; |
|
117 |
+ int r; |
|
118 |
+ r = IGraphBuilder_EnumFilters(ctx->graph, &fenum); |
|
119 |
+ if (r == S_OK) { |
|
120 |
+ IBaseFilter *f; |
|
121 |
+ IEnumFilters_Reset(fenum); |
|
122 |
+ while (IEnumFilters_Next(fenum, 1, &f, NULL) == S_OK) |
|
123 |
+ if (IGraphBuilder_RemoveFilter(ctx->graph, f) == S_OK) |
|
124 |
+ IEnumFilters_Reset(fenum); /* When a filter is removed, |
|
125 |
+ * the list must be reset. */ |
|
126 |
+ IEnumFilters_Release(fenum); |
|
127 |
+ } |
|
128 |
+ IGraphBuilder_Release(ctx->graph); |
|
129 |
+ } |
|
130 |
+ |
|
115 | 131 |
if (ctx->capture_pin[VideoDevice]) |
116 | 132 |
libAVPin_Release(ctx->capture_pin[VideoDevice]); |
117 | 133 |
if (ctx->capture_pin[AudioDevice]) |
... | ... |
@@ -130,22 +146,6 @@ dshow_read_close(AVFormatContext *s) |
130 | 130 |
if (ctx->device_filter[AudioDevice]) |
131 | 131 |
IBaseFilter_Release(ctx->device_filter[AudioDevice]); |
132 | 132 |
|
133 |
- if (ctx->graph) { |
|
134 |
- IEnumFilters *fenum; |
|
135 |
- int r; |
|
136 |
- r = IGraphBuilder_EnumFilters(ctx->graph, &fenum); |
|
137 |
- if (r == S_OK) { |
|
138 |
- IBaseFilter *f; |
|
139 |
- IEnumFilters_Reset(fenum); |
|
140 |
- while (IEnumFilters_Next(fenum, 1, &f, NULL) == S_OK) |
|
141 |
- if (IGraphBuilder_RemoveFilter(ctx->graph, f) == S_OK) |
|
142 |
- IEnumFilters_Reset(fenum); /* When a filter is removed, |
|
143 |
- * the list must be reset. */ |
|
144 |
- IEnumFilters_Release(fenum); |
|
145 |
- } |
|
146 |
- IGraphBuilder_Release(ctx->graph); |
|
147 |
- } |
|
148 |
- |
|
149 | 133 |
if (ctx->device_name[0]) |
150 | 134 |
av_free(ctx->device_name[0]); |
151 | 135 |
if (ctx->device_name[1]) |