mirror of
https://github.com/Harshit-Dhanwalkar/AsciiCam.git
synced 2026-06-15 10:45:13 +02:00
Organise project
This commit is contained in:
parent
c766d23028
commit
02926a2623
13 changed files with 398 additions and 288 deletions
15
include/ascii.h
Normal file
15
include/ascii.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef ASCII_H
|
||||
#define ASCII_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define ASCII_CHARS " .:-=+*#%@"
|
||||
|
||||
// Convert YUYV raw data to grayscale
|
||||
void yuyv_to_gray(const uint8_t *yuyv, uint8_t *gray, int width, int height);
|
||||
|
||||
// grayscale to ASCII output grid
|
||||
char *grayscale_to_ascii(const uint8_t *gray, int src_w, int src_h,
|
||||
int dst_w, int dst_h);
|
||||
|
||||
#endif
|
||||
30
include/capture.h
Normal file
30
include/capture.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef CAPTURE_H
|
||||
#define CAPTURE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <linux/videodev2.h>
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
int width;
|
||||
int height;
|
||||
void *buffer;
|
||||
struct v4l2_buffer buf_info;
|
||||
} webcam_t;
|
||||
|
||||
// Initialize webcam
|
||||
int webcam_init(webcam_t *cam, const char *device, int width, int height);
|
||||
|
||||
// Wait for frame to be ready
|
||||
int webcam_wait_frame(webcam_t *cam, int timeout_ms);
|
||||
|
||||
// Capture frame, dequeue buffer, fill grayscale output buffer
|
||||
int webcam_capture_frame(webcam_t *cam, uint8_t *gray_buffer);
|
||||
|
||||
// Re‑queue buffer
|
||||
int webcam_requeue_buffer(webcam_t *cam);
|
||||
|
||||
// Stop streaming and clean up resources
|
||||
void webcam_cleanup(webcam_t *cam);
|
||||
|
||||
#endif
|
||||
11
include/timing.h
Normal file
11
include/timing.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef TIMING_H
|
||||
#define TIMING_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
// Initialize framerate control
|
||||
void timing_init(int fps);
|
||||
|
||||
void timing_sleep(struct timespec *start_time);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue