/* SPDX-License-Identifier: GPL-3.0-or-later */ /* * vfetch - neofetch but the ascii part is a video * * Copyright (C) 2026 Doan Luu Duc Tai * */ #ifndef SRC__VIDEO_DEFS_H #define SRC__VIDEO_DEFS_H #include #include #include #include #include #include #include "pl_mpeg.h" typedef struct FrameMetadata { uint64_t offset; uint64_t length; double pts; } FrameMetadata; typedef struct WorkerResources { plm_t *plm; ChafaCanvas *canvas; uint8_t *rgb_buffer; int video_width; int video_height; } WorkerResources; typedef struct CacheFiles { FILE *data_file; FILE *meta_file; } CacheFiles; typedef struct CacheFilePaths { gchar *data_file_path; gchar *meta_file_path; } CacheFilePaths; typedef struct CacheValidationStats { GStatBuf *st_success; GStatBuf *st_data; GStatBuf *st_meta; } CacheValidationStats; #define K_MD5_DIGEST_LENGTH 16 typedef struct { int64_t file_size; int64_t file_mtime; uint32_t width; uint32_t height; double fps; double cell_aspect_ratio; uint8_t symbols_md5[K_MD5_DIGEST_LENGTH]; uint8_t colors_md5[K_MD5_DIGEST_LENGTH]; uint8_t format_md5[K_MD5_DIGEST_LENGTH]; uint8_t chafa_opts_md5[K_MD5_DIGEST_LENGTH]; uint32_t version_tag; } CacheKey; #undef K_MD5_DIGEST_LENGTH typedef struct VideoAnimationArgs { FrameMetadata *frames; char *data_map; char *screen_buffer; off_t data_file_size; size_t num_frames; size_t screen_buffer_size; } VideoAnimationArgs; typedef struct AnimationResources { FILE *meta_stream; GMappedFile *mapped_file; VideoAnimationArgs anim_args; off_t data_file_size; } AnimationResources; #endif /* SRC__VIDEO_DEFS_H */