refactoring

This commit is contained in:
Devaev Maxim 2018-09-24 08:01:25 +03:00
parent ad6667feed
commit 9c6852fdf7
5 changed files with 12 additions and 8 deletions

View File

@ -5,7 +5,7 @@ LIBS = -lm -ljpeg -pthread -levent -levent_pthreads
CC = gcc
CFLAGS = -c -std=c99 -O3 -Wall -Wextra -D_GNU_SOURCE
LDFLAGS =
SOURCES = $(shell ls src/*.c)
SOURCES = $(shell ls src/*.c src/jpeg/*.c)
OBJECTS = $(SOURCES:.c=.o)
PROG = ustreamer

View File

@ -32,9 +32,10 @@
#include <jpeglib.h>
#include <linux/videodev2.h>
#include "tools.h"
#include "device.h"
#include "jpeg.h"
#include "../tools.h"
#include "../device.h"
#include "encoder.h"
#define JPEG_OUTPUT_BUFFER_SIZE 4096
@ -67,7 +68,7 @@ static boolean _jpeg_empty_output_buffer(j_compress_ptr jpeg);
static void _jpeg_term_destination(j_compress_ptr jpeg);
void jpeg_compress_buffer(struct device_t *dev, int index) {
int jpeg_compress_buffer(struct device_t *dev, int index) {
// This function based on compress_image_to_jpeg() from mjpg-streamer
struct jpeg_compress_struct jpeg;
@ -109,6 +110,7 @@ void jpeg_compress_buffer(struct device_t *dev, int index) {
jpeg_destroy_compress(&jpeg);
free(line_buffer);
assert(dev->run->pictures[index].size > 0);
return 0;
}
static void _jpeg_set_dest_picture(j_compress_ptr jpeg, unsigned char *picture, unsigned long *written) {

View File

@ -24,7 +24,7 @@
#include <stdlib.h>
#include <stddef.h>
#include "device.h"
#include "../device.h"
void jpeg_compress_buffer(struct device_t *dev, int index);
int jpeg_compress_buffer(struct device_t *dev, int index);

View File

@ -32,9 +32,10 @@
#include "tools.h"
#include "logging.h"
#include "device.h"
#include "jpeg.h"
#include "stream.h"
#include "jpeg/encoder.h"
static long double _stream_get_fluency_delay(struct device_t *dev, struct workers_pool_t *pool);
static void _stream_expose_picture(struct stream_t *stream, unsigned buf_index);

View File

@ -29,6 +29,7 @@
#include <pthread.h>
#include <time.h>
#include <assert.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/syscall.h>