gmerlin
streaminfo.h
1 /*****************************************************************
2  * gmerlin - a general purpose multimedia framework and applications
3  *
4  * Copyright (c) 2001 - 2011 Members of the Gmerlin project
5  * gmerlin-general@lists.sourceforge.net
6  * http://gmerlin.sourceforge.net
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  * *****************************************************************/
21 
22 #ifndef __BG_STREAMINFO_H_
23 #define __BG_STREAMINFO_H_
24 
25 #include <gavl/gavl.h>
26 #include <gavl/metadata.h>
27 
28 #include <libxml/tree.h>
29 #include <libxml/parser.h>
30 
40 /************************************************
41  * Types for describing media streams
42  ************************************************/
43 
44 /* Languages are ISO 639-2 (3 character code) */
45 
52 typedef struct
53  {
55 
56  gavl_metadata_t m;
57 
58  int64_t duration;
59  int64_t pts_offset;
61 
67 typedef struct
68  {
70  gavl_metadata_t m;
71 
72  int64_t duration;
73  int64_t pts_offset;
75 
81 typedef struct
82  {
83  gavl_metadata_t m;
84  int is_text;
86  int64_t duration;
88 
110 char * bg_create_track_name(const gavl_metadata_t * m, const char * format);
111 
118 char * bg_metadata_to_string(const gavl_metadata_t * m, int use_tabs);
119 
128 int bg_metadata_get_year(const gavl_metadata_t * m);
129 
130 
131 /* XML Interface */
132 
141 void bg_xml_2_metadata(xmlDocPtr xml_doc, xmlNodePtr xml_metadata,
142  gavl_metadata_t * ret);
143 
151 void bg_metadata_2_xml(xmlNodePtr xml_metadata,
152  gavl_metadata_t * ret);
153 
166 bg_parameter_info_t * bg_metadata_get_parameters(gavl_metadata_t * m);
167 
183 
184 
191 void bg_metadata_set_parameter(void * data, const char * name,
192  const bg_parameter_value_t * v);
193 
200 //int bg_metadata_equal(const bg_metadata_t * m1,
201 // const bg_metadata_t * m2);
202 
203 
211 typedef struct
212  {
214  int timescale;
215  struct
216  {
217  int64_t time;
218  char * name;
219  } * chapters;
221 
227 bg_chapter_list_t * bg_chapter_list_create(int num_chapters);
228 
234 
235 
248 void bg_chapter_list_insert(bg_chapter_list_t * list, int index,
249  int64_t time, const char * name);
250 
256 void bg_chapter_list_delete(bg_chapter_list_t * list, int index);
257 
266 
277  gavl_time_t time);
278 
290  gavl_time_t time, int * current_chapter);
291 
292 
300 void bg_chapter_list_2_xml(bg_chapter_list_t * list, xmlNodePtr xml_list);
301 
311 bg_xml_2_chapter_list(xmlDocPtr xml_doc, xmlNodePtr xml_list);
312 
318 void bg_chapter_list_save(bg_chapter_list_t * list, const char * filename);
319 
325 bg_chapter_list_t * bg_chapter_list_load(const char * filename);
326 
327 #define BG_TRACK_SEEKABLE (1<<0)
328 #define BG_TRACK_PAUSABLE (1<<1)
329 
330 
333 typedef struct
334  {
335  int flags;
336  char * name;
337  int64_t duration;
338 
342 
346 
347  gavl_metadata_t metadata;
348 
349  /* The following are only meaningful for redirectors */
350 
351  char * url;
352 
354 
355  } bg_track_info_t;
356 
367 
379  const char * location);
380 
391 char * bg_get_track_name_default(const char * location, int track, int num_tracks);
392 
398 #endif // /__BG_STREAMINFO_H_