Discussion:
IFileSinkFilter bug - won't close file???
(too old to reply)
Jon Evans
2004-08-16 15:17:02 UTC
Permalink
I have a graph that records to a file. Great, lets call
that file #1. I then stop the graph and call IFileSinkFilter's
SetFileName() function to record a different file, #2.

However now file 2 is being recorded I expect to be able
to open file #1 ... only I can't, I get a sharing violation
error.

e.g. IMediaDet::put_Filename( file#1 ) returns an error
which DXGetErrorString9() decodes as
"ERROR_SHARING_VIOLATION". I can only
open the file after exiting and restarting my application.

So, clearly IFileSinkFilter doesn't properly release a file
it has finished with. Is this a known bug and more
importantly anyone have a workaround ?

TTFN,
Jon
Jeremy Noring
2004-08-16 15:26:49 UTC
Permalink
I don't know if it's a bug, but the obvious "workaround" would be to release
that filter graph and start a new one for the new file. I would personally
suspect that the SetFileName function for a given graph can't be called
multiple times (one time only) and calling it again would result in errors.
Swapping files in the middle of a stream isn't trivial, and I doubt the
IFileSinkFilter supports that functionality.
--
Where am I going?
And why am I in this handbasket?
Jon Evans
2004-08-17 07:33:01 UTC
Permalink
Post by Jeremy Noring
I don't know if it's a bug, but the obvious "workaround" would be to release
that filter graph and start a new one for the new file. I would personally
suspect that the SetFileName function for a given graph can't be called
multiple times (one time only) and calling it again would result in errors.
Swapping files in the middle of a stream isn't trivial, and I doubt the
IFileSinkFilter supports that functionality.
Hi Jeremy,

Originally I did completely rebuild the graph but this did look
rather ugly when changing filenames, particularly as in this
app it is a relatively frequent occurance.

However, provided the graph is stopped you can change the
filename and indeed the IID_IFileSinkFilter2 provides SetMode()
to control how the new file works. I can repeatedly change the
filename (at least 30 times - I tried !) and everything works
correctly except for the files not appearing to have been closed.

TTFN,
Jon
Enze
2004-08-17 09:57:35 UTC
Permalink
Hi,
this is a known limitation and discussed previous
in newsgroup.
There are special DS filter avaliable to solve this problem,
this filters are free for uncommercial use.
see www.mpegcode.com,
enze
Post by Jon Evans
Post by Jeremy Noring
I don't know if it's a bug, but the obvious "workaround" would be to release
that filter graph and start a new one for the new file. I would personally
suspect that the SetFileName function for a given graph can't be called
multiple times (one time only) and calling it again would result in errors.
Swapping files in the middle of a stream isn't trivial, and I doubt the
IFileSinkFilter supports that functionality.
Hi Jeremy,
Originally I did completely rebuild the graph but this did look
rather ugly when changing filenames, particularly as in this
app it is a relatively frequent occurance.
However, provided the graph is stopped you can change the
filename and indeed the IID_IFileSinkFilter2 provides SetMode()
to control how the new file works. I can repeatedly change the
filename (at least 30 times - I tried !) and everything works
correctly except for the files not appearing to have been closed.
TTFN,
Jon
Loading...