blob: df3fa7dd5fcfd2a7e0d3947d68dcfb34bd769071 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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 */
|