aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2011-09-02 01:35:47 -0300
committerMichael Niedermayer <michaelni@gmx.at>2011-09-06 21:14:51 +0200
commitff5e1b0b7a975fc84137381dd15dcc5a5ff21a78 (patch)
tree122bff0bc19de61a97d41611a17e1238fb4645ab /libavdevice
parent5e77dc2ea76f1c3ba34866ec0ba119826b650559 (diff)
downloadffmpeg-ff5e1b0b7a975fc84137381dd15dcc5a5ff21a78.tar.gz
dshow: properly disconnect and remove filters from graph
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/dshow.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 99135693e2..10e3d4f179 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -92,11 +92,7 @@ dshow_read_close(AVFormatContext *s)
IMediaControl_Stop(ctx->control);
IMediaControl_Release(ctx->control);
}
- if (ctx->graph)
- IGraphBuilder_Release(ctx->graph);
- /* FIXME remove filters from graph */
- /* FIXME disconnect pins */
if (ctx->capture_pin[VideoDevice])
libAVPin_Release(ctx->capture_pin[VideoDevice]);
if (ctx->capture_pin[AudioDevice])
@@ -115,6 +111,20 @@ 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)
+ IGraphBuilder_RemoveFilter(ctx->graph, f);
+ IEnumFilters_Release(fenum);
+ }
+ IGraphBuilder_Release(ctx->graph);
+ }
+
if (ctx->device_name[0])
av_free(ctx->device_name[0]);
if (ctx->device_name[1])