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;
47 static void register_acodecs()
49 register_acodec(quicktime_init_codec_twos
);
50 register_acodec(quicktime_init_codec_rawaudio
);
51 register_acodec(quicktime_init_codec_ima4
);
52 register_acodec(quicktime_init_codec_ulaw
);
54 register_acodec(quicktime_init_codec_vorbis
);
55 register_acodec(quicktime_init_codec_mp3
);
56 register_acodec(quicktime_init_codec_wmx2
);
57 register_acodec(quicktime_init_codec_wmav1
);
58 register_acodec(quicktime_init_codec_wmav2
);
77 static void register_vcodecs()
80 register_vcodec(quicktime_init_codec_raw
);
82 register_vcodec(quicktime_init_codec_divx
);
83 register_vcodec(quicktime_init_codec_hv60
);
84 register_vcodec(quicktime_init_codec_div3
);
85 register_vcodec(quicktime_init_codec_div3lower
);
86 register_vcodec(quicktime_init_codec_svq1
);
87 register_vcodec(quicktime_init_codec_dv
);
88 register_vcodec(quicktime_init_codec_dvsd
);
91 register_vcodec(quicktime_init_codec_jpeg
);
92 register_vcodec(quicktime_init_codec_mjpa
);
93 register_vcodec(quicktime_init_codec_png
);
95 register_vcodec(quicktime_init_codec_yuv2
);
96 register_vcodec(quicktime_init_codec_yuv4
);
97 register_vcodec(quicktime_init_codec_yv12
);
98 register_vcodec(quicktime_init_codec_v410
);
99 register_vcodec(quicktime_init_codec_v308
);
100 register_vcodec(quicktime_init_codec_v408
);
106 int quicktime_find_vcodec(quicktime_video_map_t
*vtrack
)
109 char *compressor
= vtrack
->track
->mdia
.minf
.stbl
.stsd
.table
[0].format
;
110 quicktime_codec_t
*codec_base
= (quicktime_codec_t
*)vtrack
->codec
;
111 if(!total_vcodecs
) register_vcodecs();
113 for(i
= 0; i
< total_vcodecs
; i
++)
115 quicktime_codectable_t
*table
= &vcodecs
[i
];
116 table
->init_vcodec(vtrack
);
117 if(quicktime_match_32(compressor
, codec_base
->fourcc
))
123 codec_base
->delete_vcodec(vtrack
);
124 codec_base
->priv
= 0;
132 int quicktime_find_acodec(quicktime_audio_map_t
*atrack
)
135 char *compressor
= atrack
->track
->mdia
.minf
.stbl
.stsd
.table
[0].format
;
136 int compression_id
= atrack
->track
->mdia
.minf
.stbl
.stsd
.table
[0].compression_id
;
137 quicktime_codec_t
*codec_base
= (quicktime_codec_t
*)atrack
->codec
;
138 if(!total_acodecs
) register_acodecs();
140 for(i
= 0; i
< total_acodecs
; i
++)
142 quicktime_codectable_t
*table
= &acodecs
[i
];
143 table
->init_acodec(atrack
);
145 // For writing and reading Quicktime
146 if(quicktime_match_32(compressor
, codec_base
->fourcc
))
149 // For reading AVI, the fourcc may be 0 and the compression_id used instead
150 if(compressor
[0] == 0 && codec_base
->wav_id
== compression_id
)
154 codec_base
->delete_acodec(atrack
);
155 codec_base
->priv
= 0;