#135 Adding new video files via inotify fails

open
nobody
None
5
2012-04-04
2012-04-04
Anonymous
No

The code change from March 28 moves the function call av_register_all() from metadata.c:GetVideoMetadata() to scanner.c:start_scanner().
Because of this, adding files via inotify (after the initial scan of available data) fails, because the call avformat_open_input(...) will always return error code -2 (ENOENT, "No such file or directory").
This error message is rather misleading (because the file does indeed exist).
The problem is that av_register_all() was only called in a forked process (start_scanner()), and thus has no effect on the main process.

To avoid having to call av_register_all() every time GetVideoMetadata() is called, I propose a new method InitLibAV() in scanner.c, that gets called before the forking takes place.

Discussion