52#define MAX_QUEUE_SIZE 300
92 pthread_mutex_lock(&s->
lock);
98 pthread_mutex_unlock(&s->
lock);
100 assert((current->
data == NULL && current->
data_len == 0) ||
104 if(current->
data == NULL) {
108 FILE *out = fopen(current->
filename,
"wb");
112 if (fwrite(current->
data, current->
data_len, 1, out) != 1) {
131 pthread_mutex_init(&s->
lock, NULL);
133 assert(
path != NULL);
140 fprintf(stderr,
"[Video exporter] Failed to create thread.\n");
153 FILE *summary = fopen(
name,
"w");
156 perror(
"Cannot write video export summary file");
164 fprintf(summary,
"fourcc %.4s\n", (
char *) &fourcc);
167 fprintf(summary,
"count %d\n", s->
total);
178 pthread_mutex_lock(&s->
lock);
187 pthread_mutex_unlock(&s->
lock);
191 pthread_mutex_destroy(&s->
lock);
209 assert(
frame != NULL);
216 fprintf(stderr,
"[Video export] Format change detected, not exporting.\n");
243 pthread_mutex_lock(&s->
lock);
247 fprintf(stderr,
"[Video export] Maximal queue size (%d) exceeded, not saving frame %d.\n",
250 pthread_mutex_unlock(&s->
lock);
264 pthread_mutex_unlock(&s->
lock);
struct video_frame * frame
struct video_desc video_desc_from_frame(const struct video_frame *frame)
Returns struct video_desc from video frame.
struct output_entry * next
char * data
Raw tile data. Pointer must be at least 4B aligned.
unsigned int data_len
length of the data
enum interlacing_t interlacing
unsigned int width
width of every tile (!)
unsigned int height
height of every tile (!)
struct output_entry *volatile *volatile tail
struct output_entry *volatile head
struct video_desc saved_desc
Struct video_frame represents a video frame and contains video description.
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
This file contains some common data types.
const char * get_codec_file_extension(codec_t codec)
uint32_t get_fourcc(codec_t codec)
static void * video_export_thread(void *arg)
void video_export(struct video_export *s, struct video_frame *frame)
void output_summary(struct video_export *s)
void video_export_destroy(struct video_export *s)
struct video_export * video_export_init(const char *path)
#define VIDEO_EXPORT_SUMMARY_VERSION
bool video_desc_eq(struct video_desc a, struct video_desc b)
Compares two video descriptions.