default: break;
}
- return BC_TRANSPARENCY;
+ return -1;
}
int FFVideoConvert::convert_picture_vframe(VFrame *frame,
AVFrame *ip, AVPixelFormat ifmt, int iw, int ih)
{
+ // try bc_xfer methods
+ int imodel = pix_fmt_to_color_model(ifmt);
+ if( imodel >= 0 ) {
+ long y_ofs = 0, u_ofs = 0, v_ofs = 0;
+ uint8_t *data = ip->data[0];
+ if( BC_CModels::is_yuv(imodel) ) {
+ u_ofs = ip->data[1] - data;
+ v_ofs = ip->data[2] - data;
+ }
+ VFrame iframe(data, -1, y_ofs, u_ofs, v_ofs, iw, ih, imodel, ip->linesize[0]);
+ frame->transfer_from(&iframe);
+ return 0;
+ }
+ // try sws methods
AVFrame opic;
int cmodel = frame->get_color_model();
AVPixelFormat ofmt = color_model_to_pix_fmt(cmodel);
void FFMPEG::set_option_path(char *path, const char *fmt, ...)
{
- get_exe_path(path);
- strcat(path, "/ffmpeg/");
+ char *ep = path + BCTEXTLEN-1;
+ strncpy(path, File::get_cindat_path(), ep-path);
+ strncat(path, "/ffmpeg/", ep-path);
path += strlen(path);
va_list ap;
va_start(ap, fmt);
- vsprintf(path, fmt, ap);
+ path += vsnprintf(path, ep-path, fmt, ap);
va_end(ap);
+ *path = 0;
}
void FFMPEG::get_option_path(char *path, const char *type, const char *spec)