Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members
MP7Parser.cpp
00001 /*********************************************************************** 00002 * * 00003 * ViTooKi * 00004 * * 00005 * title: MP7Parser.cpp * 00006 * * 00007 * * 00008 * * 00009 * ITEC institute of the University of Klagenfurt (Austria) * 00010 * http://www.itec.uni-klu.ac.at * 00011 * * 00012 * * 00013 * For more information visit the ViTooKi homepage: * 00014 * http://ViTooKi.sourceforge.net * 00015 * vitooki-user@lists.sourceforge.net * 00016 * vitooki-devel@lists.sourceforge.net * 00017 * * 00018 * This file is part of ViTooKi, a free video toolkit. * 00019 * ViTooKi is free software; you can redistribute it and/or * 00020 * modify it under the terms of the GNU General Public License * 00021 * as published by the Free Software Foundation; either version 2 * 00022 * of the License, or (at your option) any later version. * 00023 * * 00024 * This program is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU General Public License * 00030 * along with this program; if not, write to the Free Software * 00031 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 00032 * MA 02111-1307, USA. * 00033 * * 00034 ***********************************************************************/ 00035 00036 /*********************************************************************** 00037 * * 00038 * REVISION HISTORY: * 00039 * * 00040 * * 00041 * * 00042 ***********************************************************************/ 00043 00044 #include "MP7Parser.hpp" 00045 #include <string> 00046 #include "MP7Time.hpp" 00047 00048 int depth; 00049 00050 // class for MP7GetVarDescrType data exchange 00051 class MP7_VarDescrType_Userdata { 00052 public: 00053 int error; 00054 int varset_counter; 00055 bool inside_vardescrtype; 00056 bool vardescr; 00057 bool source; 00058 bool variation; 00059 // constructor 00060 MP7_VarDescrType_Userdata(); 00061 }; 00062 00063 // class for GetVarSet data exchange 00064 class MP7_VarSet_Userdata: public MP7_VarDescrType_Userdata { 00065 public: 00066 int which_varset; 00067 int variation_counter; 00068 bool get_visualcoding_name; 00069 bool get_audiocoding_name; 00070 bool get_fileformat_name; 00071 bool get_mediauri; 00072 bool get_filesize; 00073 bool get_bitrate; 00074 bool get_title; 00075 bool get_titleimage; 00076 bool get_freetextannotation; 00077 bool get_keyword; 00078 bool get_name; 00079 bool get_lo_name; 00080 bool get_lo_region; 00081 bool get_lo_date; 00082 bool get_copyright; 00083 bool get_media_duration; 00084 bool get_media_timepoint; 00085 bool get_semantic_name; 00086 bool get_semantic_region; 00087 bool get_semantic_time; 00088 bool inside_semantic; 00089 bool inside_semantic_place; 00090 bool inside_semantic_time; 00091 bool inside_semantic_place_place; 00092 bool inside_varset; 00093 bool inside_source; 00094 bool inside_visualcoding; 00095 bool inside_audiocoding; 00096 bool inside_fileformat; 00097 bool inside_mediainformation; 00098 bool inside_creationinformation; 00099 bool inside_titlemedia; 00100 bool inside_textannotation; 00101 bool inside_creator; 00102 bool inside_coordinates; 00103 bool inside_mediatime; 00104 MP7Parser::MP7_Sourcedata source_data; 00105 MP7Parser::MP7_Metadata meta_data; 00106 MP7Parser::MP7_MediaTime media_time; 00107 // constructor 00108 MP7_VarSet_Userdata(); 00109 }; 00110 00111 // class for MP7GetVariation data exchange 00112 class MP7_Variation_Userdata: public MP7_VarSet_Userdata { 00113 public: 00114 int which_variation; 00115 bool inside_variation; 00116 bool get_varrelationship; 00117 MP7Parser::MP7_Variationdata var_data; 00118 // constructor 00119 MP7_Variation_Userdata(); 00120 }; 00121 00122 // open a given filename and return the handle 00123 FILE *MP7Parser::MP7Open(const char *filename) 00124 { 00125 FILE *fp = fopen(filename, "r"); 00126 if (!fp) { 00127 return NULL; 00128 } 00129 return fp; 00130 } 00131 00132 // close a handle 00133 bool MP7Parser::MP7Close(FILE *fp) 00134 { 00135 if (!fp) { 00136 return false; 00137 } 00138 fclose(fp); 00139 return true; 00140 } 00141 00142 double MP7Parser::MP7_MediaTime::tpAsDouble() 00143 { 00144 MP7Time mp7time; 00145 00146 mp7time.setTimePoint(mediatimepoint_alpha.c_str()); 00147 return mp7time.timeToSec(); 00148 } 00149 00150 double MP7Parser::MP7_MediaTime::durAsDouble() 00151 { 00152 MP7Time mp7duration; 00153 00154 mp7duration.setDuration(mediaduration_alpha.c_str()); 00155 return mp7duration.durationToSec(); 00156 } 00157 00158 // constructor for MP7_VarDescrData 00159 MP7Parser::MP7_VarDescrData::MP7_VarDescrData() 00160 { 00161 errorcode = ERR__OK; 00162 nr_varsets = 0; 00163 vsl_pointer = NULL; 00164 } 00165 00166 // destructor for MP7_VarDescrData 00167 MP7Parser::MP7_VarDescrData::~MP7_VarDescrData() 00168 { 00169 if (vsl_pointer != NULL) { 00170 delete vsl_pointer; 00171 vsl_pointer = NULL; 00172 } 00173 } 00174 00175 // assignment operator for MP7_VarDescrData 00176 MP7Parser::MP7_VarDescrData & MP7Parser::MP7_VarDescrData::operator= (const MP7_VarDescrData & other) 00177 { 00178 MP7_VarSetList *newvsl; 00179 00180 if (&other != this) { 00181 errorcode = other.errorcode; 00182 nr_varsets = other.nr_varsets; 00183 if (other.vsl_pointer != NULL) { 00184 newvsl = new MP7_VarSetList; 00185 newvsl->sdata = other.vsl_pointer->sdata; 00186 newvsl->vdata = other.vsl_pointer->vdata; 00187 newvsl->mdata = other.vsl_pointer->mdata; 00188 newvsl->mtime = other.vsl_pointer->mtime; 00189 newvsl->tmpdec = other.vsl_pointer->tmpdec; 00190 newvsl->nr_variations = other.vsl_pointer->nr_variations; 00191 newvsl->next = other.vsl_pointer->next; 00192 vsl_pointer = newvsl; 00193 } 00194 } 00195 return *this; 00196 } 00197 00198 // copy constructor for MP7_Sourcedata 00199 MP7Parser::MP7_VarDescrData::MP7_VarDescrData(const MP7_VarDescrData & other) 00200 { 00201 *this = other; 00202 } 00203 00204 // constructor for MP7_VarSetList 00205 MP7Parser::MP7_VarSetList::MP7_VarSetList() 00206 { 00207 nr_variations = 0; 00208 next = NULL; 00209 } 00210 00211 // constructor for MP7_VarList 00212 MP7Parser::MP7_VarList::MP7_VarList() 00213 { 00214 next = NULL; 00215 } 00216 00217 00218 // constructor for MP7_Sourcedata 00219 MP7Parser::MP7_Sourcedata::MP7_Sourcedata() 00220 { 00221 has_audio = false; 00222 video_height = 0; 00223 video_width = 0; 00224 video_rate = 0.0; 00225 filesize = 0; 00226 bitrate = 0; 00227 id = ""; 00228 video_codec = ""; 00229 audio_codec = ""; 00230 fileformat = ""; 00231 path = ""; 00232 } 00233 00234 00235 // constructor for MP7_Variationdata 00236 MP7Parser::MP7_Variationdata::MP7_Variationdata() 00237 { 00238 fidelity = 0.0; 00239 priority = 0; 00240 variation_id = ""; 00241 variation_relationship = ""; 00242 } 00243 00244 // constructor for MP7_MediaTime 00245 MP7Parser::MP7_MediaTime::MP7_MediaTime() 00246 { 00247 mediatimepoint_alpha = ""; 00248 mediaduration_alpha = ""; 00249 } 00250 00251 // constructor for MP7_Metadata 00252 MP7Parser::MP7_Metadata::MP7_Metadata() 00253 { 00254 title = ""; 00255 title_image = ""; 00256 free_text_annotations = ""; 00257 keywords = ""; 00258 creator_name = ""; 00259 location_name = ""; 00260 location_region = ""; 00261 date = ""; 00262 semantic_place = ""; 00263 semantic_region = ""; 00264 semantic_time = ""; 00265 00266 copyright = ""; 00267 } 00268 00269 MP7Parser::MP7_VideoSegmentData::MP7_VideoSegmentData() 00270 { 00271 title = ""; 00272 title_image = ""; 00273 free_text_annotations = ""; 00274 keywords = ""; 00275 semantic_place = ""; 00276 semantic_region = ""; 00277 semantic_time = ""; 00278 } 00279 00280 MP7Parser::MP7_TemporalDecomposition::MP7_TemporalDecomposition() 00281 { 00282 errorcode = 0; 00283 vseg_list = NULL; 00284 } 00285 00286 MP7Parser::MP7_VideoSegmentList::MP7_VideoSegmentList() 00287 { 00288 next = NULL; 00289 children = NULL; 00290 } 00291 00292 00293 MP7Parser::MP7_Variations::MP7_Variations() 00294 { 00295 errorcode = 0; 00296 var_list = NULL; 00297 } 00298 // constructor for MP7_Variation_Userdata 00299 MP7_Variation_Userdata::MP7_Variation_Userdata() 00300 { 00301 which_variation = 1; 00302 inside_variation = false; 00303 get_varrelationship = false; 00304 } 00305 00306 // constructor for MP7_VarDescrType_Userdata 00307 MP7_VarDescrType_Userdata::MP7_VarDescrType_Userdata() 00308 { 00309 error = ERR__OK; 00310 varset_counter = 0; 00311 inside_vardescrtype = false; 00312 vardescr = false; 00313 source = false; 00314 variation = false; 00315 } 00316 00317 // constructor for MP7_VarSet_Userdata 00318 MP7_VarSet_Userdata::MP7_VarSet_Userdata() 00319 { 00320 which_varset = 1; 00321 variation_counter = 0; 00322 get_visualcoding_name = false; 00323 get_audiocoding_name = false; 00324 get_fileformat_name = false; 00325 get_filesize = false; 00326 get_bitrate = false; 00327 get_mediauri = false; 00328 get_title = false; 00329 get_titleimage = false; 00330 get_freetextannotation = false; 00331 get_keyword = false; 00332 get_name = false; 00333 get_lo_name = false; 00334 get_lo_region = false; 00335 get_lo_date = false; 00336 get_copyright = false; 00337 get_media_duration = false; 00338 get_media_timepoint = false; 00339 get_semantic_name = false; 00340 get_semantic_region = false; 00341 get_semantic_time = false; 00342 inside_varset = false; 00343 inside_source = false; 00344 inside_fileformat = false; 00345 inside_visualcoding = false; 00346 inside_audiocoding = false; 00347 inside_mediainformation = false; 00348 inside_creationinformation = false; 00349 inside_titlemedia = false; 00350 inside_textannotation = false; 00351 inside_creator = false; 00352 inside_coordinates = false; 00353 inside_mediatime = false; 00354 inside_semantic = false; 00355 inside_semantic_place = false; 00356 inside_semantic_time = false; 00357 inside_semantic_place_place = false; 00358 } 00359 00360 class MP7_CheckVideoSegments_Userdata { 00361 public: 00362 int error; 00363 bool inside_varset; 00364 bool inside_source; 00365 bool inside_tempdecomp; 00366 bool inside_segment; 00367 int segment_counter; 00368 int varset_counter; 00369 int which_varset; 00370 // constructor 00371 MP7_CheckVideoSegments_Userdata(); 00372 }; 00373 00374 MP7_CheckVideoSegments_Userdata::MP7_CheckVideoSegments_Userdata() { 00375 error = 0; 00376 inside_varset = false; 00377 inside_source = false; 00378 inside_tempdecomp = false; 00379 inside_segment = false; 00380 segment_counter = 0; 00381 varset_counter = 0; 00382 which_varset = 1; 00383 } 00384 00385 class MP7_GetVideoSegment_Userdata { 00386 public: 00387 int error; 00388 bool inside_varset; 00389 bool inside_source; 00390 bool inside_tempdecomp; 00391 bool inside_segment; 00392 bool inside_creationinformation; 00393 bool inside_mediatime; 00394 bool inside_textannotation; 00395 bool inside_semantic; 00396 bool inside_titlemedia; 00397 bool inside_semantic_place; 00398 bool inside_semantic_place_place; 00399 bool inside_semantic_time; 00400 bool get_title; 00401 bool get_titleimage; 00402 bool get_media_timepoint; 00403 bool get_media_duration; 00404 bool get_freetextannotation; 00405 bool get_keyword; 00406 bool get_name; 00407 bool get_region; 00408 bool get_time; 00409 int segment_counter; 00410 int varset_counter; 00411 int which_varset; 00412 int which_segment; 00413 int segment_depth; 00414 MP7Parser::MP7_VideoSegmentData vseg_data; 00415 // constructor 00416 MP7_GetVideoSegment_Userdata(); 00417 }; 00418 00419 00420 MP7_GetVideoSegment_Userdata::MP7_GetVideoSegment_Userdata() 00421 { 00422 error = 0; 00423 inside_varset = false; 00424 inside_source = false; 00425 inside_tempdecomp = false; 00426 inside_segment = false; 00427 inside_creationinformation = false; 00428 inside_mediatime = false; 00429 inside_textannotation = false; 00430 inside_semantic = false; 00431 inside_titlemedia = false; 00432 inside_semantic_place = false; 00433 inside_semantic_place_place = false; 00434 inside_semantic_time = false; 00435 get_title = false; 00436 get_titleimage = false; 00437 get_media_timepoint = false; 00438 get_media_duration = false; 00439 get_freetextannotation = false; 00440 get_keyword = false; 00441 get_name = false; 00442 get_region = false; 00443 get_time = false; 00444 segment_counter = 0; 00445 varset_counter = 0; 00446 which_varset = 1; 00447 which_segment = 1; 00448 segment_depth = 0; 00449 } 00450 00451 static void XMLHandler_CheckVideoSegments_start(void *data, const char *el, const char **attr) 00452 { 00453 MP7_CheckVideoSegments_Userdata *usr_data_ptr = (MP7_CheckVideoSegments_Userdata *)data; 00454 00455 switch (depth) { 00456 // VariationSet 00457 case VARDESCR_STARTLEVEL+1: 00458 // if the right VariationSet has not been already found 00459 if (!(*usr_data_ptr).inside_varset) { 00460 // check if it's a VariationSet 00461 if (strcmp("VariationSet", el) == 0) { 00462 // increase the VariationSet counter and check if it's the VariationSet we are looking for 00463 (*usr_data_ptr).varset_counter++; 00464 if ((*usr_data_ptr).varset_counter == (*usr_data_ptr).which_varset) { 00465 (*usr_data_ptr).inside_varset = true; 00466 } 00467 } 00468 } 00469 break; 00470 // Source + Variations 00471 case VARDESCR_STARTLEVEL+2: 00472 // if we are in the right VariationSet .. 00473 if ((*usr_data_ptr).inside_varset) { 00474 // and in it's source definition, we set the boolean 00475 if (strcmp("Source", el) == 0) { 00476 (*usr_data_ptr).inside_source = true; 00477 } 00478 } 00479 break; 00480 // check where we are inside of Source/Video definition 00481 case VARDESCR_STARTLEVEL+4: 00482 // only if in the right VariationSet and in it's Source definition 00483 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source) { 00484 if (strcmp("TemporalDecomposition", el) == 0) { 00485 (*usr_data_ptr).inside_tempdecomp = true; 00486 } 00487 } 00488 break; 00489 default: 00490 // only if in the right VariationSet and in it's Source definition and inside TemporalDecomposition 00491 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_tempdecomp) { 00492 if (strcmp("VideoSegment", el) == 0) { 00493 (*usr_data_ptr).inside_segment = true; 00494 (*usr_data_ptr).segment_counter++; 00495 } 00496 } 00497 } 00498 00499 depth++; 00500 } 00501 00502 static void XMLHandler_CheckVideoSegments_end(void *data, const char *el) 00503 { 00504 MP7_CheckVideoSegments_Userdata *usr_data_ptr = (MP7_CheckVideoSegments_Userdata *)data; 00505 00506 if (depth == VARDESCR_STARTLEVEL+2) { 00507 if (strcmp("VariationSet", el) == 0) { 00508 (*usr_data_ptr).inside_varset = false; 00509 (*usr_data_ptr).inside_source = false; 00510 } 00511 } 00512 00513 depth--; 00514 } 00515 00516 static void XMLHandler_GetVideoSegment_data(void *userData, const XML_Char *s, int len) 00517 { 00518 MP7_GetVideoSegment_Userdata *usr_data_ptr = (MP7_GetVideoSegment_Userdata *)userData; 00519 00520 // CreationInformation - Title 00521 if ((*usr_data_ptr).get_title) { 00522 (*usr_data_ptr).vseg_data.title.append(s,len); 00523 (*usr_data_ptr).get_title = false; 00524 } 00525 00526 // CreationInformation - Title Image 00527 else if ((*usr_data_ptr).get_titleimage) { 00528 (*usr_data_ptr).vseg_data.title_image.append(s,len); 00529 (*usr_data_ptr).get_titleimage = false; 00530 } 00531 00532 // MediaTime - MediaTimePoint 00533 else if ((*usr_data_ptr).get_media_timepoint) { 00534 (*usr_data_ptr).vseg_data.mediatime.mediatimepoint_alpha.append(s,len); 00535 (*usr_data_ptr).get_media_timepoint = false; 00536 } 00537 00538 // MediaTime - MediaDuration 00539 else if ((*usr_data_ptr).get_media_duration) { 00540 (*usr_data_ptr).vseg_data.mediatime.mediaduration_alpha.append(s,len); 00541 (*usr_data_ptr).get_media_duration = false; 00542 } 00543 // TextAnnotation - FreeTextAnnotation 00544 else if ((*usr_data_ptr).get_freetextannotation) { 00545 if ((*usr_data_ptr).vseg_data.free_text_annotations.empty()) { 00546 (*usr_data_ptr).vseg_data.free_text_annotations.append(s,len); 00547 } 00548 else { 00549 (*usr_data_ptr).vseg_data.free_text_annotations.append(", "); 00550 (*usr_data_ptr).vseg_data.free_text_annotations.append(s,len); 00551 } 00552 (*usr_data_ptr).get_freetextannotation = false; 00553 } 00554 // TextAnnotation - Keyword(s) 00555 else if ((*usr_data_ptr).get_keyword) { 00556 if ((*usr_data_ptr).vseg_data.keywords.empty()) { 00557 (*usr_data_ptr).vseg_data.keywords.append(s,len); 00558 } 00559 else { 00560 (*usr_data_ptr).vseg_data.keywords.append(", "); 00561 (*usr_data_ptr).vseg_data.keywords.append(s,len); 00562 } 00563 (*usr_data_ptr).get_keyword = false; 00564 } 00565 // Semantic - SemanticPlace - Place - Name 00566 else if ((*usr_data_ptr).get_name) { 00567 (*usr_data_ptr).vseg_data.semantic_place.append(s,len); 00568 (*usr_data_ptr).get_name = false; 00569 } 00570 // Semantic - SemanticPlace - Place - Region 00571 else if ((*usr_data_ptr).get_region) { 00572 (*usr_data_ptr).vseg_data.semantic_region.append(s,len); 00573 (*usr_data_ptr).get_region = false; 00574 } 00575 // Semantic - SemanticTime - TimePoint 00576 else if ((*usr_data_ptr).get_time) { 00577 (*usr_data_ptr).vseg_data.semantic_time.append(s,len); 00578 (*usr_data_ptr).get_time = false; 00579 } 00580 } 00581 00582 00583 static void XMLHandler_GetVideoSegment_start(void *data, const char *el, const char **attr) 00584 { 00585 MP7_GetVideoSegment_Userdata *usr_data_ptr = (MP7_GetVideoSegment_Userdata *)data; 00586 00587 if (!(*usr_data_ptr).inside_segment) { 00588 switch (depth) { 00589 // VariationSet 00590 case VARDESCR_STARTLEVEL+1: 00591 // if the right VariationSet has not been already found 00592 if (!(*usr_data_ptr).inside_varset) { 00593 // check if it's a VariationSet 00594 if (strcmp("VariationSet", el) == 0) { 00595 // increase the VariationSet counter and check if it's the VariationSet we are looking for 00596 (*usr_data_ptr).varset_counter++; 00597 if ((*usr_data_ptr).varset_counter == (*usr_data_ptr).which_varset) { 00598 (*usr_data_ptr).inside_varset = true; 00599 } 00600 } 00601 } 00602 break; 00603 // Source + Variations 00604 case VARDESCR_STARTLEVEL+2: 00605 // if we are in the right VariationSet .. 00606 if ((*usr_data_ptr).inside_varset) { 00607 // and in it's source definition, we set the boolean 00608 if (strcmp("Source", el) == 0) { 00609 (*usr_data_ptr).inside_source = true; 00610 } 00611 } 00612 break; 00613 // check where we are inside of Source/Video definition 00614 case VARDESCR_STARTLEVEL+4: 00615 // only if in the right VariationSet and in it's Source definition 00616 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source) { 00617 if (strcmp("TemporalDecomposition", el) == 0) { 00618 (*usr_data_ptr).inside_tempdecomp = true; 00619 } 00620 } 00621 break; 00622 default: 00623 // only if in the right VariationSet and in it's Source definition and inside TemporalDecomposition 00624 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_tempdecomp) { 00625 if (strcmp("VideoSegment", el) == 0) { 00626 (*usr_data_ptr).segment_counter++; 00627 if ((*usr_data_ptr).segment_counter == (*usr_data_ptr).which_segment) { 00628 (*usr_data_ptr).inside_segment = true; 00629 (*usr_data_ptr).segment_depth = depth; 00630 } 00631 } 00632 } 00633 } 00634 } 00635 else { 00636 // CreationInformation, MediaTime, TextAnnotation, Semantic 00637 if (depth == (*usr_data_ptr).segment_depth+1) { 00638 if (strcmp("CreationInformation", el) == 0) { 00639 (*usr_data_ptr).inside_creationinformation = true; 00640 } else if (strcmp("MediaTime", el) == 0) { 00641 (*usr_data_ptr).inside_mediatime = true; 00642 } else if (strcmp("TextAnnotation", el) == 0) { 00643 (*usr_data_ptr).inside_textannotation = true; 00644 } else if (strcmp("Semantic", el) == 0) { 00645 (*usr_data_ptr).inside_semantic = true; 00646 } 00647 } 00648 // MediaTime - TimePoint, Duration 00649 else if ((*usr_data_ptr).inside_mediatime && (depth == (*usr_data_ptr).segment_depth+2)) { 00650 if (strcmp("MediaTimePoint", el) == 0) { 00651 (*usr_data_ptr).get_media_timepoint = true; 00652 } 00653 else if (strcmp("MediaDuration", el) == 0) { 00654 (*usr_data_ptr).get_media_duration = true; 00655 } 00656 } 00657 // TextAnnotation or Abstract - FreeTextAnnotation 00658 else if ((*usr_data_ptr).inside_textannotation && 00659 ((depth == (*usr_data_ptr).segment_depth+2) || (depth == (*usr_data_ptr).segment_depth+4))) { 00660 if (strcmp("FreeTextAnnotation", el) == 0) { 00661 (*usr_data_ptr).get_freetextannotation = true; 00662 } 00663 } 00664 // Semantic - SemanticPlace 00665 else if ((*usr_data_ptr).inside_semantic && (depth == (*usr_data_ptr).segment_depth+2)) { 00666 if ((strcmp("SemanticBase", el) == 0) && (strcmp("SemanticPlaceType", attr[1]) == 0)) { 00667 (*usr_data_ptr).inside_semantic_place = true; 00668 } 00669 if ((strcmp("SemanticBase", el) == 0) && (strcmp("SemanticTimeType", attr[1]) == 0)) { 00670 (*usr_data_ptr).inside_semantic_time = true; 00671 } 00672 } 00673 // Semantic - SemanticPlace - Place 00674 else if ((*usr_data_ptr).inside_semantic_place && (depth == (*usr_data_ptr).segment_depth+3)) { 00675 if (strcmp("Place", el) == 0) { 00676 (*usr_data_ptr).inside_semantic_place_place = true; 00677 } 00678 } 00679 // TextAnnotation or Abstract - Keyword 00680 else if ((*usr_data_ptr).inside_textannotation && 00681 ((depth == (*usr_data_ptr).segment_depth+3) || (depth == (*usr_data_ptr).segment_depth+5))){ 00682 if (strcmp("Keyword", el) == 0) { 00683 (*usr_data_ptr).get_keyword = true; 00684 } 00685 } 00686 // CreationInformation - Title, Titlemedia, Abstract 00687 else if ((*usr_data_ptr).inside_creationinformation && (depth == (*usr_data_ptr).segment_depth+3)) { 00688 if (strcmp("Title", el) == 0) { 00689 (*usr_data_ptr).get_title = true; 00690 } 00691 else if (strcmp("TitleMedia", el) == 0) { 00692 (*usr_data_ptr).inside_titlemedia = true; 00693 } 00694 // FreeTextAnnotations and/or Keywords can be after a TextAnnotation or in an Abstract 00695 // So we say inside_textannotation, though we are technically inside the Abstract 00696 else if (strcmp("Abstract", el) == 0) { 00697 (*usr_data_ptr).inside_textannotation = true; 00698 } 00699 } 00700 // Semantic - SemanticPlace - Place - Name, Region 00701 else if ((*usr_data_ptr).inside_semantic_place_place && (depth == (*usr_data_ptr).segment_depth+4)) { 00702 if (strcmp("Name", el) == 0) { 00703 (*usr_data_ptr).get_name = true; 00704 } 00705 else if (strcmp("Region", el) == 0) { 00706 (*usr_data_ptr).get_region = true; 00707 } 00708 } 00709 else if ((*usr_data_ptr).inside_semantic_time && (depth == (*usr_data_ptr).segment_depth+4)) { 00710 if (strcmp("TimePoint", el) == 0) { 00711 (*usr_data_ptr).get_time = true; 00712 } 00713 } 00714 // CreationInformation - TitleMedia 00715 else if ((*usr_data_ptr).inside_titlemedia && (depth == (*usr_data_ptr).segment_depth+5)) { 00716 if (strcmp("MediaTimePoint", el) == 0) { 00717 (*usr_data_ptr).get_titleimage = true; 00718 } 00719 } 00720 } 00721 00722 depth++; 00723 } 00724 00725 static void XMLHandler_GetVideoSegment_end(void *data, const char *el) 00726 { 00727 MP7_GetVideoSegment_Userdata *usr_data_ptr = (MP7_GetVideoSegment_Userdata *)data; 00728 00729 00730 if ((*usr_data_ptr).inside_segment) { 00731 if (strcmp("VideoSegment", el) == 0) { 00732 (*usr_data_ptr).inside_segment = false; 00733 } 00734 else if (strcmp("CreationInformation", el) == 0) { 00735 (*usr_data_ptr).inside_creationinformation = false; 00736 } 00737 else if (strcmp("MediaTime", el) == 0) { 00738 (*usr_data_ptr).inside_mediatime = false; 00739 } 00740 else if ((strcmp("TextAnnotation", el) == 0) || (strcmp("Abstract", el) == 0)) { 00741 (*usr_data_ptr).inside_textannotation = false; 00742 } 00743 else if (strcmp("Semantic", el) == 0) { 00744 (*usr_data_ptr).inside_semantic = false; 00745 } 00746 else if (strcmp("TitleMedia", el) == 0) { 00747 (*usr_data_ptr).inside_titlemedia = false; 00748 } 00749 else if (strcmp("SemanticBase", el) == 0) { 00750 (*usr_data_ptr).inside_semantic_place = false; 00751 (*usr_data_ptr).inside_semantic_time = false; 00752 } 00753 else if (strcmp("Place", el) == 0) { 00754 (*usr_data_ptr).inside_semantic_place_place = false; 00755 } 00756 } 00757 00758 00759 if (depth == VARDESCR_STARTLEVEL+2) { 00760 if (strcmp("VariationSet", el) == 0) { 00761 (*usr_data_ptr).inside_varset = false; 00762 (*usr_data_ptr).inside_source = false; 00763 } 00764 } 00765 else if (depth == VARDESCR_STARTLEVEL+5) { 00766 if (strcmp("TemporalDecomposition", el) == 0) { 00767 (*usr_data_ptr).inside_tempdecomp = false; 00768 } 00769 } 00770 00771 00772 depth--; 00773 } 00774 00775 // data handler for MP7GetVarSet 00776 static void XMLHandler_mp7getvarset_data(void *userData, const XML_Char *s, int len) 00777 { 00778 MP7_VarSet_Userdata *usr_data_ptr = (MP7_VarSet_Userdata *)userData; 00779 int rv; 00780 00781 // get source - visualcodec name 00782 if ((*usr_data_ptr).get_visualcoding_name) { 00783 (*usr_data_ptr).source_data.video_codec.append(s,len); 00784 (*usr_data_ptr).get_visualcoding_name = false; 00785 } 00786 00787 // get source - audiocodec name 00788 else if ((*usr_data_ptr).get_audiocoding_name) { 00789 (*usr_data_ptr).source_data.audio_codec.append(s,len); 00790 (*usr_data_ptr).get_audiocoding_name = false; 00791 } 00792 00793 // get source - fileformat name 00794 else if ((*usr_data_ptr).get_fileformat_name) { 00795 (*usr_data_ptr).source_data.fileformat.append(s,len); 00796 (*usr_data_ptr).get_fileformat_name = false; 00797 } 00798 00799 // get source - filesize 00800 else if ((*usr_data_ptr).get_filesize) { 00801 rv = sscanf(s, "%ld", &((*usr_data_ptr).source_data.filesize)); 00802 if (rv != 1) { 00803 (*usr_data_ptr).error = ERR__INVALID_DATA; 00804 } 00805 (*usr_data_ptr).get_filesize = false; 00806 } 00807 00808 // get source - bitrate 00809 else if ((*usr_data_ptr).get_bitrate) { 00810 rv = sscanf(s, "%ld", &((*usr_data_ptr).source_data.bitrate)); 00811 if (rv != 1) { 00812 (*usr_data_ptr).error = ERR__INVALID_DATA; 00813 } 00814 (*usr_data_ptr).get_bitrate = false; 00815 } 00816 00817 // get source - media uri 00818 else if ((*usr_data_ptr).get_mediauri) { 00819 (*usr_data_ptr).source_data.path.append(s,len); 00820 (*usr_data_ptr).get_mediauri = false; 00821 } 00822 00823 // get source - creation - title 00824 else if ((*usr_data_ptr).get_title) { 00825 (*usr_data_ptr).meta_data.title.append(s,len); 00826 (*usr_data_ptr).get_title = false; 00827 } 00828 00829 // get source - creation - title image 00830 else if ((*usr_data_ptr).get_titleimage) { 00831 (*usr_data_ptr).meta_data.title_image.append(s,len); 00832 (*usr_data_ptr).get_titleimage = false; 00833 } 00834 00835 // get source - creation - free text annotations 00836 else if ((*usr_data_ptr).get_freetextannotation) { 00837 if ((*usr_data_ptr).meta_data.free_text_annotations.empty()) { 00838 (*usr_data_ptr).meta_data.free_text_annotations.append(s,len); 00839 } 00840 else { 00841 (*usr_data_ptr).meta_data.free_text_annotations.append(" - "); 00842 (*usr_data_ptr).meta_data.free_text_annotations.append(s,len); 00843 } 00844 (*usr_data_ptr).get_freetextannotation = false; 00845 } 00846 00847 // get source - creation - keywords 00848 else if ((*usr_data_ptr).get_keyword) { 00849 if ((*usr_data_ptr).meta_data.keywords.empty()) { 00850 (*usr_data_ptr).meta_data.keywords.append(s,len); 00851 } 00852 else { 00853 (*usr_data_ptr).meta_data.keywords.append(", "); 00854 (*usr_data_ptr).meta_data.keywords.append(s,len); 00855 } 00856 (*usr_data_ptr).get_keyword = false; 00857 } 00858 00859 // get source - creation - creator name 00860 else if ((*usr_data_ptr).get_name) { 00861 if ((*usr_data_ptr).meta_data.creator_name.empty()) { 00862 (*usr_data_ptr).meta_data.creator_name.append(s,len); 00863 } 00864 else { 00865 (*usr_data_ptr).meta_data.creator_name.append(" "); 00866 (*usr_data_ptr).meta_data.creator_name.append(s,len); 00867 } 00868 (*usr_data_ptr).get_name = false; 00869 } 00870 00871 // get source - creation - location name 00872 else if ((*usr_data_ptr).get_lo_name) { 00873 (*usr_data_ptr).meta_data.location_name.append(s,len); 00874 (*usr_data_ptr).get_lo_name = false; 00875 } 00876 00877 // get source - creation - location region 00878 else if ((*usr_data_ptr).get_lo_region) { 00879 (*usr_data_ptr).meta_data.location_region.append(s,len); 00880 (*usr_data_ptr).get_lo_region = false; 00881 } 00882 00883 // get source - creation - location timepoint 00884 else if ((*usr_data_ptr).get_lo_date) { 00885 (*usr_data_ptr).meta_data.date.append(s,len); 00886 (*usr_data_ptr).get_lo_date = false; 00887 } 00888 00889 // get source - creation - copyright 00890 else if ((*usr_data_ptr).get_copyright) { 00891 (*usr_data_ptr).meta_data.copyright.append(s,len); 00892 (*usr_data_ptr).get_copyright = false; 00893 } 00894 00895 // get source - mediatime - mediatimepoint 00896 else if ((*usr_data_ptr).get_media_timepoint) { 00897 (*usr_data_ptr).media_time.mediatimepoint_alpha.append(s,len); 00898 (*usr_data_ptr).get_media_timepoint = false; 00899 } 00900 00901 // get source - mediatime - mediaduration 00902 else if ((*usr_data_ptr).get_media_duration) { 00903 (*usr_data_ptr).media_time.mediaduration_alpha.append(s,len); 00904 (*usr_data_ptr).get_media_duration = false; 00905 } 00906 else if ((*usr_data_ptr).get_semantic_name) { 00907 (*usr_data_ptr).meta_data.semantic_place.append(s,len); 00908 (*usr_data_ptr).get_semantic_name = false; 00909 } 00910 else if ((*usr_data_ptr).get_semantic_region) { 00911 (*usr_data_ptr).meta_data.semantic_region.append(s,len); 00912 (*usr_data_ptr).get_semantic_region = false; 00913 } 00914 else if ((*usr_data_ptr).get_semantic_time) { 00915 (*usr_data_ptr).meta_data.semantic_time.append(s,len); 00916 (*usr_data_ptr).get_semantic_time = false; 00917 } 00918 00919 } 00920 00921 // element handler for MP7GetVarSet - start of element 00922 static void XMLHandler_mp7getvarset_start(void *data, const char *el, const char **attr) 00923 { 00924 MP7_VarSet_Userdata *usr_data_ptr = (MP7_VarSet_Userdata *)data; 00925 int rv; 00926 00927 switch (depth) { 00928 // VariationSet 00929 case VARDESCR_STARTLEVEL+1: 00930 // if the right VariationSet has not been already found 00931 if (!(*usr_data_ptr).inside_varset) { 00932 // check if it's a VariationSet 00933 if (strcmp("VariationSet", el) == 0) { 00934 // increase the VariationSet counter and check if it's the VariationSet we are looking for 00935 (*usr_data_ptr).varset_counter++; 00936 if ((*usr_data_ptr).varset_counter == (*usr_data_ptr).which_varset) { 00937 (*usr_data_ptr).inside_varset = true; 00938 } 00939 } 00940 } 00941 break; 00942 // Source + Variations 00943 case VARDESCR_STARTLEVEL+2: 00944 // if we are in the right VariationSet .. 00945 if ((*usr_data_ptr).inside_varset) { 00946 // and in it's source definition, we set the boolean 00947 if (strcmp("Source", el) == 0) { 00948 (*usr_data_ptr).inside_source = true; 00949 } 00950 // count the Variations 00951 else if (strcmp("Variation", el) == 0) { 00952 (*usr_data_ptr).variation_counter++; 00953 } 00954 } 00955 break; 00956 // Source Definition 00957 case VARDESCR_STARTLEVEL+3: 00958 // only if in the right VariationSet and in it's Source definition 00959 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source) { 00960 // video id 00961 if (strcmp("Video", el) == 0) { 00962 (*usr_data_ptr).source_data.id = attr[1]; 00963 } 00964 } 00965 break; 00966 // check where we are inside of Source/Video definition 00967 case VARDESCR_STARTLEVEL+4: 00968 // only if in the right VariationSet and in it's Source definition 00969 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source) { 00970 if (strcmp("MediaInformation", el) == 0) { 00971 (*usr_data_ptr).inside_mediainformation = true; 00972 } 00973 else if (strcmp("CreationInformation", el) == 0) { 00974 (*usr_data_ptr).inside_creationinformation = true; 00975 } 00976 else if (strcmp("MediaTime", el) == 0) { 00977 (*usr_data_ptr).inside_mediatime = true; 00978 } 00979 else if (strcmp("TextAnnotation", el) == 0) { 00980 (*usr_data_ptr).inside_textannotation = true; 00981 } 00982 else if (strcmp("Semantic", el) == 0) { 00983 (*usr_data_ptr).inside_semantic = true; 00984 } 00985 } 00986 break; 00987 case VARDESCR_STARTLEVEL+5: 00988 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_mediatime) { 00989 if (strcmp("MediaTimePoint", el) == 0) { 00990 (*usr_data_ptr).get_media_timepoint = true; 00991 } 00992 else if (strcmp("MediaDuration", el) == 0) { 00993 (*usr_data_ptr).get_media_duration = true; 00994 } 00995 } 00996 else if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_textannotation) { 00997 if (strcmp("FreeTextAnnotation", el) == 0) { 00998 (*usr_data_ptr).get_freetextannotation = true; 00999 } 01000 } 01001 else if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_semantic) { 01002 if ((strcmp("SemanticBase", el) == 0) && (strcmp("SemanticPlaceType", attr[1]) == 0)) { 01003 (*usr_data_ptr).inside_semantic_place = true; 01004 } 01005 if ((strcmp("SemanticBase", el) == 0) && (strcmp("SemanticTimeType", attr[1]) == 0)) { 01006 (*usr_data_ptr).inside_semantic_time = true; 01007 } 01008 } 01009 01010 break; 01011 // CreationInformation - Title 01012 case VARDESCR_STARTLEVEL+6: 01013 // only if in the right VariationSet and in it's Source definition - CreationInformation 01014 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_creationinformation) { 01015 if (strcmp("Title", el) == 0) { 01016 (*usr_data_ptr).get_title = true; 01017 } 01018 else if (strcmp("CopyrightString", el) == 0) { 01019 (*usr_data_ptr).get_copyright = true; 01020 } 01021 else if (strcmp("TitleMedia", el) == 0) { 01022 (*usr_data_ptr).inside_titlemedia = true; 01023 } 01024 else if (strcmp("Abstract", el) == 0) { 01025 (*usr_data_ptr).inside_textannotation = true; 01026 } 01027 else if (strcmp("Creator", el) == 0) { 01028 (*usr_data_ptr).inside_creator = true; 01029 } 01030 else if (strcmp("CreationCoordinates", el) == 0) { 01031 (*usr_data_ptr).inside_coordinates = true; 01032 } 01033 } 01034 else if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_textannotation) { 01035 if (strcmp("Keyword", el) == 0) { 01036 (*usr_data_ptr).get_keyword = true; 01037 } 01038 } 01039 else if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_semantic_place) { 01040 if (strcmp("Place", el) == 0) { 01041 (*usr_data_ptr).inside_semantic_place_place = true; 01042 } 01043 } 01044 break; 01045 // Source - FileSize and BitRate 01046 case VARDESCR_STARTLEVEL+7: 01047 // only if in the right VariationSet and in it's Source definition - MediaInformation 01048 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_mediainformation) { 01049 if (strcmp("FileSize", el) == 0) { 01050 (*usr_data_ptr).get_filesize = true; 01051 } 01052 else if (strcmp("BitRate", el) == 0) { 01053 (*usr_data_ptr).get_bitrate = true; 01054 } 01055 else if (strcmp("FileFormat", el) == 0) { 01056 (*usr_data_ptr).inside_fileformat = true; 01057 } 01058 } 01059 else if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_creationinformation) { 01060 if ((*usr_data_ptr).inside_textannotation && (strcmp("FreeTextAnnotation", el) == 0)) { 01061 (*usr_data_ptr).get_freetextannotation = true; 01062 } 01063 } 01064 else if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_semantic_place_place) { 01065 if (strcmp("Name", el) == 0) { 01066 (*usr_data_ptr).get_semantic_name = true; 01067 } 01068 else if (strcmp("Region", el) == 0) { 01069 (*usr_data_ptr).get_semantic_region = true; 01070 } 01071 } 01072 else if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_semantic_time) { 01073 if (strcmp("TimePoint", el) == 0) { 01074 (*usr_data_ptr).get_semantic_time = true; 01075 } 01076 } 01077 break; 01078 // Source - Visual Coding and MediaUri 01079 case VARDESCR_STARTLEVEL+8: 01080 // only if in the right VariationSet and in it's Source definition 01081 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_mediainformation) { 01082 // check for VisualCoding 01083 if (strcmp("VisualCoding", el) == 0) { 01084 (*usr_data_ptr).inside_visualcoding = true; 01085 } 01086 else if (strcmp("AudioCoding", el) == 0) { 01087 (*usr_data_ptr).inside_audiocoding = true; 01088 (*usr_data_ptr).source_data.has_audio = true; 01089 } 01090 else if (strcmp("MediaUri", el) == 0) { 01091 (*usr_data_ptr).get_mediauri = true; 01092 } 01093 else if (((*usr_data_ptr).inside_fileformat) && ((strcmp("Name", el) == 0))) { 01094 (*usr_data_ptr).get_fileformat_name = true; 01095 } 01096 } 01097 // TitleImage - MediaTimePoint 01098 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_creationinformation) { 01099 if ((*usr_data_ptr).inside_titlemedia && (strcmp("MediaTimePoint", el) == 0)) { 01100 01101 } 01102 else if ((*usr_data_ptr).inside_textannotation && (strcmp("Keyword", el) == 0)) { 01103 (*usr_data_ptr).get_keyword = true; 01104 } 01105 else if ((*usr_data_ptr).inside_coordinates && (strcmp("Name", el) == 0)) { 01106 (*usr_data_ptr).get_lo_name = true; 01107 } 01108 else if ((*usr_data_ptr).inside_coordinates && (strcmp("Region", el) == 0)) { 01109 (*usr_data_ptr).get_lo_region = true; 01110 } 01111 else if ((*usr_data_ptr).inside_coordinates && (strcmp("TimePoint", el) == 0)) { 01112 (*usr_data_ptr).get_lo_date = true; 01113 } 01114 } 01115 break; 01116 // Source - VisualCoding (name, width, height, rate) and Audiocoding (name) 01117 case VARDESCR_STARTLEVEL+9: 01118 // only if in the right VariationSet and in it's Source definition 01119 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_mediainformation) { 01120 // VisualCoding 01121 if ((*usr_data_ptr).inside_visualcoding) { 01122 // frame data 01123 if (strcmp("Frame", el) == 0) { 01124 // height 01125 rv = sscanf(attr[1], "%i", &((*usr_data_ptr).source_data.video_height)); 01126 if (rv != 1) { 01127 (*usr_data_ptr).error = ERR__INVALID_DATA; 01128 } 01129 // width 01130 rv = sscanf(attr[3], "%i", &((*usr_data_ptr).source_data.video_width)); 01131 if (rv != 1) { 01132 (*usr_data_ptr).error = ERR__INVALID_DATA; 01133 } 01134 // rate 01135 rv = sscanf(attr[5], "%f", &((*usr_data_ptr).source_data.video_rate)); 01136 if (rv != 1) { 01137 (*usr_data_ptr).error = ERR__INVALID_DATA; 01138 } 01139 } 01140 } 01141 } 01142 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_creationinformation) { 01143 if ((*usr_data_ptr).inside_creator && ((strcmp("GivenName", el) == 0) || (strcmp("FamilyName", el) == 0))) { 01144 (*usr_data_ptr).get_name = true; 01145 } 01146 } 01147 break; 01148 case VARDESCR_STARTLEVEL+10: 01149 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_source && (*usr_data_ptr).inside_mediainformation) { 01150 // VisualCoding 01151 if ((*usr_data_ptr).inside_visualcoding) { 01152 // codec name 01153 if (strcmp("Name", el) == 0) { 01154 (*usr_data_ptr).get_visualcoding_name = true; 01155 } 01156 } 01157 // AudioCoding 01158 else if ((*usr_data_ptr).inside_audiocoding) { 01159 // codec name 01160 if (strcmp("Name", el) == 0) { 01161 (*usr_data_ptr).get_audiocoding_name = true; 01162 } 01163 } 01164 } 01165 break; 01166 } 01167 01168 depth++; 01169 } 01170 01171 // element handler for MP7GetVarSet - end of element 01172 static void XMLHandler_mp7getvarset_end(void *data, const char *el) 01173 { 01174 MP7_VarSet_Userdata *usr_data_ptr = (MP7_VarSet_Userdata *)data; 01175 01176 01177 switch (depth) { 01178 // VariationSet 01179 case VARDESCR_STARTLEVEL+2: 01180 // before leaving a VariationSet, reset the userdata 01181 if (strcmp("VariationSet", el) == 0) { 01182 (*usr_data_ptr).inside_varset = false; 01183 (*usr_data_ptr).inside_source = false; 01184 } 01185 break; 01186 case VARDESCR_STARTLEVEL+5: 01187 if (strcmp("CreationInformation", el) == 0) { 01188 (*usr_data_ptr).inside_creationinformation = false; 01189 } 01190 else if (strcmp("MediaInformation", el) == 0) { 01191 (*usr_data_ptr).inside_mediainformation = false; 01192 } 01193 else if (strcmp("MediaTime", el) == 0) { 01194 (*usr_data_ptr).inside_mediatime = false; 01195 } 01196 else if (strcmp("TextAnnotation", el) == 0) { 01197 (*usr_data_ptr).inside_textannotation = false; 01198 } 01199 else if (strcmp("Semantic", el) == 0) { 01200 (*usr_data_ptr).inside_semantic = false; 01201 } 01202 break; 01203 case VARDESCR_STARTLEVEL+6: 01204 if (strcmp("SemanticBase", el) == 0) { 01205 (*usr_data_ptr).inside_semantic_place = false; 01206 (*usr_data_ptr).inside_semantic_time = false; 01207 } 01208 break; 01209 case VARDESCR_STARTLEVEL+7: 01210 if (strcmp("TitleMedia", el) == 0) { 01211 (*usr_data_ptr).inside_titlemedia = false; 01212 } 01213 else if (strcmp("Abstract", el) == 0) { 01214 (*usr_data_ptr).inside_textannotation = false; 01215 } 01216 else if (strcmp("Creator", el) == 0) { 01217 (*usr_data_ptr).inside_creator = false; 01218 } 01219 else if (strcmp("CreationCoordinates", el) == 0) { 01220 (*usr_data_ptr).inside_coordinates = false; 01221 } 01222 else if (strcmp("Place", el) == 0) { 01223 (*usr_data_ptr).inside_semantic_place_place = false; 01224 } 01225 break; 01226 case VARDESCR_STARTLEVEL+9: 01227 // before leaving VisualCoding, reset the userdata 01228 if (strcmp("VisualCoding", el) == 0) { 01229 (*usr_data_ptr).inside_visualcoding = false; 01230 } 01231 // before leaving AudioCoding, reset the userdata 01232 else if (strcmp("AudioCoding", el) == 0) { 01233 (*usr_data_ptr).inside_audiocoding = false; 01234 } 01235 break; 01236 } 01237 01238 depth--; 01239 } 01240 01241 01242 // data handler for MP7GetVariation 01243 static void XMLHandler_mp7getvariation_data(void *userData, const XML_Char *s, int len) 01244 { 01245 MP7_Variation_Userdata *usr_data_ptr = (MP7_Variation_Userdata *)userData; 01246 int rv; 01247 01248 // get variation relationship 01249 if ((*usr_data_ptr).get_varrelationship) { 01250 (*usr_data_ptr).var_data.variation_relationship.append(s,len); 01251 (*usr_data_ptr).get_varrelationship = false; 01252 } 01253 // get visualcodec name 01254 else if ((*usr_data_ptr).get_visualcoding_name) { 01255 (*usr_data_ptr).var_data.video_codec.append(s,len); 01256 (*usr_data_ptr).get_visualcoding_name = false; 01257 } 01258 // get fileformat name 01259 else if ((*usr_data_ptr).get_fileformat_name) { 01260 (*usr_data_ptr).var_data.fileformat.append(s,len); 01261 (*usr_data_ptr).get_fileformat_name = false; 01262 } 01263 // get filesize 01264 else if ((*usr_data_ptr).get_filesize) { 01265 rv = sscanf(s, "%ld", &((*usr_data_ptr).var_data.filesize)); 01266 if (rv != 1) { 01267 (*usr_data_ptr).error = ERR__INVALID_DATA; 01268 } 01269 (*usr_data_ptr).get_filesize = false; 01270 } 01271 // get bitrate 01272 else if ((*usr_data_ptr).get_bitrate) { 01273 rv = sscanf(s, "%ld", &((*usr_data_ptr).var_data.bitrate)); 01274 if (rv != 1) { 01275 (*usr_data_ptr).error = ERR__INVALID_DATA; 01276 } 01277 (*usr_data_ptr).get_bitrate = false; 01278 } 01279 // get source - audiocodec name 01280 else if ((*usr_data_ptr).get_audiocoding_name) { 01281 (*usr_data_ptr).var_data.audio_codec.append(s,len); 01282 (*usr_data_ptr).get_audiocoding_name = false; 01283 } 01284 // get source - media uri 01285 else if ((*usr_data_ptr).get_mediauri) { 01286 (*usr_data_ptr).var_data.path.append(s,len); 01287 (*usr_data_ptr).get_mediauri = false; 01288 } 01289 01290 } 01291 01292 // element handler for MP7GetVariation - start of element 01293 static void XMLHandler_mp7getvariation_start(void *data, const char *el, const char **attr) 01294 { 01295 MP7_Variation_Userdata *usr_data_ptr = (MP7_Variation_Userdata *)data; 01296 int rv; 01297 01298 switch (depth) { 01299 // VariationSet 01300 case VARDESCR_STARTLEVEL+1: 01301 // if the right VariationSet has not been already found 01302 if (!(*usr_data_ptr).inside_varset) { 01303 // check if it's a VariationSet 01304 if (strcmp("VariationSet", el) == 0) { 01305 // increase the VariationSet counter and check if it's the VariationSet we are looking for 01306 (*usr_data_ptr).varset_counter++; 01307 if ((*usr_data_ptr).varset_counter == (*usr_data_ptr).which_varset) { 01308 (*usr_data_ptr).inside_varset = true; 01309 } 01310 } 01311 } 01312 break; 01313 // Variations 01314 case VARDESCR_STARTLEVEL+2: 01315 // if we are in the right VariationSet .. 01316 if ((*usr_data_ptr).inside_varset) { 01317 // we count to the right Variation 01318 if (strcmp("Variation", el) == 0) { 01319 (*usr_data_ptr).variation_counter++; 01320 // get id, fidelity and priority 01321 if ((*usr_data_ptr).variation_counter == (*usr_data_ptr).which_variation) { 01322 (*usr_data_ptr).inside_variation = true; 01323 // variation_id 01324 (*usr_data_ptr).var_data.variation_id = attr[1]; 01325 // fidelity 01326 rv = sscanf(attr[3], "%f", &((*usr_data_ptr).var_data.fidelity)); 01327 if (rv != 1) { 01328 (*usr_data_ptr).error = ERR__INVALID_DATA; 01329 } 01330 // priority 01331 rv = sscanf(attr[5], "%i", &((*usr_data_ptr).var_data.priority)); 01332 if (rv != 1) { 01333 (*usr_data_ptr).error = ERR__INVALID_DATA; 01334 } 01335 } 01336 } 01337 } 01338 break; 01339 // VariationRelationship 01340 case VARDESCR_STARTLEVEL+3: 01341 // if we are in the right VariationSet and the right Variation .. 01342 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_variation) { 01343 // VariationRelationship 01344 if (strcmp("VariationRelationship", el) == 0) { 01345 (*usr_data_ptr).get_varrelationship = true; 01346 } 01347 } 01348 break; 01349 // video id 01350 case VARDESCR_STARTLEVEL+4: 01351 // if we are in the right VariationSet and the right Variation .. 01352 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_variation) { 01353 // id 01354 if (strcmp("Video", el) == 0) { 01355 (*usr_data_ptr).var_data.id = attr[1]; 01356 } 01357 } 01358 break; 01359 // Filsize, Bitrate, Fileformat 01360 case VARDESCR_STARTLEVEL+8: 01361 // if we are in the right VariationSet and the right Variation .. 01362 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_variation) { 01363 if (strcmp("FileSize", el) == 0) { 01364 (*usr_data_ptr).get_filesize = true; 01365 } 01366 else if (strcmp("BitRate", el) == 0) { 01367 (*usr_data_ptr).get_bitrate = true; 01368 } 01369 else if (strcmp("FileFormat", el) == 0) { 01370 (*usr_data_ptr).inside_fileformat = true; 01371 } 01372 } 01373 break; 01374 // VisualCoding, AudioCoding 01375 case VARDESCR_STARTLEVEL+9: 01376 // if we are in the right VariationSet and the right Variation .. 01377 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_variation) { 01378 // VisualCoding 01379 if (strcmp("VisualCoding", el) == 0) { 01380 (*usr_data_ptr).inside_visualcoding = true; 01381 } 01382 // AudioCoding 01383 else if (strcmp("AudioCoding", el) == 0) { 01384 (*usr_data_ptr).inside_audiocoding = true; 01385 (*usr_data_ptr).var_data.has_audio = true; 01386 } 01387 else if (strcmp("MediaUri", el) == 0) { 01388 (*usr_data_ptr).get_mediauri = true; 01389 } 01390 else if (((*usr_data_ptr).inside_fileformat) && ((strcmp("Name", el) == 0))) { 01391 (*usr_data_ptr).get_fileformat_name = true; 01392 } 01393 } 01394 break; 01395 case VARDESCR_STARTLEVEL+10: 01396 // if we are in the right VariationSet and the right Variation .. 01397 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_variation) { 01398 // and inside VisualCoding 01399 if ((*usr_data_ptr).inside_visualcoding) { 01400 // frame data 01401 if (strcmp("Frame", el) == 0) { 01402 // height 01403 rv = sscanf(attr[1], "%i", &((*usr_data_ptr).var_data.video_height)); 01404 if (rv != 1) { 01405 (*usr_data_ptr).error = ERR__INVALID_DATA; 01406 } 01407 // width 01408 rv = sscanf(attr[3], "%i", &((*usr_data_ptr).var_data.video_width)); 01409 if (rv != 1) { 01410 (*usr_data_ptr).error = ERR__INVALID_DATA; 01411 } 01412 // rate 01413 rv = sscanf(attr[5], "%f", &((*usr_data_ptr).var_data.video_rate)); 01414 if (rv != 1) { 01415 (*usr_data_ptr).error = ERR__INVALID_DATA; 01416 } 01417 } 01418 } 01419 } 01420 break; 01421 case VARDESCR_STARTLEVEL+11: 01422 // if we are in the right VariationSet and the right Variation .. 01423 if ((*usr_data_ptr).inside_varset && (*usr_data_ptr).inside_variation) { 01424 // and inside VisualCoding 01425 if ((*usr_data_ptr).inside_visualcoding) { 01426 // codec name 01427 if (strcmp("Name", el) == 0) { 01428 (*usr_data_ptr).get_visualcoding_name = true; 01429 } 01430 } 01431 // AudioCoding 01432 else if ((*usr_data_ptr).inside_audiocoding) { 01433 // codec name 01434 if (strcmp("Name", el) == 0) { 01435 (*usr_data_ptr).get_audiocoding_name = true; 01436 } 01437 01438 } 01439 } 01440 } 01441 01442 depth++; 01443 } 01444 01445 // element handler for MP7GetVariation - end of element 01446 static void XMLHandler_mp7getvariation_end(void *data, const char *el) 01447 { 01448 MP7_Variation_Userdata *usr_data_ptr = (MP7_Variation_Userdata *)data; 01449 01450 // before leaving a VariationSet, reset the userdata 01451 if (strcmp("VariationSet", el) == 0) { 01452 (*usr_data_ptr).inside_varset = false; 01453 } 01454 // before leaving a Variation, reset the userdata 01455 else if (strcmp("Variation", el) == 0) { 01456 (*usr_data_ptr).inside_variation = false; 01457 } 01458 // before leaving VisualCoding, reset the userdata 01459 else if (strcmp("VisualCoding", el) == 0) { 01460 (*usr_data_ptr).inside_visualcoding = false; 01461 } 01462 // before leaving AudioCoding, reset the userdata 01463 else if (strcmp("AudioCoding", el) == 0) { 01464 (*usr_data_ptr).inside_audiocoding = false; 01465 } 01466 01467 depth--; 01468 } 01469 01470 // element handler for MP7GetVarDescrType - start of element 01471 static void XMLHandler_mp7getvardescrtype_start(void *data, const char *el, const char **attr) 01472 { 01473 MP7_VarDescrType_Userdata *usr_data_ptr = (MP7_VarDescrType_Userdata *)data; 01474 01475 switch (depth) { 01476 // check if in VariationDescriptionType 01477 case VARDESCR_STARTLEVEL: 01478 if (strcmp("Description", el) == 0) { 01479 if (strcmp("VariationDescriptionType", attr[1]) == 0) { 01480 (*usr_data_ptr).inside_vardescrtype = true; 01481 (*usr_data_ptr).vardescr = true; 01482 } 01483 } 01484 break; 01485 // check for VariationSets and count them 01486 case VARDESCR_STARTLEVEL+1: 01487 if ((*usr_data_ptr).inside_vardescrtype) { 01488 if (strcmp("VariationSet", el) == 0) { 01489 (*usr_data_ptr).varset_counter++; 01490 } 01491 else { 01492 (*usr_data_ptr).error = ERR__NO_VARIATIONSET_DEF; 01493 } 01494 } 01495 break; 01496 // check if Source and Variations are defined 01497 case VARDESCR_STARTLEVEL+2: 01498 if ((*usr_data_ptr).inside_vardescrtype) { 01499 if (strcmp("Source",el) == 0) { 01500 (*usr_data_ptr).source = true; 01501 } 01502 else if (strcmp("Variation", el) == 0) { 01503 (*usr_data_ptr).variation = true; 01504 } 01505 } 01506 } 01507 depth++; 01508 } 01509 01510 01511 // element handler for MP7GetVarDescrType - end of element 01512 static void XMLHandler_mp7getvardescrtype_end(void *data, const char *el) 01513 { 01514 MP7_VarDescrType_Userdata *usr_data_ptr = (MP7_VarDescrType_Userdata *)data; 01515 01516 // Before leaving a VariationSet, if there were at least one 01517 // Source and one Variation in it 01518 if (strcmp("VariationSet", el) == 0) { 01519 if ((!(*usr_data_ptr).source) || (!(*usr_data_ptr).variation)) { 01520 (*usr_data_ptr).error = ERR__SOURCE_OR_VAR_DEF; 01521 } 01522 (*usr_data_ptr).source = false; 01523 (*usr_data_ptr).variation = false; 01524 } 01525 // Before leaving a VariationDescriptionType, reset the userdata 01526 if ((strcmp("Description", el) == 0) && (depth == VARDESCR_STARTLEVEL)) { 01527 (*usr_data_ptr).inside_vardescrtype = false; 01528 } 01529 01530 depth--; 01531 } 01532 01533 01534 MP7Parser::MP7_TemporalDecomposition MP7GetTemporalDecomposition(FILE *fp, int which_variationset) 01535 { 01536 char buf[BUFFSIZE]; 01537 int numread, done; 01538 int lastdepth = -1; 01539 MP7Parser::MP7_VideoSegmentList *current_pointer = NULL; 01540 MP7Parser::MP7_VideoSegmentList *parent_pointer = NULL; 01541 MP7_CheckVideoSegments_Userdata checksegment_userdata; 01542 MP7Parser::MP7_TemporalDecomposition returnval; 01543 01544 // init 01545 rewind(fp); 01546 depth = 0; 01547 checksegment_userdata.which_varset = which_variationset; 01548 01549 // create parser 01550 XML_Parser p = XML_ParserCreate(NULL); 01551 if (!p) { 01552 returnval.errorcode = ERR__PARSER_CREATE_ERROR; 01553 return returnval; 01554 } 01555 01556 // set parser to get VarDescrData 01557 XML_SetElementHandler(p, XMLHandler_CheckVideoSegments_start, XMLHandler_CheckVideoSegments_end); 01558 XML_SetUserData(p, &checksegment_userdata); 01559 01560 while ((checksegment_userdata.error == ERR__OK) && !(done = feof(fp))) { 01561 numread = fread(buf, sizeof(char), BUFFSIZE, fp); 01562 if (ferror(fp)) { 01563 returnval.errorcode = ERR__READ_ERROR; 01564 XML_ParserFree(p); 01565 return returnval; 01566 } 01567 else { 01568 if (XML_Parse(p, buf, numread, done) == XML_STATUS_ERROR) { 01569 returnval.errorcode = ERR__PARSE_ERROR; 01570 XML_ParserFree(p); 01571 return returnval; 01572 } 01573 } 01574 } 01575 01576 if (checksegment_userdata.varset_counter < which_variationset) { 01577 returnval.errorcode = ERR__NO_SUCH_VARSET; 01578 XML_ParserFree(p); 01579 return returnval; 01580 } 01581 01582 if (checksegment_userdata.segment_counter == 0) { 01583 returnval.errorcode = ERR__NO_VERTDECOMP; 01584 XML_ParserFree(p); 01585 return returnval; 01586 } 01587 01588 for (int i=1; i<=checksegment_userdata.segment_counter; i++) { 01589 01590 // init 01591 XML_ParserFree(p); 01592 depth = 0; 01593 rewind(fp); 01594 MP7_GetVideoSegment_Userdata *getsegment_userdata = new MP7_GetVideoSegment_Userdata; 01595 getsegment_userdata->which_varset = which_variationset; 01596 getsegment_userdata->which_segment = i; 01597 01598 // create parser 01599 p = XML_ParserCreate(NULL); 01600 if (!p) { 01601 returnval.errorcode = ERR__PARSER_CREATE_ERROR; 01602 return returnval; 01603 } 01604 01605 // set parser to get VidSegData 01606 XML_SetElementHandler(p, XMLHandler_GetVideoSegment_start, XMLHandler_GetVideoSegment_end); 01607 XML_SetCharacterDataHandler(p, XMLHandler_GetVideoSegment_data); 01608 XML_SetUserData(p, getsegment_userdata); 01609 01610 01611 while ((getsegment_userdata->error == ERR__OK) && !(done = feof(fp))) { 01612 numread = fread(buf, sizeof(char), BUFFSIZE, fp); 01613 if (ferror(fp)) { 01614 returnval.errorcode = ERR__READ_ERROR; 01615 XML_ParserFree(p); 01616 return returnval; 01617 } else { 01618 if (XML_Parse(p, buf, numread, done) == XML_STATUS_ERROR) { 01619 returnval.errorcode = ERR__PARSE_ERROR; 01620 XML_ParserFree(p); 01621 return returnval; 01622 } 01623 } 01624 } 01625 01626 MP7Parser::MP7_VideoSegmentList *newvsgl = new MP7Parser::MP7_VideoSegmentList; 01627 01628 //first element 01629 if (returnval.vseg_list == NULL) { 01630 newvsgl->vseg_data = getsegment_userdata->vseg_data; 01631 returnval.vseg_list = newvsgl; 01632 current_pointer = newvsgl; 01633 } 01634 // new element, not first, same depth --> next 01635 else if (lastdepth == getsegment_userdata->segment_depth) { 01636 newvsgl->vseg_data = getsegment_userdata->vseg_data; 01637 current_pointer->next = newvsgl; 01638 current_pointer = newvsgl; 01639 } 01640 // new element, not first, depth is higher --> children 01641 else if (lastdepth < getsegment_userdata->segment_depth) { 01642 newvsgl->vseg_data = getsegment_userdata->vseg_data; 01643 parent_pointer = current_pointer; 01644 current_pointer->children = newvsgl; 01645 current_pointer = newvsgl; 01646 } 01647 // new element, not first, depth is lower --> parent 01648 else if (lastdepth > getsegment_userdata->segment_depth) { 01649 newvsgl->vseg_data = getsegment_userdata->vseg_data; 01650 current_pointer = parent_pointer; 01651 current_pointer->next = newvsgl; 01652 current_pointer = newvsgl; 01653 } 01654 lastdepth = getsegment_userdata->segment_depth; 01655 delete getsegment_userdata; 01656 } 01657 XML_ParserFree(p); 01658 return returnval; 01659 } 01660 01661 MP7Parser::MP7_Variations MP7GetVariations(FILE *fp, int which_variationset, int nr_variations) 01662 { 01663 char buf[BUFFSIZE]; 01664 int numread, done; 01665 MP7Parser::MP7_VarList *currentvl = NULL; 01666 MP7Parser::MP7_Variations returnval; 01667 XML_Parser p; 01668 01669 for (int i=1;i<=nr_variations;i++) { 01670 01671 // init 01672 depth = 0; 01673 rewind(fp); 01674 MP7_Variation_Userdata *udata = new MP7_Variation_Userdata; 01675 udata->which_varset = which_variationset; 01676 udata->which_variation = i; 01677 01678 // create parser 01679 p = XML_ParserCreate(NULL); 01680 if (!p) { 01681 returnval.errorcode = ERR__PARSER_CREATE_ERROR; 01682 return returnval; 01683 } 01684 01685 // set parser to get Variations 01686 XML_SetElementHandler(p, XMLHandler_mp7getvariation_start, XMLHandler_mp7getvariation_end); 01687 XML_SetCharacterDataHandler(p, XMLHandler_mp7getvariation_data); 01688 XML_SetUserData(p, udata); 01689 01690 01691 while ((udata->error == ERR__OK) && !(done = feof(fp))) { 01692 numread = fread(buf, sizeof(char), BUFFSIZE, fp); 01693 if (ferror(fp)) { 01694 returnval.errorcode = ERR__READ_ERROR; 01695 XML_ParserFree(p); 01696 return returnval; 01697 } 01698 else { 01699 if (XML_Parse(p, buf, numread, done) == XML_STATUS_ERROR) { 01700 returnval.errorcode = ERR__PARSE_ERROR; 01701 XML_ParserFree(p); 01702 return returnval; 01703 } 01704 } 01705 } 01706 01707 MP7Parser::MP7_VarList *newvl = new MP7Parser::MP7_VarList; 01708 if (currentvl == NULL) { 01709 returnval.var_list = newvl; 01710 currentvl = newvl; 01711 } 01712 else { 01713 currentvl->next = newvl; 01714 currentvl = newvl; 01715 } 01716 newvl->vdata = udata->var_data; 01717 returnval.errorcode = udata->error; 01718 delete udata; 01719 01720 XML_ParserFree(p); 01721 } 01722 01723 return returnval; 01724 } 01725 01726 // checks if xml file has a valid VariationDescriptionType and returns 01727 // all Variationsets (Sourcedata + Variations on that Source) found 01728 MP7Parser::MP7_VarDescrData MP7Parser::MP7GetVarDescrData(FILE *fp) 01729 { 01730 char buf[BUFFSIZE]; 01731 int numread, done; 01732 MP7_VarDescrData returnval; 01733 MP7_VarDescrType_Userdata vardescr_userdata; 01734 MP7_VarSet_Userdata varset_userdata; 01735 MP7_VarSetList *tempvsl, *newvsl; 01736 01737 // init 01738 depth = 0; 01739 rewind(fp); 01740 01741 // create parser 01742 XML_Parser p = XML_ParserCreate(NULL); 01743 if (!p) { 01744 returnval.errorcode = ERR__PARSER_CREATE_ERROR; 01745 return returnval; 01746 } 01747 01748 // set parser to get VarDescrData 01749 XML_SetElementHandler(p, XMLHandler_mp7getvardescrtype_start, XMLHandler_mp7getvardescrtype_end); 01750 XML_SetUserData(p, &vardescr_userdata); 01751 01752 while ((vardescr_userdata.error == ERR__OK) && !(done = feof(fp))) { 01753 numread = fread(buf, sizeof(char), BUFFSIZE, fp); 01754 if (ferror(fp)) { 01755 returnval.errorcode = ERR__READ_ERROR; 01756 XML_ParserFree(p); 01757 return returnval; 01758 } 01759 else { 01760 if (XML_Parse(p, buf, numread, done) == XML_STATUS_ERROR) { 01761 returnval.errorcode = ERR__PARSE_ERROR; 01762 XML_ParserFree(p); 01763 return returnval; 01764 } 01765 } 01766 } 01767 01768 if (!vardescr_userdata.vardescr) { 01769 returnval.errorcode = ERR__NO_VARDESCRTYPE; 01770 XML_ParserFree(p); 01771 return returnval; 01772 } 01773 01774 returnval.errorcode = vardescr_userdata.error; 01775 returnval.nr_varsets = vardescr_userdata.varset_counter; 01776 01777 // loop - get VarSetLists 01778 for (int i=1; i<=returnval.nr_varsets; i++) { 01779 01780 // reset data 01781 XML_ParserFree(p); 01782 rewind(fp); 01783 depth = 0; 01784 MP7_VarSet_Userdata *udata = new MP7_VarSet_Userdata; 01785 udata->which_varset = i; 01786 01787 // (re)create parser 01788 p = XML_ParserCreate(NULL); 01789 if (!p) { 01790 returnval.errorcode = ERR__PARSER_CREATE_ERROR; 01791 return returnval; 01792 } 01793 01794 // set parser to get VarSets 01795 XML_SetElementHandler(p, XMLHandler_mp7getvarset_start, XMLHandler_mp7getvarset_end); 01796 XML_SetCharacterDataHandler(p, XMLHandler_mp7getvarset_data); 01797 XML_SetUserData(p, udata); 01798 01799 newvsl = new MP7_VarSetList; 01800 if (returnval.vsl_pointer == NULL) { 01801 returnval.vsl_pointer = newvsl; 01802 } 01803 else { 01804 tempvsl = returnval.vsl_pointer; 01805 while (tempvsl->next != NULL) { 01806 tempvsl = tempvsl->next; 01807 } 01808 tempvsl->next = newvsl; 01809 } 01810 01811 while ((udata->error == ERR__OK) && !(done = feof(fp))) { 01812 numread = fread(buf, sizeof(char), BUFFSIZE, fp); 01813 if (ferror(fp)) { 01814 returnval.errorcode = ERR__READ_ERROR; 01815 XML_ParserFree(p); 01816 return returnval; 01817 } 01818 else { 01819 if (XML_Parse(p, buf, numread, done) == XML_STATUS_ERROR) { 01820 returnval.errorcode = ERR__PARSE_ERROR; 01821 XML_ParserFree(p); 01822 return returnval; 01823 } 01824 } 01825 } 01826 01827 // source data 01828 newvsl->sdata = udata->source_data; 01829 // variation data 01830 newvsl->vdata = MP7GetVariations(fp, i, udata->variation_counter); 01831 // creation information 01832 newvsl->mdata = udata->meta_data; 01833 // mediatime 01834 newvsl->mtime = udata->media_time; 01835 //get verticaldecomposition 01836 newvsl->tmpdec = MP7GetTemporalDecomposition(fp, i); 01837 01838 newvsl->nr_variations = udata->variation_counter; 01839 returnval.errorcode = udata->error; 01840 delete udata; 01841 } 01842 01843 XML_ParserFree(p); 01844 return returnval; 01845 01846 }