4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef IEC61883OUTPUT_H
23 #define IEC61883OUTPUT_H
29 #include "audiodevice.inc"
30 #include "condition.inc"
31 #include "libiec61883/iec61883.h"
36 #include "videodevice.inc"
38 // Common 1394 output for audio and video
40 // This runs continuously to keep the VTR warm.
41 // Takes encoded DV frames and PCM audio.
42 class IEC61883Output : public Thread
45 IEC61883Output(VideoDevice *vdevice);
46 IEC61883Output(AudioDevice *adevice);
61 // Write frame with timed blocking.
63 void write_frame(VFrame *input);
66 // Write audio with timed blocking.
68 void write_samples(char *data, int samples);
69 long get_audio_position();
75 void increment_counter(int *counter);
76 void decrement_counter(int *counter);
77 int read_frame(unsigned char *data, int n, unsigned int dropped);
86 int current_outbuffer;
90 // Encoder for audio frames
94 // Block while waiting for the first buffer to be allocated
95 Condition *start_lock;
98 // Provide timed blocking for writing routines.
100 Condition *video_lock;
101 Condition *audio_lock;
107 raw1394handle_t handle;
109 // Must break up each frame into 480 byte chunks again.
118 VFrame *temp_frame, *temp_frame2;
119 // Encoder for making DV frames
122 unsigned char *output_buffer;
124 unsigned int packet_sizes[321];
125 unsigned char continuity_counter;
136 VideoDevice *vdevice;
137 AudioDevice *adevice;