1 <TITLE>Quicktime for Linux
</TITLE>
3 <H1>DV INFORMATION
</H1>
5 Since Quicktime supports DV, the DV library was integrated. Originally
6 the DV library had no front end so an abstraction to the DV library
7 which uses Quicktime
4 Linux semantics was also written. The front end
8 to the integrated DV support is in
<B>libdv.h
</B><P>
10 <H1>THE DV_T OBJECT
</H1>
14 1) Decode and encode video data from a DV frame
<BR>
15 2) Decode and encode audio data from a DV frame
<P>
17 DV stores audio and video in each frame. Function calls in libdv.h
18 handle each separately.
<P>
24 #include
"libdv.h" and create a new dv decoder.
<P>
27 dv_t *dv = dv_new();
<P>
32 Read a video frame from a buffer containing one frame of DV.
<P>
35 dv_read_video(dv, output_rows, data, bytes, color_model);
<P>
38 <B>dv
</B> is the dv decoding object.
<P>
40 <B>output_rows
</B> is an array of pointers, one pointer to each row of an
41 output frame. Each row must have enough memory allocated to store a
42 row of the specified color model. If the colormodel is planar, the
43 first three
<B>output_rows
</B> are the planes and the rest is ignored.
44 The dimensions of the frame must be determined by whatever procedure
45 grabs the data from the device.
<P>
47 <B>data
</B> is the compressed data.
<P>
49 <B>bytes
</B> is the size of the compressed data. This can be a #define from libdv.h.
<P>
51 <B>color_model
</B> is the color model to generate. It can be almost anything
52 from colormodels.h but not all the outputs have been tested.
<P>
56 Read an audio frame. This procedure only works for
2 channel
16 bit
57 encoding in the DV frame. Call dv_read_audio for each frame to extract
61 dv_read_audio(dv, samples, data, size, channels, bits);
<P>
64 <B>dv
</B> is the dv pointer.
<P>
66 <B>samples
</B> is a preallocated buffer of
4096 bytes * channels *
67 bytes per sample, an arbitrary fraction of which are going to be
70 <B>data
</B> is the compressed DV frame.
<P>
72 <B>size
</B> is the number of bytes in the DV frame.
<P>
74 <B>channels
</B> is the number of channels libdv should store in the
75 <B>samples
</B> buffer. The DV format allows up to
4 audio channels.
76 If the DV frame itself has more channels than the user has allocated,
79 This function returns the number of
16 bit, twos complement, native
80 byte order samples deposited in *samples.
<P>
87 Delete the dv object when finished reading frames.
<P>
102 Creating and deleting the dv object is the same as in decoding. This
103 involves
<B>dv_new
</B> and
<B>dv_delete
</B>.
<P>
105 <B>ENCODING VIDEO
</B><P>
108 void dv_write_video(dv_t *dv,
110 unsigned char **input_rows,
115 Compresses the uncompressed frame in
<B>input_rows
</B> to the
116 preallocated buffer pointed to by
<B>data
</B>. The size of the buffer
117 is either
<B>DV_NTSC_SIZE
</B> or
<B>DV_PAL_SIZE
</B> depending on the
120 The
<B>color_model
</B> can only be
<B>BC_YUV422
</B> or
123 The
<B>norm
</B> can be
<B>DV_NTSC
</B> or
<B>DV_PAL
</B>. The norm
124 determines the size of the frame that must be passed to
125 <B>input_rows
</B>. DV_NTSC requires a
720x480 frame. DV_PAL requires
128 <B>ENCODING AUDIO
</B><P>
130 After and only after encoding video into the frame, audio may be
134 int dv_write_audio(dv_t *dv,
136 unsigned char *input_samples,
144 <B>data
</B> is the same buffer previously used in the video encoding.
<P>
146 <B>input_samples
</B> is interleaved,
16 bit, twos complement, native
147 byte order, audio in the number of channels specified by
150 <B>max_samples
</B> is the number of samples in the
<B>input_samples
</B>
151 buffer. There should be at least
4096 samples in the buffer.
<P>
153 <B>channels
</B> specifies the number of channels in the interleaved
154 buffer. This matches the number of channels encoded in the DV frame.
155 The DV standard allows
2 to
4 channels, depending on
<B>bits
</B> and
158 <B>bits, rate
</B> specify the encoding of the audio in the DV frame.
<P>
160 The
<B>norm
</B> can be
<B>DV_NTSC
</B> or
<B>DV_PAL
</B>.
<P>
162 This function returns the number of samples actually encoded in the
163 frame. This is usually less than the
<B>max_samples
</B> argument but
164 is not constant. It is up to the user to reuse the remaining samples
165 in the next frame.
<P>