4 #include "funcprotos.h"
8 static int total_vcodecs
= 0;
9 static int total_acodecs
= 0;
10 static quicktime_codectable_t
*vcodecs
= NULL
;
11 static quicktime_codectable_t
*acodecs
= NULL
;
16 static int register_vcodec(void (*init_vcodec
)(quicktime_video_map_t
*))
19 vcodecs
= (quicktime_codectable_t
*)realloc(vcodecs
,
20 total_vcodecs
* sizeof(quicktime_codectable_t
));
22 vcodecs
[total_vcodecs
- 1].init_vcodec
= init_vcodec
;
23 return total_vcodecs
- 1;
26 static int register_acodec(void (*init_acodec
)(quicktime_audio_map_t
*))
29 acodecs
= (quicktime_codectable_t
*)realloc(acodecs
,
30 total_acodecs
* sizeof(quicktime_codectable_t
));
31 acodecs
[total_acodecs
- 1].init_acodec
= init_acodec
;
32 return total_acodecs
- 1;
48 static void register_acodecs()
50 register_acodec(quicktime_init_codec_twos
);
51 register_acodec(quicktime_init_codec_rawaudio
);
52 register_acodec(quicktime_init_codec_ima4
);
53 register_acodec(quicktime_init_codec_mp4a
);
54 register_acodec(quicktime_init_codec_ulaw
);
56 register_acodec(quicktime_init_codec_vorbis
);
57 register_acodec(quicktime_init_codec_mp3
);
58 register_acodec(quicktime_init_codec_wmx2
);
59 register_acodec(quicktime_init_codec_wmav1
);
60 register_acodec(quicktime_init_codec_wmav2
);
80 static void register_vcodecs()
83 register_vcodec(quicktime_init_codec_raw
);
85 register_vcodec(quicktime_init_codec_divx
);
86 register_vcodec(quicktime_init_codec_hv60
);
87 register_vcodec(quicktime_init_codec_div3
);
88 register_vcodec(quicktime_init_codec_div3lower
);
89 register_vcodec(quicktime_init_codec_mp4v
);
90 register_vcodec(quicktime_init_codec_svq1
);
91 register_vcodec(quicktime_init_codec_svq3
);
92 register_vcodec(quicktime_init_codec_h263
);
93 register_vcodec(quicktime_init_codec_dv
);
94 register_vcodec(quicktime_init_codec_dvsd
);
96 register_vcodec(quicktime_init_codec_jpeg
);
97 register_vcodec(quicktime_init_codec_mjpa
);
98 register_vcodec(quicktime_init_codec_mjpg
);
99 register_vcodec(quicktime_init_codec_png
);
100 register_vcodec(quicktime_init_codec_rle
);
102 register_vcodec(quicktime_init_codec_yuv2
);
103 register_vcodec(quicktime_init_codec_yuv4
);
104 register_vcodec(quicktime_init_codec_yv12
);
105 register_vcodec(quicktime_init_codec_v410
);
106 register_vcodec(quicktime_init_codec_v308
);
107 register_vcodec(quicktime_init_codec_v408
);
113 int quicktime_find_vcodec(quicktime_video_map_t
*vtrack
)
116 char *compressor
= vtrack
->track
->mdia
.minf
.stbl
.stsd
.table
[0].format
;
117 quicktime_codec_t
*codec_base
= (quicktime_codec_t
*)vtrack
->codec
;
118 if(!total_vcodecs
) register_vcodecs();
120 for(i
= 0; i
< total_vcodecs
; i
++)
122 quicktime_codectable_t
*table
= &vcodecs
[i
];
123 table
->init_vcodec(vtrack
);
124 if(quicktime_match_32(compressor
, codec_base
->fourcc
))
130 codec_base
->delete_vcodec(vtrack
);
131 codec_base
->priv
= 0;
139 int quicktime_find_acodec(quicktime_audio_map_t
*atrack
)
142 char *compressor
= atrack
->track
->mdia
.minf
.stbl
.stsd
.table
[0].format
;
143 int compression_id
= atrack
->track
->mdia
.minf
.stbl
.stsd
.table
[0].compression_id
;
144 int32_t compressor_int
= *(int32_t*)compressor
;
145 quicktime_codec_t
*codec_base
= (quicktime_codec_t
*)atrack
->codec
;
146 if(!total_acodecs
) register_acodecs();
148 for(i
= 0; i
< total_acodecs
; i
++)
150 quicktime_codectable_t
*table
= &acodecs
[i
];
151 table
->init_acodec(atrack
);
153 // For writing and reading Quicktime
154 if(quicktime_match_32(compressor
, codec_base
->fourcc
))
157 // For reading AVI, the fourcc may be 0 and the compression_id used instead
158 // forucc can also be compression_id (mencoder does that)
159 if((compressor
[0] == 0 || compressor_int
== codec_base
->wav_id
) && codec_base
->wav_id
== compression_id
)
163 codec_base
->delete_acodec(atrack
);
164 codec_base
->priv
= 0;