diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2011-09-13 14:56:28 -0300 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2011-09-16 11:16:05 +0200 |
commit | 6613db9736605a98927b1d3290b1175d4f79e55e (patch) | |
tree | 2b2f55e93e0f21f15fa6ec672954cce8aadb3526 /libavdevice/dshow.c | |
parent | a1644f6287a55afbb57a6678b69941ba3d80650f (diff) | |
download | ffmpeg-streaming-6613db9736605a98927b1d3290b1175d4f79e55e.zip ffmpeg-streaming-6613db9736605a98927b1d3290b1175d4f79e55e.tar.gz |
dshow: remove filters from graph before releasing them
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
Diffstat (limited to 'libavdevice/dshow.c')
-rw-r--r-- | libavdevice/dshow.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 5fa9000..a9d400c 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -112,6 +112,22 @@ dshow_read_close(AVFormatContext *s) IMediaControl_Release(ctx->control); } + if (ctx->graph) { + IEnumFilters *fenum; + int r; + r = IGraphBuilder_EnumFilters(ctx->graph, &fenum); + if (r == S_OK) { + IBaseFilter *f; + IEnumFilters_Reset(fenum); + while (IEnumFilters_Next(fenum, 1, &f, NULL) == S_OK) + if (IGraphBuilder_RemoveFilter(ctx->graph, f) == S_OK) + IEnumFilters_Reset(fenum); /* When a filter is removed, + * the list must be reset. */ + IEnumFilters_Release(fenum); + } + IGraphBuilder_Release(ctx->graph); + } + if (ctx->capture_pin[VideoDevice]) libAVPin_Release(ctx->capture_pin[VideoDevice]); if (ctx->capture_pin[AudioDevice]) @@ -130,22 +146,6 @@ dshow_read_close(AVFormatContext *s) if (ctx->device_filter[AudioDevice]) IBaseFilter_Release(ctx->device_filter[AudioDevice]); - if (ctx->graph) { - IEnumFilters *fenum; - int r; - r = IGraphBuilder_EnumFilters(ctx->graph, &fenum); - if (r == S_OK) { - IBaseFilter *f; - IEnumFilters_Reset(fenum); - while (IEnumFilters_Next(fenum, 1, &f, NULL) == S_OK) - if (IGraphBuilder_RemoveFilter(ctx->graph, f) == S_OK) - IEnumFilters_Reset(fenum); /* When a filter is removed, - * the list must be reset. */ - IEnumFilters_Release(fenum); - } - IGraphBuilder_Release(ctx->graph); - } - if (ctx->device_name[0]) av_free(ctx->device_name[0]); if (ctx->device_name[1]) |