Organize sources
This commit is contained in:
parent
1aeceb3637
commit
2562d9881b
15
Makefile
15
Makefile
@ -1,10 +1,11 @@
|
||||
camera_stream: *.c *.h
|
||||
gcc -g -lpthread -o camera_stream *.c
|
||||
SRC := $(wildcard **/*.c)
|
||||
HEADERS := $(wildcard **/*.h)
|
||||
HTML := $(wildcard html/*.js html/*.html)
|
||||
HTML_SRC := $(addsuffix .c,$(HTML))
|
||||
|
||||
jmuxer.min.c: jmuxer.min.js
|
||||
xxd -i $< > $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
video.html.c: video.html
|
||||
camera_stream: $(SRC) $(HTML_SRC) $(HEADERS)
|
||||
gcc -g -lpthread -I$(PWD) -o $@ $(filter %.c, $^)
|
||||
|
||||
html/%.c: html/%
|
||||
xxd -i $< > $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "buffer.h"
|
||||
#include "buffer_list.h"
|
||||
#include "device.h"
|
||||
#include "links.h"
|
||||
#include "v4l2.h"
|
||||
#include "http.h"
|
||||
#include "hw/buffer.h"
|
||||
#include "hw/buffer_list.h"
|
||||
#include "hw/device.h"
|
||||
#include "hw/links.h"
|
||||
#include "hw/v4l2.h"
|
||||
#include "http/http.h"
|
||||
|
||||
#include <signal.h>
|
||||
|
0
jmuxer.min.js → html/jmuxer.min.js
vendored
0
jmuxer.min.js → html/jmuxer.min.js
vendored
@ -1,4 +1,4 @@
|
||||
unsigned char jmuxer_min_js[] = {
|
||||
unsigned char html_jmuxer_min_js[] = {
|
||||
0x21, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x65, 0x2c,
|
||||
0x74, 0x29, 0x7b, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x3d,
|
||||
0x3d, 0x74, 0x79, 0x70, 0x65, 0x6f, 0x66, 0x20, 0x65, 0x78, 0x70, 0x6f,
|
||||
@ -2835,4 +2835,4 @@ unsigned char jmuxer_min_js[] = {
|
||||
0x65, 0x64, 0x28, 0x65, 0x29, 0x7d, 0x7d, 0x5d, 0x29, 0x2c, 0x6f, 0x7d,
|
||||
0x28, 0x42, 0x29, 0x7d, 0x29, 0x29, 0x3b, 0x0a
|
||||
};
|
||||
unsigned int jmuxer_min_js_len = 34016;
|
||||
unsigned int html_jmuxer_min_js_len = 34016;
|
@ -1,4 +1,4 @@
|
||||
unsigned char video_html[] = {
|
||||
unsigned char html_video_html[] = {
|
||||
0x3c, 0x21, 0x64, 0x6f, 0x63, 0x74, 0x79, 0x70, 0x65, 0x20, 0x68, 0x74,
|
||||
0x6d, 0x6c, 0x3e, 0x0a, 0x0a, 0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x20, 0x6c,
|
||||
0x61, 0x6e, 0x67, 0x3d, 0x22, 0x65, 0x6e, 0x22, 0x3e, 0x0a, 0x3c, 0x68,
|
||||
@ -114,4 +114,4 @@ unsigned char video_html[] = {
|
||||
0x3c, 0x2f, 0x62, 0x6f, 0x64, 0x79, 0x3e, 0x0a, 0x3c, 0x2f, 0x68, 0x74,
|
||||
0x6d, 0x6c, 0x3e
|
||||
};
|
||||
unsigned int video_html_len = 1359;
|
||||
unsigned int html_video_html_len = 1359;
|
@ -8,7 +8,7 @@
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "http.h"
|
||||
#include "http/http.h"
|
||||
|
||||
#define BUFSIZE 256
|
||||
|
@ -1,11 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#include "v4l2.h"
|
||||
#include "buffer.h"
|
||||
|
||||
struct http_worker_s;
|
||||
typedef struct buffer_s buffer_t;
|
||||
typedef struct http_worker_s http_worker_t;
|
||||
|
||||
typedef void (*http_method_fn)(struct http_worker_s *worker, FILE *stream);
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "http.h"
|
||||
#include "buffer.h"
|
||||
#include "buffer_lock.h"
|
||||
#include "buffer_list.h"
|
||||
#include "device.h"
|
||||
#include "http/http.h"
|
||||
#include "hw/buffer.h"
|
||||
#include "hw/buffer_lock.h"
|
||||
#include "hw/buffer_list.h"
|
||||
#include "hw/device.h"
|
||||
|
||||
DEFINE_BUFFER_LOCK(http_h264);
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "http.h"
|
||||
#include "buffer.h"
|
||||
#include "buffer_lock.h"
|
||||
#include "http/http.h"
|
||||
#include "hw/buffer.h"
|
||||
#include "hw/buffer_lock.h"
|
||||
|
||||
DEFINE_BUFFER_LOCK(http_jpeg);
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "http.h"
|
||||
#include "buffer.h"
|
||||
#include "buffer_lock.h"
|
||||
#include "http/http.h"
|
||||
#include "hw/buffer.h"
|
||||
#include "hw/buffer_lock.h"
|
||||
|
||||
void http_index(http_worker_t *worker, FILE *stream)
|
||||
{
|
||||
@ -29,24 +29,24 @@ void http_404(http_worker_t *worker, FILE *stream)
|
||||
|
||||
void http_video_html(http_worker_t *worker, FILE *stream)
|
||||
{
|
||||
extern unsigned char video_html[];
|
||||
extern unsigned int video_html_len;
|
||||
extern unsigned char html_video_html[];
|
||||
extern unsigned int html_video_html_len;
|
||||
|
||||
fprintf(stream, "HTTP/1.1 200 OK\r\n");
|
||||
fprintf(stream, "Content-Type: text/html;charset=UTF-8\r\n");
|
||||
fprintf(stream, "\r\n");
|
||||
fwrite(video_html, 1, video_html_len, stream);
|
||||
fwrite(html_video_html, 1, html_video_html_len, stream);
|
||||
fflush(stream);
|
||||
}
|
||||
|
||||
void http_jmuxer_js(http_worker_t *worker, FILE *stream)
|
||||
{
|
||||
extern unsigned char jmuxer_min_js[];
|
||||
extern unsigned int jmuxer_min_js_len;
|
||||
extern unsigned char html_jmuxer_min_js[];
|
||||
extern unsigned int html_jmuxer_min_js_len;
|
||||
|
||||
fprintf(stream, "HTTP/1.1 200 OK\r\n");
|
||||
fprintf(stream, "Content-Type: text/javascript;charset=UTF-8\r\n");
|
||||
fprintf(stream, "\r\n");
|
||||
fwrite(jmuxer_min_js, 1, jmuxer_min_js_len, stream);
|
||||
fwrite(html_jmuxer_min_js, 1, html_jmuxer_min_js_len, stream);
|
||||
fflush(stream);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
#include "buffer.h"
|
||||
#include "buffer_list.h"
|
||||
#include "device.h"
|
||||
#include "hw/buffer.h"
|
||||
#include "hw/buffer_list.h"
|
||||
#include "hw/device.h"
|
||||
|
||||
buffer_t *buffer_open(const char *name, buffer_list_t *buf_list, int index) {
|
||||
buffer_t *buf = calloc(1, sizeof(buffer_t));
|
@ -1,6 +1,6 @@
|
||||
#include "buffer.h"
|
||||
#include "buffer_list.h"
|
||||
#include "device.h"
|
||||
#include "hw/buffer.h"
|
||||
#include "hw/buffer_list.h"
|
||||
#include "hw/device.h"
|
||||
|
||||
buffer_list_t *buffer_list_open(const char *name, struct device_s *dev, unsigned type, bool do_mmap)
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
#include "buffer_lock.h"
|
||||
#include "hw/buffer_lock.h"
|
||||
|
||||
bool buffer_lock_is_used(buffer_lock_t *buf_lock)
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
#include "buffer.h"
|
||||
#include "buffer_list.h"
|
||||
#include "device.h"
|
||||
#include "hw/buffer.h"
|
||||
#include "hw/buffer_list.h"
|
||||
#include "hw/device.h"
|
||||
|
||||
#include <pthread.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "device.h"
|
||||
#include "buffer.h"
|
||||
#include "buffer_list.h"
|
||||
#include "hw/device.h"
|
||||
#include "hw/buffer.h"
|
||||
#include "hw/buffer_list.h"
|
||||
|
||||
device_t *device_open(const char *name, const char *path) {
|
||||
device_t *dev = calloc(1, sizeof(device_t));
|
@ -1,7 +1,7 @@
|
||||
#include "device.h"
|
||||
#include "buffer.h"
|
||||
#include "buffer_list.h"
|
||||
#include "links.h"
|
||||
#include "hw/device.h"
|
||||
#include "hw/buffer.h"
|
||||
#include "hw/buffer_list.h"
|
||||
#include "hw/links.h"
|
||||
|
||||
#define N_FDS 50
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "v4l2.h"
|
||||
#include "hw/v4l2.h"
|
||||
|
||||
int xioctl(const char *name, int fd, int request, void *arg)
|
||||
{
|
Loading…
x
Reference in New Issue
Block a user