int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char *str) { AVCodecContext c; const AVOption *o = 0; const AVOption *p = 0; char name_[128]; char *name; char *param; IDProperty *prop = NULL; avcodec_get_context_defaults3(&c, NULL); strncpy(name_, str, sizeof(name_)); name = name_; while (*name == ' ') name++; param = strchr(name, ':'); if (!param) { param = strchr(name, ' '); } if (param) { *param++ = 0; while (*param == ' ') param++; } o = av_opt_find(&c, name, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ); if (!o) { PRINT("Ignoring unknown expert option %s\n", str); return 0; } if (param && o->type == AV_OPT_TYPE_CONST) { return 0; } if (param && o->type != AV_OPT_TYPE_CONST && o->unit) { p = av_opt_find(&c, param, o->unit, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ); if (p) { prop = BKE_ffmpeg_property_add(rd, (char *) type, p, o); } else { PRINT("Ignoring unknown expert option %s\n", str); } } else { prop = BKE_ffmpeg_property_add(rd, (char *) type, o, NULL); } if (!prop) { return 0; } if (param && !p) { switch (prop->type) { case IDP_INT: IDP_Int(prop) = atoi(param); break; case IDP_FLOAT: IDP_Float(prop) = atof(param); break; case IDP_STRING: strncpy(IDP_String(prop), param, prop->len); break; } } return 1; }
int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char *str) { AVCodecContext c; const AVOption *o = 0; const AVOption *p = 0; char name_[128]; char *name; char *param; IDProperty *prop = NULL; avcodec_get_context_defaults(&c); strncpy(name_, str, sizeof(name_)); name = name_; while (*name == ' ') name++; param = strchr(name, ':'); if (!param) { param = strchr(name, ' '); } if (param) { *param++ = 0; while (*param == ' ') param++; } o = my_av_find_opt(&c, name, NULL, 0, 0); if (!o) { return 0; } if (param && o->type == FF_OPT_TYPE_CONST) { return 0; } if (param && o->type != FF_OPT_TYPE_CONST && o->unit) { p = my_av_find_opt(&c, param, o->unit, 0, 0); if (p) { prop = BKE_ffmpeg_property_add(rd, (char *) type, p - c.av_class->option, o - c.av_class->option); } } else { prop = BKE_ffmpeg_property_add(rd, (char *) type, o - c.av_class->option, 0); } if (!prop) { return 0; } if (param && !p) { switch (prop->type) { case IDP_INT: IDP_Int(prop) = atoi(param); break; case IDP_FLOAT: IDP_Float(prop) = atof(param); break; case IDP_STRING: strncpy(IDP_String(prop), param, prop->len); break; } } return 1; }