diff options
| author | Doan Luu Duc Tai <doan@luuduct.ai> | 2026-09-08 14:46:47 -0500 |
|---|---|---|
| committer | Doan Luu Duc Tai <doan@luuduct.ai> | 2026-09-08 14:46:47 -0500 |
| commit | f34fb5042d40c186583f9e3009d8a1dd71d07d43 (patch) | |
| tree | 3f494f3723ebe9f173d0702a97509794f0ef85a5 /src/video_defs.h | |
Initial commitmain
Diffstat (limited to 'src/video_defs.h')
| -rw-r--r-- | src/video_defs.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/video_defs.h b/src/video_defs.h new file mode 100644 index 0000000..df3fa7d --- /dev/null +++ b/src/video_defs.h @@ -0,0 +1,82 @@ +/* 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 <chafa/chafa.h> +#include <glib.h> +#include <glib/gstdio.h> +#include <sys/types.h> +#include <stdint.h> +#include <stdio.h> +#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 */ |
