preparser: thumbnailer: add hw_dec configuration

Disabled by default, but can be forced with the new configuration
option.
This commit is contained in:
Thomas Guillem 2024-11-20 11:04:56 +01:00 committed by Steve Lhomme
parent 22ea9da7f5
commit d1e483cc75
5 changed files with 10 additions and 1 deletions

View File

@ -119,6 +119,9 @@ struct vlc_thumbnailer_arg
VLC_THUMBNAILER_SEEK_FAST,
} speed;
} seek;
/** True to enable hardware decoder */
bool hw_dec;
};
/**

View File

@ -1008,6 +1008,7 @@ libvlc_media_thumbnail_request_by_time( libvlc_instance_t *inst,
.speed = speed == libvlc_media_thumbnail_seek_fast ?
VLC_THUMBNAILER_SEEK_FAST : VLC_THUMBNAILER_SEEK_PRECISE,
},
.hw_dec = false,
};
return libvlc_media_thumbnail_request( inst, md, &thumb_arg, width, height,
crop, picture_type, timeout );
@ -1029,6 +1030,7 @@ libvlc_media_thumbnail_request_by_pos( libvlc_instance_t *inst,
.speed = speed == libvlc_media_thumbnail_seek_fast ?
VLC_THUMBNAILER_SEEK_FAST : VLC_THUMBNAILER_SEEK_PRECISE,
},
.hw_dec = false,
};
return libvlc_media_thumbnail_request( inst, md, &thumb_arg, width, height,
crop, picture_type, timeout );

View File

@ -82,6 +82,7 @@ bool Thumbnailer::generate( const medialibrary::IMedia&, const std::string& mrl,
.pos = position,
.speed = vlc_thumbnailer_arg::seek::VLC_THUMBNAILER_SEEK_FAST,
},
.hw_dec = false,
};
static const struct vlc_thumbnailer_cbs cbs = {

View File

@ -90,6 +90,7 @@ TaskNew(vlc_preparser_t *preparser, void (*run)(void *), input_item_t *item,
if (thumb_arg == NULL)
task->thumb_arg = (struct vlc_thumbnailer_arg) {
.seek.type = VLC_THUMBNAILER_SEEK_NONE,
.hw_dec = false,
};
else
task->thumb_arg = *thumb_arg;
@ -331,7 +332,8 @@ ThumbnailerRun(void *userdata)
const struct vlc_input_thread_cfg cfg = {
.type = INPUT_TYPE_THUMBNAILING,
.hw_dec = INPUT_CFG_HW_DEC_DEFAULT,
.hw_dec = task->thumb_arg.hw_dec ? INPUT_CFG_HW_DEC_ENABLED
: INPUT_CFG_HW_DEC_DISABLED,
.cbs = &cbs,
.cbs_data = task,
};

View File

@ -166,6 +166,7 @@ static void test_thumbnails( libvlc_instance_t* p_vlc )
thumb_arg.seek.speed = test_params[i].b_fast_seek ?
VLC_THUMBNAILER_SEEK_FAST : VLC_THUMBNAILER_SEEK_PRECISE;
}
thumb_arg.hw_dec = false;
static const struct vlc_thumbnailer_cbs cbs = {
.on_ended = thumbnailer_callback,
};