initial commit
[goodguy/history.git] / cinelerra-5.0 / quicktime / qtffmpeg.h
1 #ifndef QTFFMPEG_H
2 #define QTFFMPEG_H
3
4
5
6 // This must be separate from qtprivate.h to keep everyone from
7 // depending on avcodec.h
8 // FFMPEG front end for quicktime.
9 // Getting ffmpeg to do all the things it needs to do is so labor
10 // intensive, we have a front end for the ffmpeg front end.
11
12
13 // This front end is bastardized to support alternating fields with
14 // alternating ffmpeg instances.  It drastically reduces the bitrate
15 // required to store interlaced video but nothing can read it but
16 // Heroine Virtual.
17
18
19
20 #include "libavformat/avformat.h"
21 #include "libavcodec/avcodec.h"
22 #include "qtprivate.h"
23
24 #include <pthread.h>
25
26 typedef struct
27 {
28 #define FIELDS 2
29 // Encoding
30     AVCodec *encoder[FIELDS];
31         AVCodecContext *encoder_context[FIELDS];
32
33
34 // Decoding
35     AVCodec *decoder[FIELDS];
36         AVCodecContext *decoder_context[FIELDS];
37     AVFrame picture[FIELDS];
38
39 // Last frame decoded
40         int64_t last_frame[FIELDS];
41 // Rounded dimensions
42         int width_i;
43         int height_i;
44 // Original dimensions
45         int width;
46         int height;
47         int fields;
48
49
50 // Temporary storage for color conversions
51         char *temp_frame;
52 // Storage of compressed data
53         unsigned char *work_buffer;
54 // Allocation of work_buffer
55         int buffer_size;
56         int ffmpeg_id;
57 } quicktime_ffmpeg_t;
58
59 extern int ffmpeg_initialized;
60 extern pthread_mutex_t ffmpeg_lock;
61
62
63 quicktime_ffmpeg_t *quicktime_new_ffmpeg(int cpus,
64         int fields,int ffmpeg_id, int w,int h,
65         quicktime_stsd_table_t *stsd_table); // FFmpeg needs this for the header
66 void quicktime_delete_ffmpeg(quicktime_ffmpeg_t *ptr);
67 int quicktime_ffmpeg_decode(quicktime_ffmpeg_t *ffmpeg,
68         quicktime_t *file, unsigned char **row_pointers, int track);
69
70 int quicktime_decode_audio3(
71                 AVCodecContext *avctx, int16_t *samples,
72                 int *frame_size_ptr, AVPacket *avpkt);
73
74
75 #endif
76