Changeset 1278
- Timestamp:
- 2005-04-20 23:32:07 (4 years ago)
- Files:
-
- libannodex/trunk/include/annodex/anx_general.h (modified) (1 diff)
- libannodex/trunk/include/annodex/anx_types.h (modified) (4 diffs)
- libannodex/trunk/src/importers/anx_import_cmml.c (modified) (5 diffs)
- libannodex/trunk/src/libannodex/Version_script.in (modified) (1 diff)
- libannodex/trunk/src/libannodex/anx_element.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libannodex/trunk/include/annodex/anx_general.h
r1250 r1278 292 292 AnxMetaElement * anx_meta_element_clone (AnxMetaElement * meta); 293 293 294 /** 295 * Clone an AnxLinkElement structure 296 * \param link the link tag structure to clone 297 * \returns a new link tag structure 298 */ 299 AnxLinkElement * anx_link_element_clone (AnxLinkElement * link); 300 294 301 #ifdef __cplusplus 295 302 } libannodex/trunk/include/annodex/anx_types.h
r1012 r1278 60 60 typedef struct _AnxClip AnxClip; 61 61 typedef struct _AnxMetaElement AnxMetaElement; 62 typedef struct _AnxLinkElement AnxLinkElement; 62 63 63 64 struct _AnxMetaElement { … … 69 70 const char *scheme; /**< scheme name of meta element */ 70 71 }; 72 73 struct _AnxLinkElement { 74 char *id; /**< id attribute of link */ 75 char *class; /**< class attribute of link */ 76 char *title; /**< title attribute of link */ 77 char *lang; /**< language code of link */ 78 char *dir; /**< directionality of lang (ltr/rtl) */ 79 char *href; /**< href attribute of link */ 80 char *type; /**< type attribute of link */ 81 char *rel; /**< rel attribute of link */ 82 char *rev; /**< rev attribute of link */ 83 char *media; /**< media attribute of link */ 84 }; 85 71 86 72 87 struct _AnxHead { … … 82 97 const char *base_href; /**< href attribute of base element */ 83 98 AnxList * meta; /**< list of meta elements */ 99 AnxList *link; /**< list of link elements */ 84 100 }; 85 101 86 102 struct _AnxClip { 87 103 const char *clip_id; /**< id attribute of clip */ 104 const char *class; /**< class attribute of clip */ 105 const char *title; /**< title attribute of clip */ 88 106 const char *lang; /**< language attribute of desc element */ 89 107 const char *dir; /**< directionality of lang */ 90 108 const char *track; /**< track attribute of clip */ 91 109 const char *anchor_id; /**< id attribute of anchor */ 110 const char *anchor_class; /**< class attribute of clip */ 111 const char *anchor_title; /**< title attribute of clip */ 92 112 const char *anchor_lang; /**< language of anchor */ 93 113 const char *anchor_dir; /**< directionality of lang */ 94 const char *anchor_class; /**< stylesheet of anchor */95 114 const char *anchor_href; /**< href out of clip */ 96 115 const char *anchor_text; /**< anchor text */ 97 116 const char *img_id; /**< id attribute of image */ 117 const char *img_class; /**< class attribute of image */ 118 const char *img_title; /**< title attribute of image */ 98 119 const char *img_lang; /**< language of img */ 99 120 const char *img_dir; /**< directionality of lang */ … … 101 122 const char *img_alt; /**< alternate text for image */ 102 123 const char *desc_id; /**< id attribute of desc element */ 124 const char *desc_class; /**< class attribute of desc */ 125 const char *desc_title; /**< title attribute of desc */ 103 126 const char *desc_lang; /**< language attribute of desc element */ 104 127 const char *desc_dir; /**< directionality of lang */ libannodex/trunk/src/importers/anx_import_cmml.c
r1093 r1278 91 91 } 92 92 93 static AnxLinkElement * 94 anx_link_from_cmml_link (const CMML_LinkElement * link) 95 { 96 AnxLinkElement * new_link; 97 98 if (link == NULL) return NULL; 99 100 new_link = (AnxLinkElement* ) anx_malloc (sizeof (AnxLinkElement)); 101 new_link->id = anxcmml_strdup (link->id); 102 new_link->class = anxcmml_strdup (link->class); 103 new_link->title = anxcmml_strdup (link->title); 104 new_link->lang = anxcmml_strdup (link->lang); 105 new_link->dir = anxcmml_strdup (link->dir); 106 new_link->href = anxcmml_strdup (link->href); 107 new_link->type = anxcmml_strdup (link->type); 108 new_link->rel = anxcmml_strdup (link->rel); 109 new_link->rev = anxcmml_strdup (link->rev); 110 new_link->media = anxcmml_strdup (link->media); 111 112 return new_link; 113 } 114 93 115 static AnxHead * 94 116 anx_head_from_cmml_head (const CMML_Head * head) … … 137 159 anx_list_clone_with ((AnxList*)head->meta, 138 160 (AnxCloneFunc)anx_meta_from_cmml_meta); 161 162 /* list of meta elements */ 163 h->link = 164 anx_list_clone_with ((AnxList*)head->link, 165 (AnxCloneFunc)anx_link_from_cmml_link); 139 166 140 167 return h; … … 161 188 162 189 presentation_time = ac->start_time; 163 basetime = stream-> timebase ? stream->timebase->t.sec : 0.0;190 basetime = stream->basetime ? stream->basetime->t.sec : 0.0; 164 191 utc = stream->utc ? stream->utc->tstr : NULL; 165 192 … … 232 259 /* copy clip data across */ 233 260 a->clip_id = anxcmml_strdup (clip->clip_id); 261 a->class = anxcmml_strdup (clip->class); 262 a->title = anxcmml_strdup (clip->title); 234 263 a->lang = anxcmml_strdup (clip->lang); 235 264 a->dir = anxcmml_strdup (clip->dir); 236 265 a->track = anxcmml_strdup (clip->track); 237 266 a->anchor_id = anxcmml_strdup (clip->anchor_id); 267 a->anchor_class = anxcmml_strdup (clip->anchor_class); 268 a->anchor_title = anxcmml_strup (clip->anchor_title); 238 269 a->anchor_lang = anxcmml_strdup (clip->anchor_lang); 239 270 a->anchor_dir = anxcmml_strdup (clip->anchor_dir); 240 a->anchor_class = anxcmml_strdup (clip->anchor_class);241 271 a->anchor_href = anxcmml_strdup (clip->anchor_href); 242 272 a->anchor_text = anxcmml_strdup (clip->anchor_text); 243 273 a->img_id = anxcmml_strdup (clip->img_id); 274 a->img_class = anxcmml_strdup (clip->img_class); 275 a->img_title = anxcmml_strdup (clip->img_title); 244 276 a->img_lang = anxcmml_strdup (clip->img_lang); 245 277 a->img_dir = anxcmml_strdup (clip->img_dir); … … 247 279 a->img_alt = anxcmml_strdup (clip->img_alt); 248 280 a->desc_id = anxcmml_strdup (clip->desc_id); 281 a->desc_class = anxcmml_strdup (clip->desc_class); 282 a->desc_title = anxcmml_strdup (clip->desc_title); 249 283 a->desc_lang = anxcmml_strdup (clip->desc_lang); 250 284 a->desc_dir = anxcmml_strdup (clip->desc_dir); libannodex/trunk/src/libannodex/Version_script.in
r1172 r1278 51 51 anx_meta_element_clone; 52 52 anx_meta_element_free; 53 54 anx_link_element_clone; 55 anx_link_element_free; 53 56 54 57 anx_set_read_stream_callback; libannodex/trunk/src/libannodex/anx_element.c
r1197 r1278 81 81 return NULL; 82 82 } 83 84 AnxLinkElement * 85 anx_link_element_clone (AnxLinkElement * link) 86 { 87 AnxLinkElement * new_link; 88 89 if (link == NULL) return NULL; 90 91 new_link = (AnxLinkElement* ) anx_malloc (sizeof(AnxLinkElement)); 92 /* maybe consider memcpy for speedup and introduce reference counting! 93 memcpy (new_link, link, sizeof (*new_link)); 94 */ 95 new_link->id = anx_strdup (link->id); 96 new_link->class = anx_strdup (link->class); 97 new_link->title = anx_strdup (link->title); 98 new_link->lang = anx_strdup (link->lang); 99 new_link->dir = anx_strdup (link->dir); 100 new_link->href = anx_strdup (link->href); 101 new_link->type = anx_strdup (link->type); 102 new_link->rel = anx_strdup (link->rel); 103 new_link->rev = anx_strdup (link->rev); 104 new_link->media = anx_strdup (link->media); 105 return new_link; 106 } 107 108 AnxLinkElement * 109 anx_link_element_free (AnxLinkElement * link) 110 { 111 if (link == NULL) return NULL; 112 anx_free (link->id); 113 anx_free (link->class); 114 anx_free (link->title); 115 anx_free (link->lang); 116 anx_free (link->dir); 117 anx_free (link->href); 118 anx_free (link->type); 119 anx_free (link->rel); 120 anx_free (link->rev); 121 anx_free (link->media); 122 return NULL; 123 } 124 83 125 84 126 AnxHead *