static AS3_Val init(void * self, AS3_Val args) { void * ref; void * src; void * dest; AS3_ArrayValue(args, "AS3ValType, AS3ValType, AS3ValType", &ref, &src, &dest); flashErrorsRef = (AS3_Val)ref; config.wave.file = funopen((void *)src, readByteArray, writeByteArray, seekByteArray, closeByteArray); config.wave.output = funopen((void *)dest, readByteArray, writeByteArray, seekByteArray, closeByteArray); if (config.wave.file == NULL || config.wave.output == NULL) { ERROR("Unable to set bytes arrays"); } wave_open(); set_defaults(); check_config(); start_compress(); return AS3_Int(1); }
void JpegEncoder::encode(const unsigned char* bgra32) { DBG("encode(%p)\n", bgra32); unsigned char rgb24[m_width*3]; start_compress(); for(size_t it=0; it<m_height; it++) { convert_bgra32_to_rgb24(bgra32, rgb24); encode_single_scanline(rgb24); bgra32 += m_cinfo.image_width*4; } finish_compress(); }