Load back wide thumbnail metadata
This commit is contained in:
parent
2d86ffed34
commit
c1af556751
10
fiv-io.c
10
fiv-io.c
|
@ -1718,6 +1718,7 @@ open_libwebp(const gchar *data, gsize len, const gchar *path,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Releasing the demux chunk iterator is actually a no-op.
|
// Releasing the demux chunk iterator is actually a no-op.
|
||||||
|
// TODO(p): Avoid copy-pasting the chunk transfer code.
|
||||||
WebPChunkIterator chunk_iter = {};
|
WebPChunkIterator chunk_iter = {};
|
||||||
uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS);
|
uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS);
|
||||||
if ((flags & EXIF_FLAG) &&
|
if ((flags & EXIF_FLAG) &&
|
||||||
|
@ -1741,6 +1742,12 @@ open_libwebp(const gchar *data, gsize len, const gchar *path,
|
||||||
(cairo_destroy_func_t) g_bytes_unref);
|
(cairo_destroy_func_t) g_bytes_unref);
|
||||||
WebPDemuxReleaseChunkIterator(&chunk_iter);
|
WebPDemuxReleaseChunkIterator(&chunk_iter);
|
||||||
}
|
}
|
||||||
|
if (WebPDemuxGetChunk(demux, "THUM", 1, &chunk_iter)) {
|
||||||
|
cairo_surface_set_user_data(result, &fiv_io_key_thum,
|
||||||
|
g_bytes_new(chunk_iter.chunk.bytes, chunk_iter.chunk.size),
|
||||||
|
(cairo_destroy_func_t) g_bytes_unref);
|
||||||
|
WebPDemuxReleaseChunkIterator(&chunk_iter);
|
||||||
|
}
|
||||||
if (flags & ANIMATION_FLAG) {
|
if (flags & ANIMATION_FLAG) {
|
||||||
cairo_surface_set_user_data(result, &fiv_io_key_loops,
|
cairo_surface_set_user_data(result, &fiv_io_key_loops,
|
||||||
(void *) (uintptr_t) WebPDemuxGetI(demux, WEBP_FF_LOOP_COUNT),
|
(void *) (uintptr_t) WebPDemuxGetI(demux, WEBP_FF_LOOP_COUNT),
|
||||||
|
@ -2280,6 +2287,7 @@ cairo_user_data_key_t fiv_io_key_exif;
|
||||||
cairo_user_data_key_t fiv_io_key_orientation;
|
cairo_user_data_key_t fiv_io_key_orientation;
|
||||||
cairo_user_data_key_t fiv_io_key_icc;
|
cairo_user_data_key_t fiv_io_key_icc;
|
||||||
cairo_user_data_key_t fiv_io_key_xmp;
|
cairo_user_data_key_t fiv_io_key_xmp;
|
||||||
|
cairo_user_data_key_t fiv_io_key_thum;
|
||||||
|
|
||||||
cairo_user_data_key_t fiv_io_key_frame_next;
|
cairo_user_data_key_t fiv_io_key_frame_next;
|
||||||
cairo_user_data_key_t fiv_io_key_frame_previous;
|
cairo_user_data_key_t fiv_io_key_frame_previous;
|
||||||
|
@ -2981,7 +2989,7 @@ static cairo_surface_t *
|
||||||
read_wide_thumbnail(
|
read_wide_thumbnail(
|
||||||
const gchar *path, const gchar *uri, time_t mtime, GError **error)
|
const gchar *path, const gchar *uri, time_t mtime, GError **error)
|
||||||
{
|
{
|
||||||
// TODO(p): Validate.
|
// TODO(p): Validate fiv_io_key_thum.
|
||||||
(void) uri;
|
(void) uri;
|
||||||
(void) mtime;
|
(void) mtime;
|
||||||
return fiv_io_open(path, NULL, FALSE, error);
|
return fiv_io_open(path, NULL, FALSE, error);
|
||||||
|
|
2
fiv-io.h
2
fiv-io.h
|
@ -47,6 +47,8 @@ extern cairo_user_data_key_t fiv_io_key_orientation;
|
||||||
extern cairo_user_data_key_t fiv_io_key_icc;
|
extern cairo_user_data_key_t fiv_io_key_icc;
|
||||||
/// GBytes with plain XMP data.
|
/// GBytes with plain XMP data.
|
||||||
extern cairo_user_data_key_t fiv_io_key_xmp;
|
extern cairo_user_data_key_t fiv_io_key_xmp;
|
||||||
|
/// GBytes with a WebP's THUM chunk, used for our thumbnails.
|
||||||
|
extern cairo_user_data_key_t fiv_io_key_thum;
|
||||||
|
|
||||||
/// The next frame in a sequence, as a surface, in a chain, pre-composited.
|
/// The next frame in a sequence, as a surface, in a chain, pre-composited.
|
||||||
/// There is no wrap-around.
|
/// There is no wrap-around.
|
||||||
|
|
Loading…
Reference in New Issue