summaryrefslogtreecommitdiff
path: root/mpjpeg.h
blob: f850adc6dd68936e9311747d28e3228a8e369456 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Copyright 2016 Luke Shumaker */

#pragma once

#include <pthread.h>

struct frame {
	ssize_t len;
	size_t cap;
	char *data;
};

struct mpjpeg_stream {
	struct frame a, b;
	struct frame *front, *back;
	pthread_rwlock_t frontlock;
	long framecount;
};

void mpjpeg_reader(struct mpjpeg_stream *s, int fd, const char *boundary);
void mpjpeg_writer(struct mpjpeg_stream *s, int fd, const char *boundary);
void init_mpjpeg_stream();