bool Context::runScriptFunction(const std::string &signature) { asIScriptModule *module = asDetails.asEngine->GetModule(0); assert(module); asIScriptFunction *function = module->GetFunctionByDecl(signature.c_str()); if(function == 0) { std::cout << "Failed to find function" << std::endl; return false; } assert(m_context); getCtx()->Prepare(function); const int r = m_context->Execute(); if(r != asEXECUTION_FINISHED) { if(r == asEXECUTION_EXCEPTION) { std::cout << getCtx()->GetExceptionString() << std::endl; } } return true; }
Coder* Container::Stream::getCoder() { if (!mCoder) { // we need to know the stream direction... AVFormatContext* ctx = mContainer->getFormatCtx(); AVStream* stream = getCtx(); if (!ctx || !stream) { VS_THROW(HumbleRuntimeError("could not get container context to find coder")); } if (!stream->codec) { VS_THROW(HumbleRuntimeError("No codec set for stream")); } RefPointer<Codec> codec; if (ctx->iformat) { // make a copy of the decoder so we decouple it from the container // completely codec = Codec::findDecodingCodec((Codec::ID)stream->codec->codec_id); if (!codec) { VS_THROW(HumbleRuntimeError("could not find decoding codec")); } mCoder = Decoder::make(codec.value(), stream->codec, true); } else { VS_THROW(HumbleRuntimeError("Got null encoder on MuxerStream which should not be possible")); } } return mCoder.get(); }
Decoder* DemuxerStream::getDecoder() { AVStream* stream = getCtx(); if (!mDecoder) { if (stream->codec) { // make a copy of the decoder so we decouple it from the container // completely RefPointer<Codec> codec = Codec::findDecodingCodec((Codec::ID)stream->codec->codec_id); if (!codec) { VS_THROW(HumbleRuntimeError("could not find decoding codec")); } mDecoder = Decoder::make(codec.value(), stream->codec, true); } } return mDecoder.get(); }
KeyValueBag* MediaRaw::getMetaData() { return KeyValueBagImpl::make(av_frame_get_metadata(getCtx())); }