--- parser3/src/classes/image.C 2020/12/17 19:51:21 1.180 +++ parser3/src/classes/image.C 2024/09/11 21:07:36 1.185 @@ -1,8 +1,8 @@ /** @file Parser: @b image parser class. - Copyright (c) 2001-2020 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ /* @@ -26,7 +26,7 @@ #include "pa_table.h" #include "pa_charsets.h" -volatile const char * IDENT_IMAGE_C="$Id: image.C,v 1.180 2020/12/17 19:51:21 moko Exp $"; +volatile const char * IDENT_IMAGE_C="$Id: image.C,v 1.185 2024/09/11 21:07:36 moko Exp $"; // defines @@ -308,6 +308,7 @@ struct Measure_info { Value** exif; Value** xmp; Charset* xmp_charset; + bool video; }; @@ -420,11 +421,8 @@ static Value* parse_IFD_entry_formatted_ size_t length=components_count; // Data format is "YYYY:MM:DD HH:MM:SS"+0x00, total 20bytes if(length==JPEG_EXIF_DATE_CHARS && isdigit((unsigned char)cstr[0]) && cstr[length-1]==0) { - char cstr_writable[JPEG_EXIF_DATE_CHARS]; - strcpy(cstr_writable, cstr); - try { - tm tmIn=cstr_to_time_t(cstr_writable, 0); + tm tmIn=cstr_to_time_t(pa_strdup(cstr), 0); return new VDate(tmIn); } catch(...) { /*ignore bad date times*/ } @@ -440,7 +438,7 @@ static Value* parse_IFD_entry_formatted_ HashStringValue& hash=result->hash(); for(uint i=0; i1) if(HashStringValue* options=params.as_hash(1, "methods options")) { @@ -996,6 +997,10 @@ static void _measure(Request& r, MethodP info.xmp_charset=&pa_charsets.get(value->as_string()); valid_options++; } + if(key == "video") { + info.video=r.process(*value).as_bool(); + valid_options++; + } } if(valid_options!=options->count()) throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); @@ -1006,7 +1011,7 @@ static void _measure(Request& r, MethodP if(file_name=data.get_string()) { file_read_action_under_lock(r.full_disk_path(*file_name), "measure", file_measure_action, &info); } else { - VFile* vfile=data.as_vfile(String::L_AS_IS); + VFile* vfile=data.as_vfile(); file_name=&vfile->fields().get(name_name)->as_string(); Measure_buf_reader reader(vfile->value_ptr(), vfile->value_size(), *file_name); measure(*file_name, reader, info);