r136: This commit was manufactured by cvs2svn to create tag 'hv_1_1_8'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / filethread.h
blob0a32a494051a8054a73c6fa477deb22cdc024f17
1 #ifndef FILETHREAD_H
2 #define FILETHREAD_H
4 #include "condition.inc"
5 #include "file.inc"
6 #include "mutex.inc"
7 #include "thread.h"
8 #include "vframe.inc"
11 class FileThread : public Thread
13 public:
14 FileThread(File *file, int do_audio, int do_video);
15 FileThread(File *file,
16 int do_audio,
17 int do_video,
18 long buffer_size,
19 int color_model,
20 int ring_buffers,
21 int compressed);
22 ~FileThread();
24 void create_objects(File *file,
25 int do_audio,
26 int do_video,
27 long buffer_size,
28 int color_model,
29 int ring_buffers,
30 int compressed);
31 int start_writing();
32 // Allocate the buffers and start loop
33 int start_writing(long buffer_size,
34 int color_model,
35 int ring_buffers,
36 int compressed);
37 int stop_writing();
38 // write data into next available buffer
39 int write_buffer(long size);
40 // get pointer to next buffer to be written and lock it
41 double** get_audio_buffer();
42 // get pointer to next frame to be written and lock it
43 VFrame*** get_video_buffer();
45 void run();
46 int swap_buffer();
48 double **audio_buffer[RING_BUFFERS];
49 // (VFrame*)(VFrame array *)(Track *)[ring buffer]
50 VFrame ***video_buffer[RING_BUFFERS];
51 long output_size[RING_BUFFERS]; // Number of frames or samples to write
52 int is_compressed[RING_BUFFERS]; // Whether to use the compressed data in the frame
53 Condition *output_lock[RING_BUFFERS], *input_lock[RING_BUFFERS];
54 // Lock access to the file to allow it to be changed without stopping the loop
55 Mutex *file_lock;
56 int current_buffer;
57 int local_buffer;
58 int last_buffer[RING_BUFFERS];
59 int return_value;
60 int do_audio;
61 int do_video;
62 File *file;
63 int ring_buffers;
64 int buffer_size; // Frames or samples per ring buffer
65 // Color model of frames
66 int color_model;
67 int compressed;
72 #endif