streaminfo.h

00001 /*****************************************************************
00002  * gmerlin - a general purpose multimedia framework and applications
00003  *
00004  * Copyright (c) 2001 - 2008 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   } bg_audio_info_t;
00059 
00065 typedef struct
00066   {
00067   gavl_video_format_t format; 
00068   char * description; 
00069   char language[4]; 
00070   char * info;        
00071   int64_t duration;   
00072   } bg_video_info_t;
00073 
00079 typedef struct
00080   {
00081   char * description; 
00082   char language[4]; 
00083   char * info;        
00084 
00085   int is_text; 
00086   gavl_video_format_t format; 
00087   int64_t duration;   
00088   } bg_subtitle_info_t;
00089 
00095 typedef struct
00096   {
00097   char * key;   
00098   char * value; 
00099   } bg_metadata_extended_t;
00100 
00106 typedef struct
00107   {
00108   char * artist; 
00109   char * title; 
00110   char * album; 
00111       
00112   int track; 
00113   char * date; 
00114   char * genre; 
00115   char * comment;
00116 
00117   char * author;
00118   char * copyright;
00119   
00120   bg_metadata_extended_t * ext; 
00121   } bg_metadata_t;
00122 
00127 void bg_metadata_free(bg_metadata_t * m);
00128 
00137 void bg_metadata_copy(bg_metadata_t * dst, const bg_metadata_t * src);
00138 
00160 char * bg_create_track_name(const bg_metadata_t * m, const char * format);
00161 
00168 char * bg_metadata_to_string(const bg_metadata_t * m, int use_tabs);
00169 
00178 int bg_metadata_get_year(const bg_metadata_t * m);
00179 
00188 void bg_metadata_append_ext(bg_metadata_t * m, const char * key, const char * value);
00189 
00190 /* XML Interface */
00191 
00200 void bg_xml_2_metadata(xmlDocPtr xml_doc, xmlNodePtr xml_metadata,
00201                        bg_metadata_t * ret);
00202 
00210 void bg_metadata_2_xml(xmlNodePtr xml_metadata,
00211                        bg_metadata_t * ret);
00212 
00225 bg_parameter_info_t * bg_metadata_get_parameters(bg_metadata_t * m);
00226 
00233 void bg_metadata_set_parameter(void * data, const char * name,
00234                                const bg_parameter_value_t * v);
00235 
00242 void bg_metadata_dump(const bg_metadata_t * m);
00243 
00244 
00252 typedef struct
00253   {
00254   int num_chapters;       
00255   int timescale;          
00256   struct
00257     {
00258     int64_t time;        
00259     char * name;          
00260     } * chapters;         
00261   } bg_chapter_list_t;
00262 
00268 bg_chapter_list_t * bg_chapter_list_create(int num_chapters);
00269 
00274 bg_chapter_list_t * bg_chapter_list_copy(const bg_chapter_list_t * list);
00275 
00276 
00281 void bg_chapter_list_destroy(bg_chapter_list_t * list);
00289 void bg_chapter_list_insert(bg_chapter_list_t * list, int index,
00290                             int64_t time, const char * name);
00291 
00297 void bg_chapter_list_delete(bg_chapter_list_t * list, int index);
00298 
00306 void bg_chapter_list_set_default_names(bg_chapter_list_t * list);
00307 
00317 int bg_chapter_list_get_current(bg_chapter_list_t * list,
00318                                  gavl_time_t time);
00319 
00330 int bg_chapter_list_changed(bg_chapter_list_t * list,
00331                             gavl_time_t time, int * current_chapter);
00332 
00333 
00341 void bg_chapter_list_2_xml(bg_chapter_list_t * list, xmlNodePtr xml_list);
00342 
00351 bg_chapter_list_t *
00352 bg_xml_2_chapter_list(xmlDocPtr xml_doc, xmlNodePtr xml_list);
00353 
00359 void bg_chapter_list_save(bg_chapter_list_t * list, const char * filename);
00360 
00366 bg_chapter_list_t * bg_chapter_list_load(const char * filename);
00367 
00368 #define BG_TRACK_SEEKABLE (1<<0) //!< Track is seekable
00369 #define BG_TRACK_PAUSABLE (1<<1) //!< Track is pausable
00370 
00374 typedef struct
00375   {
00376   int flags;             
00377   char * name;           
00378   char * description;    
00379   int64_t duration;      
00380   
00381   int num_audio_streams;   
00382   int num_video_streams;   
00383   int num_subtitle_streams;
00384   
00385   bg_audio_info_t *    audio_streams; 
00386   bg_video_info_t *    video_streams; 
00387   bg_subtitle_info_t * subtitle_streams; 
00388 
00389   bg_metadata_t metadata; 
00390   
00391   /* The following are only meaningful for redirectors */
00392   
00393   char * url; 
00394 
00395   bg_chapter_list_t * chapter_list; 
00396   
00397   } bg_track_info_t;
00398 
00408 void bg_track_info_free(bg_track_info_t * info);
00409 
00420 void bg_set_track_name_default(bg_track_info_t * info,
00421                                const char * location);
00422 
00433 char * bg_get_track_name_default(const char * location, int track, int num_tracks);
00434 
00440 #endif // /__BG_STREAMINFO_H_
Generated on Sat Apr 24 15:29:52 2010 for gmerlin by  doxygen 1.6.3