- all_images[filename] = load_image_raw(filename);
- timespec first_modified = all_images[filename]->last_modified;
- update_threads[filename] =
- thread(bind(update_thread_func, filename, first_modified));
-
- return all_images[filename];
-}
-
-// Some helpers to make RAII versions of FFmpeg objects.
-// The cleanup functions don't interact all that well with unique_ptr,
-// so things get a bit messy and verbose, but overall it's worth it to ensure
-// we never leak things by accident in error paths.
-
-namespace {
-
-void avformat_close_input_unique(AVFormatContext *format_ctx)
-{
- avformat_close_input(&format_ctx);
-}
-
-unique_ptr<AVFormatContext, decltype(avformat_close_input_unique)*>
-avformat_open_input_unique(const char *filename,
- AVInputFormat *fmt, AVDictionary **options)
-{
- AVFormatContext *format_ctx = nullptr;
- if (avformat_open_input(&format_ctx, filename, fmt, options) != 0) {
- format_ctx = nullptr;
- }
- return unique_ptr<AVFormatContext, decltype(avformat_close_input_unique)*>(
- format_ctx, avformat_close_input_unique);
-}
-
-void av_frame_free_unique(AVFrame *frame)
-{
- av_frame_free(&frame);
-}
+ all_images[pathname] = load_image_raw(pathname);
+ timespec first_modified = all_images[pathname]->last_modified;
+ update_threads[pathname] =
+ thread(bind(update_thread_func, pathname, first_modified));