这篇教程C++ AVSValue类代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AVSValue类的典型用法代码示例。如果您正苦于以下问题:C++ AVSValue类的具体用法?C++ AVSValue怎么用?C++ AVSValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。 在下文中一共展示了AVSValue类的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: open // utility functions // Opens AVS file and sets some member variables. void open(const char* avsfile) { DBGLOG("avsutil::impl::cavs_type::open(/"" << avsfile << "/")"); try { // pack the filename as the argument of AviSynth filter AVSValue filename = avsfile; AVSValue args = AVSValue(&filename, 1); // load AviSynth script AVSValue imported = mv_se->Invoke("Import", args, 0); // get the clip and video informations mv_clip = imported.AsClip(); // store filename mv_filepath = avsfile; } catch (AvisynthError& avserr) { mv_is_fine = false; mv_errmsg = avserr.msg; } catch (std::exception& ex) { mv_is_fine = false; mv_errmsg = ex.what(); } }
开发者ID:januswel,项目名称:avsutil,代码行数:28,
示例2: mainint main() { try { cout << "Creating script environment 1..." << endl; IScriptEnvironment* env1 = CreateScriptEnvironment(3); cout << "Creating script environment 2..." << endl; IScriptEnvironment* env2 = CreateScriptEnvironment(3); cout << "Deleting script environment 1..." << endl; delete env1; cout << "Invoking BlankClip on env 2..." << endl; AVSValue ret = env2->Invoke("BlankClip", AVSValue(), 0); PClip clp = ret.AsClip(); cout << "Reading frame 0 from env2..." << endl; PVideoFrame frm = clp->GetFrame(0, env2); } catch (AvisynthError &e) { cerr << "AvisynthError: " << e.msg << endl; return -1; } catch (...) { cerr << "unknown error" << endl; return -1; } return 0;}
开发者ID:GDXN,项目名称:avxsynth,代码行数:27,
示例3: EvaluateAVSValue ExpConditional::Evaluate(IScriptEnvironment* env) { AVSValue cond = If->Evaluate(env); if (!cond.IsBool()) env->ThrowError("Evaluate: left of `?' must be boolean (true/false)"); return (cond.AsBool() ? Then : Else)->Evaluate(env);}
开发者ID:1974kpkpkp,项目名称:AviSynthPlus,代码行数:7,
示例4: dimzon_avs_getvariable_sint __stdcall dimzon_avs_getvariable_s(SafeStruct* pstr, const char* name, char* result, int len){ try { pstr->err[0] = 0; try { AVSValue var = pstr->env->GetVar(name); if(var.Defined()) { if(!var.IsString()) { strncpy_s(pstr->err, ERRMSG_LEN, "AviSynthWrapper: Requested variable is not String!", _TRUNCATE); return AVS_VARWRNGTYPE; } strncpy_s(result, len, var.AsString(), len - 1); return 0; } return AVS_VARNDEFINED; } catch(AvisynthError err) { strncpy_s(pstr->err, ERRMSG_LEN, err.msg, _TRUNCATE); return AVS_GERROR; } } catch(IScriptEnvironment::NotFound) { return AVS_VARNFOUND; }}
开发者ID:BrunoReX,项目名称:xvid4psp,代码行数:31,
示例5: DoEvalbool Write::DoEval( IScriptEnvironment* env) { bool keep_this_line = true; int i; AVSValue expr; AVSValue result; for (i=0; i<arrsize; i++) { expr = arglist[i].expression; if ( (linecheck==1) && (i==0)) { try { result = env->Invoke("Eval",expr); if (!result.AsBool(true)) { keep_this_line = false; break; } } catch (AvisynthError) {// env->ThrowError("Write: Can't eval linecheck expression!"); // results in KEEPING the line } } else { try { result = env->Invoke("Eval",expr); result = env->Invoke("string",result); //convert all results to a string arglist[i].string = result.AsString(EMPTY); } catch (AvisynthError error) { arglist[i].string = env->SaveString(error.msg); } } } return keep_this_line;}
开发者ID:jeeb,项目名称:avisynth,代码行数:31,
示例6: SetRangevoid ConditionalReader::SetRange(int start_frame, int stop_frame, AVSValue v) { int i; start_frame = std::max(std::min(start_frame, vi.num_frames-1), 0); stop_frame = std::max(std::min(stop_frame, vi.num_frames-1), 0); int p; float q; bool r; switch (mode) { case MODE_INT: p = v.AsInt(); for (i = start_frame; i <= stop_frame; i++) { intVal[i] = p; } break; case MODE_FLOAT: q = (float)v.AsFloat(); for (i = start_frame; i <= stop_frame; i++) { floatVal[i] = q; } break; case MODE_BOOL: r = v.AsBool(); for (i = start_frame; i <= stop_frame; i++) { boolVal[i] = r; } break; }}
开发者ID:GDXN,项目名称:avxsynth,代码行数:29,
示例7: GetFramePVideoFrame __stdcall ConditionalSelect::GetFrame(int n, IScriptEnvironment* env) { AVSValue prev_last = env->GetVarDef("last"); // Store previous last AVSValue prev_current_frame = env->GetVarDef("current_frame"); // Store previous current_frame env->SetVar("last", (AVSValue)child); // Set implicit last env->SetVar("current_frame", (AVSValue)n); // Set frame to be tested by the conditional filters. AVSValue result; try { ScriptParser parser(env, expression, "[Conditional Select, Expression]"); PExpression exp = parser.Parse(); result = exp->Evaluate(env); if (!result.IsInt()) env->ThrowError("Conditional Select: Expression must return an integer!"); } catch (AvisynthError error) { env->SetVar("last", prev_last); // Restore implicit last env->SetVar("current_frame", prev_current_frame); // Restore current_frame const int num_frames = child->GetVideoInfo().num_frames; PVideoFrame dst = child->GetFrame(min(num_frames-1, n), env); env->MakeWritable(&dst); env->ApplyMessage(&dst, vi, error.msg, vi.width/W_DIVISOR, 0xa0a0a0, 0, 0); return dst; } env->SetVar("last", prev_last); // Restore implicit last env->SetVar("current_frame", prev_current_frame); // Restore current_frame const int i = result.AsInt(); PVideoFrame dst; if (i < 0 || i >= num_args) { const int num_frames = child->GetVideoInfo().num_frames; dst = child->GetFrame(min(num_frames-1, n), env); } else { const int num_frames = child_array[i]->GetVideoInfo().num_frames; dst = child_array[i]->GetFrame(min(num_frames-1, n), env); } if (show) { char text[32]; _snprintf(text, sizeof(text)-1, "Expression Result:%i/n", result.AsInt()); text[sizeof(text)-1] = '/0'; env->MakeWritable(&dst); env->ApplyMessage(&dst, vi, text, vi.width/4, 0xa0a0a0, 0, 0); } return dst;}
开发者ID:jeeb,项目名称:avisynth,代码行数:59,
示例8: CreateAVSValue __cdecl CSRIAviSynth::Create(AVSValue args, void* user_data, IScriptEnvironment* env){ const char *rname = args.ArraySize() >= 2 ? args[2].AsString() : NULL, *rver = args.ArraySize() >= 3 ? args[3].AsString() : NULL; return new CSRIAviSynth(args[0].AsClip(), env, args[1].AsString(), rname, rver);}
开发者ID:Aegisub,项目名称:Aegisub,代码行数:8,
示例9: DebugPrintfMVClipArray::MVClipArray(const AVSValue &vectors, int nSCD1, int nSCD2, IScriptEnvironment *env){ DebugPrintf("Constructing mvClipArray... : %i", vectors.ArraySize()); size_ = vectors.ArraySize(); pmvClips = new MVClip*[size_]; for ( int i = 0; i < size_; i++ ) pmvClips[i] = new MVClip(vectors[i].AsClip(), nSCD1, nSCD2, env);}
开发者ID:alexeiemam,项目名称:avsScripts,代码行数:8,
示例10: CallAVSValue ExpFunctionCall::Evaluate(IScriptEnvironment* env){ AVSValue result = Call(env); if (result.IsClip()) { return env->Invoke("Cache", result); } return result;}
开发者ID:1974kpkpkp,项目名称:AviSynthPlus,代码行数:10,
示例11: booleanAVSValue ExpAnd::Evaluate(IScriptEnvironment* env) { AVSValue x = a->Evaluate(env); if (!x.IsBool()) env->ThrowError("Evaluate: left operand of && must be boolean (true/false)"); if (!x.AsBool()) return x; AVSValue y = b->Evaluate(env); if (!y.IsBool()) env->ThrowError("Evaluate: right operand of && must be boolean (true/false)"); return y;}
开发者ID:1974kpkpkp,项目名称:AviSynthPlus,代码行数:12,
示例12: Echo Echo( PClip _child, const AVSValue _clips, IScriptEnvironment* env ) : GenericVideoFilter(_child), ClipCount(_clips.ArraySize()) { clips = new PClip[ClipCount]; for (int i=0; i < ClipCount; i++) clips[i] = _clips[i].AsClip(); }
开发者ID:1974kpkpkp,项目名称:AviSynthPlus,代码行数:7,
示例13: OpenFileint AvxContext::OpenFile() { try { AVSValue ret = avx_library.env->Invoke("Import", scriptName); if (!ret.IsClip()) { AVXLOG_ERROR("%s", "Script did not return a clip"); return -1; } clip = ret.AsClip(); vi = clip->GetVideoInfo(); } catch (AvisynthError &e) { AVXLOG_ERROR("AvisynthError: %s", e.msg); return -1; } return 0;}
开发者ID:btb,项目名称:avxsynth,代码行数:16,
示例14: SetFramevoid ConditionalReader::SetFrame(int framenumber, AVSValue v) { if (framenumber < 0 || framenumber > vi.num_frames-1 ) return; switch (mode) { case MODE_INT: intVal[framenumber] = v.AsInt(); break; case MODE_FLOAT: floatVal[framenumber] = (float)v.AsFloat(); break; case MODE_BOOL: boolVal[framenumber] = v.AsBool(); break; }}
开发者ID:GDXN,项目名称:avxsynth,代码行数:17,
示例15: dimzon_avs_isfuncexistsint __stdcall dimzon_avs_isfuncexists(SafeStruct* pstr, const char *func){ pstr->err[0] = 0; try { AVSValue var = pstr->env->FunctionExists(func); if (var.IsBool()) { return (var.AsBool()) ? 0 : AVS_VARNFOUND; } return AVS_VARWRNGTYPE; } catch(AvisynthError err) { strncpy_s(pstr->err, ERRMSG_LEN, err.msg, _TRUNCATE); return AVS_GERROR; }}
开发者ID:BrunoReX,项目名称:xvid4psp,代码行数:18,
示例16: create_iscombedstatic AVSValue __cdeclcreate_iscombed(AVSValue args, void*, ise_t* env){ enum { CLIP, CTHRESH, MTHRESH, MI, BLOCKX, BLOCKY, METRIC, OPT }; CombMask* cm = nullptr; try { AVSValue cf = env->GetVar("current_frame"); validate(!cf.IsInt(), "This filter can only be used within ConditionalFilter."); int n = cf.AsInt(); PClip clip = args[CLIP].AsClip(); int metric = args[METRIC].AsInt(0); int cth = args[CTHRESH].AsInt(metric == 0 ? 6 : 10); int mth = args[MTHRESH].AsInt(9); int mi = args[MI].AsInt(80); int blockx = args[BLOCKX].AsInt(16); int blocky = args[BLOCKY].AsInt(16); bool is_avsplus = env->FunctionExists("SetFilterMTMode"); arch_t arch = get_arch(args[OPT].AsInt(-1), is_avsplus); validate(mi < 0 || mi > 128, "MI must be between 0 and 128."); validate(blockx != 8 && blockx != 16 && blockx != 32, "blockx must be set to 8, 16 or 32."); validate(blocky != 8 && blocky != 16 && blocky != 32, "blocky must be set to 8, 16 or 32."); cm = new CombMask(clip, cth, mth, false, arch, false, metric, is_avsplus); bool is_combed = (get_check_combed(arch))( cm->GetFrame(n, env), mi, blockx, blocky, is_avsplus, env); delete cm; return AVSValue(is_combed); } catch (std::runtime_error& e) { if (cm) delete cm; env->ThrowError("IsCombed: %s", e.what()); } return 0;}
开发者ID:chikuzen,项目名称:CombMask,代码行数:43,
示例17: SetFramevoid ConditionalReader::SetFrame(int framenumber, AVSValue v) { if ((framenumber+offset) < 0 || (framenumber+offset) > vi.num_frames-1 ) return; switch (mode) { case MODE_INT: intVal[framenumber+offset] = v.AsInt(); break; case MODE_FLOAT: floatVal[framenumber+offset] = v.AsFloatf(); break; case MODE_BOOL: boolVal[framenumber+offset] = v.AsBool(); break; case MODE_STRING: stringVal[framenumber+offset] = v.AsString(""); break; }}
开发者ID:jeeb,项目名称:avisynth,代码行数:20,
示例18: strcpy/// @brief Read from environment/// @param _clip///void AvisynthAudioProvider::LoadFromClip(AVSValue _clip) { AVSValue script; // Check if it has audio VideoInfo vi = _clip.AsClip()->GetVideoInfo(); if (!vi.HasAudio()) throw agi::AudioDataNotFoundError("No audio found.", 0); IScriptEnvironment *env = avs_wrapper.GetEnv(); // Convert to one channel char buffer[1024]; strcpy(buffer,lagi_wxString(OPT_GET("Audio/Downmixer")->GetString()).mb_str(csConvLocal)); script = env->Invoke(buffer, _clip); // Convert to 16 bits per sample script = env->Invoke("ConvertAudioTo16bit", script); vi = script.AsClip()->GetVideoInfo(); // Convert sample rate int setsample = OPT_GET("Provider/Audio/AVS/Sample Rate")->GetInt(); if (vi.SamplesPerSecond() < 32000) setsample = 44100; if (setsample != 0) { AVSValue args[2] = { script, setsample }; script = env->Invoke("ResampleAudio", AVSValue(args,2)); } // Set clip PClip tempclip = script.AsClip(); vi = tempclip->GetVideoInfo(); // Read properties channels = vi.AudioChannels(); num_samples = vi.num_audio_samples; sample_rate = vi.SamplesPerSecond(); bytes_per_sample = vi.BytesPerAudioSample(); float_samples = false; clip = tempclip;}
开发者ID:sthenc,项目名称:Aegisub,代码行数:42,
示例19: SetRangevoid ConditionalReader::SetRange(int start_frame, int stop_frame, AVSValue v) { int i; start_frame = max(start_frame+offset, 0); stop_frame = min(stop_frame+offset, vi.num_frames-1); int p; float q; bool r; const char* s; switch (mode) { case MODE_INT: p = v.AsInt(); for (i = start_frame; i <= stop_frame; i++) { intVal[i] = p; } break; case MODE_FLOAT: q = v.AsFloatf(); for (i = start_frame; i <= stop_frame; i++) { floatVal[i] = q; } break; case MODE_BOOL: r = v.AsBool(); for (i = start_frame; i <= stop_frame; i++) { boolVal[i] = r; } break; case MODE_STRING: s = v.AsString(""); for (i = start_frame; i <= stop_frame; i++) { stringVal[i] = s; } break; }}
开发者ID:jeeb,项目名称:avisynth,代码行数:36,
示例20: LoadPluginAVSValue LoadPlugin(AVSValue args, void* user_data, IScriptEnvironment* env) { bool quiet = (user_data != 0); args = args[0]; const char* result=0; for (int i=0; i<args.ArraySize(); ++i) { HMODULE plugin; const char* plugin_name = args[i].AsString(); if (MyLoadLibrary(plugin_name, &plugin, quiet, env)) { typedef const char* (__stdcall *AvisynthPluginInitFunc)(IScriptEnvironment* env); AvisynthPluginInitFunc AvisynthPluginInit = (AvisynthPluginInitFunc)dlsym(plugin, "AvisynthPluginInit2"); if (!AvisynthPluginInit) { AvisynthPluginInit = (AvisynthPluginInitFunc)dlsym(plugin, "[email C++ AVThread类代码示例 C++ AVLTree类代码示例
|