diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-08-27 21:07:15 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-08-27 22:13:45 +0200 |
commit | 7ad14e7a3e6f87ddc450f7e34621eb5200808451 (patch) | |
tree | 8804d0dd24cc126087462edfbbbf73ed61b56b0e /modules | |
parent | 37da8155a4500a9386027b4d791a86186bc7ab4a (diff) |
Dead code tells no tales
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gd_compiler.h | 13 | ||||
-rw-r--r-- | modules/gdscript/gd_editor.cpp | 124 | ||||
-rw-r--r-- | modules/gdscript/gd_function.cpp | 16 | ||||
-rw-r--r-- | modules/gdscript/gd_script.cpp | 104 | ||||
-rw-r--r-- | modules/gdscript/gd_tokenizer.cpp | 50 | ||||
-rw-r--r-- | modules/gdscript/register_types.cpp | 103 | ||||
-rw-r--r-- | modules/gridmap/grid_map.h | 4 | ||||
-rw-r--r-- | modules/openssl/stream_peer_openssl.cpp | 19 | ||||
-rw-r--r-- | modules/theora/video_stream_theora.cpp | 151 |
9 files changed, 9 insertions, 575 deletions
diff --git a/modules/gdscript/gd_compiler.h b/modules/gdscript/gd_compiler.h index 5caa3b0ee1..ac713ae75b 100644 --- a/modules/gdscript/gd_compiler.h +++ b/modules/gdscript/gd_compiler.h @@ -91,7 +91,6 @@ class GDCompiler { } } - //int get_identifier_pos(const StringName& p_dentifier) const; HashMap<Variant, int, VariantHasher, VariantComparator> constant_map; Map<StringName, int> name_map; @@ -127,17 +126,6 @@ class GDCompiler { int call_max; }; -#if 0 - void _create_index(const GDParser::OperatorNode *on); - void _create_call(const GDParser::OperatorNode *on); - - - int _parse_expression(const GDParser::Node *p_expr,CodeGen& codegen); - void _parse_block(GDParser::BlockNode *p_block); - void _parse_function(GDParser::FunctionNode *p_func); - Ref<GDScript> _parse_class(GDParser::ClassNode *p_class); -#endif - bool _is_class_member_property(CodeGen &codegen, const StringName &p_name); bool _is_class_member_property(GDScript *owner, const StringName &p_name); @@ -146,7 +134,6 @@ class GDCompiler { bool _create_unary_operator(CodeGen &codegen, const GDParser::OperatorNode *on, Variant::Operator op, int p_stack_level); bool _create_binary_operator(CodeGen &codegen, const GDParser::OperatorNode *on, Variant::Operator op, int p_stack_level, bool p_initializer = false); - //int _parse_subexpression(CodeGen& codegen,const GDParser::BlockNode *p_block,const GDParser::Node *p_expression); int _parse_assign_right_expression(CodeGen &codegen, const GDParser::OperatorNode *p_expression, int p_stack_level); int _parse_expression(CodeGen &codegen, const GDParser::Node *p_expression, int p_stack_level, bool p_root = false, bool p_initializer = false); Error _parse_block(CodeGen &codegen, const GDParser::BlockNode *p_block, int p_stack_level = 0, int p_break_addr = -1, int p_continue_addr = -1); diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 349918f317..b0a18b4b4b 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -27,12 +27,14 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "gd_script.h" + #include "editor/editor_settings.h" #include "gd_compiler.h" -#include "gd_script.h" #include "global_constants.h" #include "os/file_access.h" #include "project_settings.h" + #ifdef TOOLS_ENABLED #include "editor/editor_file_system.h" #include "editor/editor_settings.h" @@ -1672,21 +1674,6 @@ static void _find_type_arguments(GDCompletionContext &context, const GDParser::N return; //found } } -#if 0 - //use class directly, no code was found - if (!isfunction) { - for (const Map<StringName,Variant>::Element *E=scr->get_constants().front();E;E=E->next()) { - options.insert(E->key()); - } - } - for (const Map<StringName,GDFunction>::Element *E=scr->get_member_functions().front();E;E=E->next()) { - options.insert(String(E->key())+"("); - } - - for (const Set<StringName>::Element *E=scr->get_members().front();E;E=E->next()) { - options.insert(E->get()); - } -#endif } if (scr->get_base().is_valid()) @@ -2027,99 +2014,6 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N } } } -#if 0 - bool _static=context.function->_static; - - - - - for(int i=0;i<context._class->static_functions.size();i++) { - if (context._class->static_functions[i]->arguments.size()) - result.insert(context._class->static_functions[i]->name.operator String()+"("); - else - result.insert(context._class->static_functions[i]->name.operator String()+"()"); - } - - if (!p_static) { - - for(int i=0;i<context._class->functions.size();i++) { - if (context._class->functions[i]->arguments.size()) - result.insert(context._class->functions[i]->name.operator String()+"("); - else - result.insert(context._class->functions[i]->name.operator String()+"()"); - } - } - - Ref<Reference> base = _get_parent_class(context); - - while(true) { - - Ref<GDScript> script = base; - Ref<GDNativeClass> nc = base; - if (script.is_valid()) { - - if (!p_static && !p_only_functions) { - for (const Set<StringName>::Element *E=script->get_members().front();E;E=E->next()) { - result.insert(E->get().operator String()); - } - } - - if (!p_only_functions) { - for (const Map<StringName,Variant>::Element *E=script->get_constants().front();E;E=E->next()) { - result.insert(E->key().operator String()); - } - } - - for (const Map<StringName,GDFunction>::Element *E=script->get_member_functions().front();E;E=E->next()) { - if (!p_static || E->get().is_static()) { - if (E->get().get_argument_count()) - result.insert(E->key().operator String()+"("); - else - result.insert(E->key().operator String()+"()"); - } - } - - if (!p_only_functions) { - for (const Map<StringName,Ref<GDScript> >::Element *E=script->get_subclasses().front();E;E=E->next()) { - result.insert(E->key().operator String()); - } - } - - base=script->get_base(); - if (base.is_null()) - base=script->get_native(); - } else if (nc.is_valid()) { - - if (!p_only_functions) { - - StringName type = nc->get_name(); - List<String> constants; - ClassDB::get_integer_constant_list(type,&constants); - for(List<String>::Element *E=constants.front();E;E=E->next()) { - result.insert(E->get()); - } - - List<MethodInfo> methods; - ClassDB::get_method_list(type,&methods); - for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) { - if (E->get().arguments.size()) - result.insert(E->get().name+"("); - else - result.insert(E->get().name+"()"); - } - } - break; - } else - break; - - } - - for(int i=0;i<GDFunctions::FUNC_MAX;i++) { - - result.insert(GDFunctions::get_func_name(GDFunctions::Function(i))); - } - -#endif } Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, bool &r_forced, String &r_call_hint) { @@ -2852,18 +2746,6 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol } } } -#if 0 - GDCompletionIdentifier identifier; - if (_guess_identifier_type(context,p.get_completion_line(),p_symbol,identifier)) { - - print_line("var type: "+Variant::get_type_name(identifier.type)); - if (identifier.script.is_valid()) { - print_line("var script: "+identifier.script->get_path()); - } - print_line("obj type: "+String(identifier.obj_type)); - print_line("value: "+String(identifier.value)); - } -#endif } } break; diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index 0c9eca894f..81bf4664d8 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -1319,22 +1319,6 @@ void GDFunction::debug_get_stack_member_state(int p_line, List<Pair<StringName, } } -#if 0 -void GDFunction::clear() { - - name=StringName(); - constants.clear(); - _stack_size=0; - code.clear(); - _constants_ptr=NULL; - _constant_count=0; - _global_names_ptr=NULL; - _global_names_count=0; - _code_ptr=NULL; - _code_size=0; - -} -#endif GDFunction::GDFunction() : function_list(this) { diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 476fca6382..cf6529d5ae 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "gd_script.h" + #include "gd_compiler.h" #include "global_constants.h" #include "io/file_access_encrypted.h" @@ -42,11 +43,6 @@ GDNativeClass::GDNativeClass(const StringName &p_name) { name = p_name; } -/*void GDNativeClass::call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount){ - - -}*/ - bool GDNativeClass::_get(const StringName &p_name, Variant &r_ret) const { bool ok; @@ -183,7 +179,6 @@ Variant GDScript::_new(const Variant **p_args, int p_argcount, Variant::CallErro bool GDScript::can_instance() const { - //return valid; //any script in GDscript can instance return valid || (!tool && !ScriptServer::is_scripting_enabled()); } @@ -218,49 +213,6 @@ void GDScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) { placeholders.erase(p_placeholder); } - -/* -void GDScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { - - - List<PropertyInfo> plist; - GDScript *scr=this; - - Map<StringName,Variant> default_values; - while(scr) { - - Vector<_GDScriptMemberSort> msort; - for(Map<StringName,PropertyInfo>::Element *E=scr->member_info.front();E;E=E->next()) { - - _GDScriptMemberSort ms; - ERR_CONTINUE(!scr->member_indices.has(E->key())); - ms.index=scr->member_indices[E->key()].index; - ms.name=E->key(); - - msort.push_back(ms); - - } - - msort.sort(); - msort.invert(); - for(int i=0;i<msort.size();i++) { - - plist.push_front(scr->member_info[msort[i].name]); - if (scr->member_default_values.has(msort[i].name)) - default_values[msort[i].name]=scr->member_default_values[msort[i].name]; - else { - Variant::CallError err; - default_values[msort[i].name]=Variant::construct(scr->member_info[msort[i].name].type,NULL,0,err); - } - } - - scr=scr->_base; - } - - - p_placeholder->update(plist,default_values); - -}*/ #endif void GDScript::get_script_method_list(List<MethodInfo> *p_list) const { @@ -428,7 +380,6 @@ void GDScript::set_source_code(const String &p_code) { source = p_code; #ifdef TOOLS_ENABLED source_changed_cache = true; -//print_line("SC CHANGED "+get_path()); #endif } @@ -655,12 +606,6 @@ Error GDScript::reload(bool p_keep_state) { _set_subclass_path(E->get(), path); } -#ifdef TOOLS_ENABLED -/*for (Set<PlaceHolderScriptInstance*>::Element *E=placeholders.front();E;E=E->next()) { - - _update_placeholder(E->get()); - }*/ -#endif return OK; } @@ -1141,53 +1086,10 @@ void GDInstance::get_property_list(List<PropertyInfo> *p_properties) const { props.push_front(sptr->member_info[msort[i].name]); } -#if 0 - if (sptr->member_functions.has("_get_property_list")) { - - Variant::CallError err; - GDFunction *f = const_cast<GDFunction*>(sptr->member_functions["_get_property_list"]); - Variant plv = f->call(const_cast<GDInstance*>(this),NULL,0,err); - - if (plv.get_type()!=Variant::ARRAY) { - - ERR_PRINT("_get_property_list: expected array returned"); - } else { - - Array pl=plv; - - for(int i=0;i<pl.size();i++) { - - Dictionary p = pl[i]; - PropertyInfo pinfo; - if (!p.has("name")) { - ERR_PRINT("_get_property_list: expected 'name' key of type string.") - continue; - } - if (!p.has("type")) { - ERR_PRINT("_get_property_list: expected 'type' key of type integer.") - continue; - } - pinfo.name=p["name"]; - pinfo.type=Variant::Type(int(p["type"])); - if (p.has("hint")) - pinfo.hint=PropertyHint(int(p["hint"])); - if (p.has("hint_string")) - pinfo.hint_string=p["hint_string"]; - if (p.has("usage")) - pinfo.usage=p["usage"]; - - - props.push_back(pinfo); - } - } - } -#endif sptr = sptr->_base; } - //props.invert(); - for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) { p_properties->push_back(E->get()); @@ -1390,10 +1292,6 @@ GDInstance::~GDInstance() { } /************* SCRIPT LANGUAGE **************/ -/************* SCRIPT LANGUAGE **************/ -/************* SCRIPT LANGUAGE **************/ -/************* SCRIPT LANGUAGE **************/ -/************* SCRIPT LANGUAGE **************/ GDScriptLanguage *GDScriptLanguage::singleton = NULL; diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 6ab7361c92..5f85158232 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "gd_tokenizer.h" + #include "gd_functions.h" #include "io/marshalls.h" #include "map.h" @@ -504,7 +505,6 @@ void GDTokenizerText::_advance() { _make_newline(i); return; } -#if 1 //py style tokenizer case '#': { // line comment skip while (GETCHAR(0) != '\n') { @@ -526,57 +526,9 @@ void GDTokenizerText::_advance() { return; } break; -#endif case '/': { switch (GETCHAR(1)) { -#if 0 // c style tokenizer - case '*': { // block comment - int pos = code_pos+2; - int new_line=line; - int new_col=column+2; - - while(true) { - if (_code[pos]=='0') { - _make_error("Unterminated Comment"); - code_pos=pos; - return; - } - if (_code[pos]=='*' && _code[pos+1]=='/') { - new_col+=2; - pos+=2; //compensate - break; - } else if (_code[pos]=='\n') { - new_line++; - new_col=1; - } else { - new_col++; - } - pos++; - } - - column=new_col; - line=new_line; - code_pos=pos; - continue; - - } break; - case '/': { // line comment skip - - while(GETCHAR(0)!='\n') { - code_pos++; - if (GETCHAR(0)==0) { //end of file - _make_error("Unterminated Comment"); - return; - } - } - INCPOS(1); - column=1; - line++; - continue; - - } break; -#endif case '=': { // diveq _make_token(TK_OP_ASSIGN_DIV); diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index 2354c4063e..036274c8f2 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -37,103 +37,7 @@ GDScriptLanguage *script_language_gd = NULL; ResourceFormatLoaderGDScript *resource_loader_gd = NULL; ResourceFormatSaverGDScript *resource_saver_gd = NULL; -#if 0 -#ifdef TOOLS_ENABLED -#include "editor/editor_import_export.h" -#include "editor/editor_node.h" -#include "editor/editor_settings.h" -#include "gd_tokenizer.h" - -class EditorExportGDScript : public EditorExportPlugin { - - GDCLASS(EditorExportGDScript,EditorExportPlugin); - -public: - - virtual Vector<uint8_t> custom_export(String& p_path,const Ref<EditorExportPlatform> &p_platform) { - //compile gdscript to bytecode - - if (EditorImportExport::get_singleton()->script_get_action()!=EditorImportExport::SCRIPT_ACTION_NONE) { - - if (p_path.ends_with(".gd")) { - Vector<uint8_t> file = FileAccess::get_file_as_array(p_path); - if (file.empty()) - return file; - String txt; - txt.parse_utf8((const char*)file.ptr(),file.size()); - file = GDTokenizerBuffer::parse_code_string(txt); - - if (!file.empty()) { - - if (EditorImportExport::get_singleton()->script_get_action()==EditorImportExport::SCRIPT_ACTION_ENCRYPT) { - - String tmp_path=EditorSettings::get_singleton()->get_settings_path().plus_file("tmp/script.gde"); - FileAccess *fa = FileAccess::open(tmp_path,FileAccess::WRITE); - String skey=EditorImportExport::get_singleton()->script_get_encryption_key().to_lower(); - Vector<uint8_t> key; - key.resize(32); - for(int i=0;i<32;i++) { - int v=0; - if (i*2<skey.length()) { - CharType ct = skey[i*2]; - if (ct>='0' && ct<='9') - ct=ct-'0'; - else if (ct>='a' && ct<='f') - ct=10+ct-'a'; - v|=ct<<4; - } - - if (i*2+1<skey.length()) { - CharType ct = skey[i*2+1]; - if (ct>='0' && ct<='9') - ct=ct-'0'; - else if (ct>='a' && ct<='f') - ct=10+ct-'a'; - v|=ct; - } - key[i]=v; - } - FileAccessEncrypted *fae=memnew(FileAccessEncrypted); - Error err = fae->open_and_parse(fa,key,FileAccessEncrypted::MODE_WRITE_AES256); - if (err==OK) { - - fae->store_buffer(file.ptr(),file.size()); - p_path=p_path.get_basename()+".gde"; - } - - memdelete(fae); - - file=FileAccess::get_file_as_array(tmp_path); - return file; - - - } else { - - p_path=p_path.get_basename()+".gdc"; - return file; - } - } - - } - } - - return Vector<uint8_t>(); - } - - - EditorExportGDScript(){} - -}; - -static void register_editor_plugin() { - - Ref<EditorExportGDScript> egd = memnew( EditorExportGDScript ); - EditorImportExport::get_singleton()->add_export_plugin(egd); -} - -#endif -#endif void register_gdscript_types() { ClassDB::register_class<GDScript>(); @@ -146,13 +50,8 @@ void register_gdscript_types() { ResourceLoader::add_resource_format_loader(resource_loader_gd); resource_saver_gd = memnew(ResourceFormatSaverGDScript); ResourceSaver::add_resource_format_saver(resource_saver_gd); -#if 0 -#ifdef TOOLS_ENABLED - - EditorNode::add_init_callback(register_editor_plugin); -#endif -#endif } + void unregister_gdscript_types() { ScriptServer::unregister_language(script_language_gd); diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index c720ee394e..9e1d250680 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -38,8 +38,6 @@ //heh heh, godotsphir!! this shares no code and the design is completely different with previous projects i've done.. //should scale better with hardware that supports instancing -class BakedLightInstance; - class GridMap : public Spatial { GDCLASS(GridMap, Spatial); @@ -232,4 +230,4 @@ public: ~GridMap(); }; -#endif // CUBE_GRID_MAP_H +#endif // GRID_MAP_H diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp index ce69101302..d40bf73883 100644 --- a/modules/openssl/stream_peer_openssl.cpp +++ b/modules/openssl/stream_peer_openssl.cpp @@ -28,15 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "stream_peer_openssl.h" -//hostname matching code from curl -//#include <openssl/applink.c> // To prevent crashing (see the OpenSSL FAQ) +//hostname matching code from curl bool StreamPeerOpenSSL::_match_host_name(const char *name, const char *hostname) { return Tool_Curl_cert_hostcheck(name, hostname) == CURL_HOST_MATCH; - //print_line("MATCH: "+String(name)+" vs "+String(hostname)); - //return true; } Error StreamPeerOpenSSL::_match_common_name(const char *hostname, const X509 *server_cert) { @@ -298,20 +295,6 @@ Error StreamPeerOpenSSL::connect_to_stream(Ref<StreamPeer> p_base, bool p_valida X509_STORE_add_cert(store, certs[i]); } -#if 0 - const unsigned char *in=(const unsigned char *)certs.ptr(); - X509 *Cert = d2i_X509(NULL, &in, certs.size()-1); - if (!Cert) { - print_line(String(ERR_error_string(ERR_get_error(),NULL))); - } - ERR_FAIL_COND_V(!Cert,ERR_PARSE_ERROR); - - X509_STORE *store = SSL_CTX_get_cert_store(ctx); - X509_STORE_add_cert(store,Cert); - - //char *str = X509_NAME_oneline(X509_get_subject_name(Cert),0,0); - //printf ("subject: %s\n", str); /* [1] */ -#endif } //used for testing diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index 1be3f73d09..2a24f8d4d1 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -83,37 +83,6 @@ void VideoStreamPlaybackTheora::video_write(void) { th_ycbcr_buffer yuv; th_decode_ycbcr_out(td, yuv); - // FIXME: The way stuff is commented out with `//*/` closing comments - // sounds very fishy... - - /* - int y_offset, uv_offset; - y_offset=(ti.pic_x&~1)+yuv[0].stride*(ti.pic_y&~1); - - { - int pixels = size.x * size.y; - frame_data.resize(pixels * 4); - PoolVector<uint8_t>::Write w = frame_data.write(); - char* dst = (char*)w.ptr(); - int p = 0; - for (int i=0; i<size.y; i++) { - - char *in_y = (char *)yuv[0].data+y_offset+yuv[0].stride*i; - char *out = dst + (int)size.x * 4 * i; - for (int j=0;j<size.x;j++) { - - dst[p++] = in_y[j]; - dst[p++] = in_y[j]; - dst[p++] = in_y[j]; - dst[p++] = 255; - }; - } - format = Image::FORMAT_RGBA8; - } - //*/ - - //* - int pitch = 4; frame_data.resize(size.x * size.y * pitch); { @@ -142,99 +111,6 @@ void VideoStreamPlaybackTheora::video_write(void) { texture->set_data(img); //zero copy send to visual server - /* - - if (px_fmt == TH_PF_444) { - - int pitch = 3; - frame_data.resize(size.x * size.y * pitch); - PoolVector<uint8_t>::Write w = frame_data.write(); - char* dst = (char*)w.ptr(); - - for(int i=0;i<size.y;i++) { - - char *in_y = (char *)yuv[0].data+y_offset+yuv[0].stride*i; - char *out = dst + (int)size.x * pitch * i; - char *in_u = (char *)yuv[1].data+uv_offset+yuv[1].stride*i; - char *in_v = (char *)yuv[2].data+uv_offset+yuv[2].stride*i; - for (int j=0;j<size.x;j++) { - - out[j*3+0] = in_y[j]; - out[j*3+1] = in_u[j]; - out[j*3+2] = in_v[j]; - }; - } - - format = Image::FORMAT_YUV_444; - - } else { - - int div; - if (px_fmt!=TH_PF_422) { - div = 2; - } - - bool rgba = true; - if (rgba) { - - int pitch = 4; - frame_data.resize(size.x * size.y * pitch); - PoolVector<uint8_t>::Write w = frame_data.write(); - char* dst = (char*)w.ptr(); - - uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div); - for(int i=0;i<size.y;i++) { - char *in_y = (char *)yuv[0].data+y_offset+yuv[0].stride*i; - char *in_u = (char *)yuv[1].data+uv_offset+yuv[1].stride*(i/div); - char *in_v = (char *)yuv[2].data+uv_offset+yuv[2].stride*(i/div); - uint8_t *out = (uint8_t*)dst + (int)size.x * pitch * i; - int ofs = 0; - for (int j=0;j<size.x;j++) { - - uint8_t y, u, v; - y = in_y[j]; - u = in_u[j/2]; - v = in_v[j/2]; - - int32_t r = Math::fast_ftoi(1.164 * (y - 16) + 1.596 * (v - 128)); - int32_t g = Math::fast_ftoi(1.164 * (y - 16) - 0.813 * (v - 128) - 0.391 * (u - 128)); - int32_t b = Math::fast_ftoi(1.164 * (y - 16) + 2.018 * (u - 128)); - - out[ofs++] = CLAMP(r, 0, 255); - out[ofs++] = CLAMP(g, 0, 255); - out[ofs++] = CLAMP(b, 0, 255); - out[ofs++] = 255; - } - } - - format = Image::FORMAT_RGBA8; - - } else { - - int pitch = 2; - frame_data.resize(size.x * size.y * pitch); - PoolVector<uint8_t>::Write w = frame_data.write(); - char* dst = (char*)w.ptr(); - - uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div); - for(int i=0;i<size.y;i++) { - char *in_y = (char *)yuv[0].data+y_offset+yuv[0].stride*i; - char *out = dst + (int)size.x * pitch * i; - for (int j=0;j<size.x;j++) - out[j*2] = in_y[j]; - char *in_u = (char *)yuv[1].data+uv_offset+yuv[1].stride*(i/div); - char *in_v = (char *)yuv[2].data+uv_offset+yuv[2].stride*(i/div); - for (int j=0;j<(int)size.x>>1;j++) { - out[j*4+1] = in_u[j]; - out[j*4+3] = in_v[j]; - } - } - - format = Image::FORMAT_YUV_422; - }; - }; - //*/ - frames_pending = 1; } @@ -455,15 +331,6 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { th_decode_ctl(td, TH_DECCTL_SET_PPLEVEL, &pp_level, sizeof(pp_level)); pp_inc = 0; - /*{ - int arg = 0xffff; - th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_MBMODE,&arg,sizeof(arg)); - th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_MV,&arg,sizeof(arg)); - th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_QI,&arg,sizeof(arg)); - arg=10; - th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_BITS,&arg,sizeof(arg)); - }*/ - int w; int h; w = (ti.pic_x + ti.frame_width + 1 & ~1) - (ti.pic_x & ~1); @@ -502,8 +369,6 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { float VideoStreamPlaybackTheora::get_time() const { - //print_line("total: "+itos(get_total())+" todo: "+itos(get_todo())); - //return MAX(0,time-((get_total())/(float)vi.rate)); return time - AudioServer::get_singleton()->get_output_delay() - delay_compensation; //-((get_total())/(float)vi.rate); }; @@ -526,8 +391,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) { thread_sem->post(); #endif - //double ctime =AudioServer::get_singleton()->get_mix_time(); - //print_line("play "+rtos(p_delta)); time += p_delta; @@ -663,8 +526,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) { } } -//print_line("no theora: "+itos(no_theora)+" theora eos: "+itos(theora_eos)+" frame done "+itos(frame_done)); - #ifdef THEORA_USE_THREAD_STREAMING if (file && thread_eof && no_theora && theora_eos && ring_buffer.data_left() == 0) { #else @@ -674,16 +535,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) { stop(); return; }; -#if 0 - if (!videobuf_ready || audio_todo > 0){ - /* no data yet for somebody. Grab another page */ - - buffer_data(); - while(ogg_sync_pageout(&oy,&og)>0){ - queue_page(&og); - } - } -#else if (!frame_done || !audio_done) { //what's the point of waiting for audio to grab a page? @@ -693,7 +544,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) { queue_page(&og); } } -#endif + /* If playback has begun, top audio buffer off immediately. */ //if(stateflag) audio_write_nonblocking(); |