streaminfo.h

00001 /*****************************************************************
00002  * gmerlin - a general purpose multimedia framework and applications
00003  *
00004  * Copyright (c) 2001 - 2011 Members of the Gmerlin project
00005  * gmerlin-general@lists.sourceforge.net
00006  * http://gmerlin.sourceforge.net
00007  *
00008  * This program is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  * *****************************************************************/
00021 
00022 #ifndef __BG_STREAMINFO_H_
00023 #define __BG_STREAMINFO_H_
00024 
00025 #include <gavl/gavl.h>
00026 
00027 #include <libxml/tree.h>
00028 #include <libxml/parser.h>
00029 
00039 /************************************************
00040  * Types for describing media streams
00041  ************************************************/
00042 
00043 /* Languages are ISO 639-2 (3 character code) */
00044 
00051 typedef struct
00052   {
00053   gavl_audio_format_t format; 
00054   char * description; 
00055   char   language[4]; 
00056   char * info;        
00057   int64_t duration;   
00058   int64_t pts_offset; 
00059   } bg_audio_info_t;
00060 
00066 typedef struct
00067   {
00068   gavl_video_format_t format; 
00069   char * description; 
00070   char language[4]; 
00071   char * info;        
00072   int64_t duration;   
00073   int64_t pts_offset; 
00074   } bg_video_info_t;
00075 
00081 typedef struct
00082   {
00083   char * description; 
00084   char language[4]; 
00085   char * info;        
00086 
00087   int is_text; 
00088   gavl_video_format_t format; 
00089   int64_t duration;   
00090   } bg_subtitle_info_t;
00091 
00097 typedef struct
00098   {
00099   char * key;   
00100   char * value; 
00101   } bg_metadata_extended_t;
00102 
00108 typedef struct
00109   {
00110   char * artist; 
00111   char * title; 
00112   char * album; 
00113       
00114   int track; 
00115   char * date; 
00116   char * genre; 
00117   char * comment;
00118 
00119   char * author;
00120   char * copyright;
00121   
00122   bg_metadata_extended_t * ext; 
00123   } bg_metadata_t;
00124 
00129 void bg_metadata_free(bg_metadata_t * m);
00130 
00139 void bg_metadata_copy(bg_metadata_t * dst, const bg_metadata_t * src);
00140 
00162 char * bg_create_track_name(const bg_metadata_t * m, const char * format);
00163 
00170 char * bg_metadata_to_string(const bg_metadata_t * m, int use_tabs);
00171 
00180 int bg_metadata_get_year(const bg_metadata_t * m);
00181 
00190 void bg_metadata_append_ext(bg_metadata_t * m, const char * key, const char * value);
00191 
00192 /* XML Interface */
00193 
00202 void bg_xml_2_metadata(xmlDocPtr xml_doc, xmlNodePtr xml_metadata,
00203                        bg_metadata_t * ret);
00204 
00212 void bg_metadata_2_xml(xmlNodePtr xml_metadata,
00213                        bg_metadata_t * ret);
00214 
00227 bg_parameter_info_t * bg_metadata_get_parameters(bg_metadata_t * m);
00228 
00235 void bg_metadata_set_parameter(void * data, const char * name,
00236                                const bg_parameter_value_t * v);
00237 
00244 void bg_metadata_dump(const bg_metadata_t * m);
00245 
00246 
00254 typedef struct
00255   {
00256   int num_chapters;       
00257   int timescale;          
00258   struct
00259     {
00260     int64_t time;        
00261     char * name;          
00262     } * chapters;         
00263   } bg_chapter_list_t;
00264 
00270 bg_chapter_list_t * bg_chapter_list_create(int num_chapters);
00271 
00276 bg_chapter_list_t * bg_chapter_list_copy(const bg_chapter_list_t * list);
00277 
00278 
00283 void bg_chapter_list_destroy(bg_chapter_list_t * list);
00291 void bg_chapter_list_insert(bg_chapter_list_t * list, int index,
00292                             int64_t time, const char * name);
00293 
00299 void bg_chapter_list_delete(bg_chapter_list_t * list, int index);
00300 
00308 void bg_chapter_list_set_default_names(bg_chapter_list_t * list);
00309 
00319 int bg_chapter_list_get_current(bg_chapter_list_t * list,
00320                                  gavl_time_t time);
00321 
00332 int bg_chapter_list_changed(bg_chapter_list_t * list,
00333                             gavl_time_t time, int * current_chapter);
00334 
00335 
00343 void bg_chapter_list_2_xml(bg_chapter_list_t * list, xmlNodePtr xml_list);
00344 
00353 bg_chapter_list_t *
00354 bg_xml_2_chapter_list(xmlDocPtr xml_doc, xmlNodePtr xml_list);
00355 
00361 void bg_chapter_list_save(bg_chapter_list_t * list, const char * filename);
00362 
00368 bg_chapter_list_t * bg_chapter_list_load(const char * filename);
00369 
00370 #define BG_TRACK_SEEKABLE (1<<0) //!< Track is seekable
00371 #define BG_TRACK_PAUSABLE (1<<1) //!< Track is pausable
00372 
00376 typedef struct
00377   {
00378   int flags;             
00379   char * name;           
00380   char * description;    
00381   int64_t duration;      
00382   
00383   int num_audio_streams;   
00384   int num_video_streams;   
00385   int num_subtitle_streams;
00386   
00387   bg_audio_info_t *    audio_streams; 
00388   bg_video_info_t *    video_streams; 
00389   bg_subtitle_info_t * subtitle_streams; 
00390 
00391   bg_metadata_t metadata; 
00392   
00393   /* The following are only meaningful for redirectors */
00394   
00395   char * url; 
00396 
00397   bg_chapter_list_t * chapter_list; 
00398   
00399   } bg_track_info_t;
00400 
00410 void bg_track_info_free(bg_track_info_t * info);
00411 
00422 void bg_set_track_name_default(bg_track_info_t * info,
00423                                const char * location);
00424 
00435 char * bg_get_track_name_default(const char * location, int track, int num_tracks);
00436 
00442 #endif // /__BG_STREAMINFO_H_
Generated on Sat Jan 28 06:53:18 2012 for gmerlin by  doxygen 1.6.3