00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00029 #include <gavl/gavl.h>
00030 #include <gavl/compression.h>
00031 #include <gavl/metadata.h>
00032
00033 #include "bgavdefs.h"
00034
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038
00043 typedef struct bgav_edl_s bgav_edl_t;
00044
00078 typedef struct bgav_s bgav_t;
00079
00085 BGAV_PUBLIC
00086 bgav_t * bgav_create();
00087
00118 typedef gavl_metadata_t bgav_metadata_t;
00119
00126 BGAV_PUBLIC
00127 const char * bgav_metadata_get_author(const bgav_metadata_t*metadata);
00128
00135 BGAV_PUBLIC
00136 const char * bgav_metadata_get_title(const bgav_metadata_t * metadata);
00137
00144 BGAV_PUBLIC
00145 const char * bgav_metadata_get_comment(const bgav_metadata_t * metadata);
00146
00153 BGAV_PUBLIC
00154 const char * bgav_metadata_get_copyright(const bgav_metadata_t * metadata);
00155
00162 BGAV_PUBLIC
00163 const char * bgav_metadata_get_album(const bgav_metadata_t * metadata);
00164
00171 BGAV_PUBLIC
00172 const char * bgav_metadata_get_artist(const bgav_metadata_t * metadata);
00173
00180 BGAV_PUBLIC
00181 const char * bgav_metadata_get_albumartist(const bgav_metadata_t * metadata);
00182
00189 BGAV_PUBLIC
00190 const char * bgav_metadata_get_genre(const bgav_metadata_t * metadata);
00191
00198 BGAV_PUBLIC
00199 const char * bgav_metadata_get_date(const bgav_metadata_t * metadata);
00200
00207 BGAV_PUBLIC
00208 int bgav_metadata_get_track(const bgav_metadata_t * metadata);
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00223 typedef struct bgav_options_s bgav_options_t;
00224
00234 BGAV_PUBLIC
00235 bgav_options_t * bgav_get_options(bgav_t * bgav);
00236
00251 BGAV_PUBLIC
00252 bgav_options_t * bgav_options_create();
00253
00263 BGAV_PUBLIC
00264 void bgav_options_destroy(bgav_options_t * opt);
00265
00272 BGAV_PUBLIC
00273 void bgav_options_copy(bgav_options_t * dst, const bgav_options_t * src);
00274
00284 BGAV_PUBLIC
00285 void bgav_options_set_connect_timeout(bgav_options_t * opt, int timeout);
00286
00296 BGAV_PUBLIC
00297 void bgav_options_set_read_timeout(bgav_options_t * opt, int timeout);
00298
00313 BGAV_PUBLIC
00314 void bgav_options_set_rtp_port_base(bgav_options_t * opt, int p);
00315
00325 BGAV_PUBLIC
00326 void bgav_options_set_rtp_try_tcp(bgav_options_t * opt, int enable);
00327
00337 BGAV_PUBLIC
00338 void bgav_options_set_network_bandwidth(bgav_options_t * opt, int bandwidth);
00339
00349 BGAV_PUBLIC
00350 void bgav_options_set_network_buffer_size(bgav_options_t * opt, int size);
00351
00352
00353
00364 BGAV_PUBLIC
00365 void bgav_options_set_http_use_proxy(bgav_options_t* opt, int enable);
00366
00376 BGAV_PUBLIC
00377 void bgav_options_set_http_proxy_host(bgav_options_t* opt, const char * host);
00378
00388 BGAV_PUBLIC
00389 void bgav_options_set_http_proxy_port(bgav_options_t* opt, int port);
00390
00401 BGAV_PUBLIC
00402 void bgav_options_set_http_proxy_auth(bgav_options_t* opt, int enable);
00403
00412 BGAV_PUBLIC
00413 void bgav_options_set_http_proxy_user(bgav_options_t* opt, const char * user);
00414
00423 BGAV_PUBLIC
00424 void bgav_options_set_http_proxy_pass(bgav_options_t* opt, const char * pass);
00425
00434 BGAV_PUBLIC
00435 void bgav_options_set_http_shoutcast_metadata(bgav_options_t* opt, int enable);
00436
00437
00438
00445 BGAV_PUBLIC
00446 void bgav_options_set_ftp_anonymous(bgav_options_t* opt, int enable);
00447
00456 BGAV_PUBLIC
00457 void bgav_options_set_ftp_anonymous_password(bgav_options_t* opt, const char* pass);
00458
00470 BGAV_PUBLIC
00471 void bgav_options_set_default_subtitle_encoding(bgav_options_t* opt,
00472 const char* encoding);
00473
00484 BGAV_PUBLIC
00485 void bgav_options_set_audio_dynrange(bgav_options_t* opt,
00486 int audio_dynrange);
00487
00488
00502 BGAV_PUBLIC
00503 void bgav_options_set_sample_accurate(bgav_options_t*opt, int enable);
00504
00516 BGAV_PUBLIC
00517 void bgav_options_set_cache_time(bgav_options_t*opt, int t);
00518
00528 BGAV_PUBLIC
00529 void bgav_options_set_cache_size(bgav_options_t*opt, int s);
00530
00546 BGAV_PUBLIC
00547 void bgav_options_set_seek_subtitles(bgav_options_t* opt,
00548 int seek_subtitles);
00549
00559 BGAV_PUBLIC
00560 void bgav_options_set_pp_level(bgav_options_t* opt,
00561 int pp_level);
00562
00571 BGAV_PUBLIC
00572 void bgav_options_set_postprocessing_level(bgav_options_t* opt,
00573 float pp_level);
00574
00583 BGAV_PUBLIC
00584 void bgav_options_set_threads(bgav_options_t * opt, int threads);
00585
00586
00598 BGAV_PUBLIC
00599 void bgav_options_set_dvb_channels_file(bgav_options_t* opt,
00600 const char * file);
00601
00613 BGAV_PUBLIC
00614 void bgav_options_set_prefer_ffmpeg_demuxers(bgav_options_t* opt,
00615 int prefer);
00616
00623 BGAV_PUBLIC
00624 void bgav_options_set_dv_datetime(bgav_options_t* opt,
00625 int datetime);
00626
00636 BGAV_PUBLIC
00637 void bgav_options_set_shrink(bgav_options_t* opt,
00638 int factor);
00639
00648 BGAV_PUBLIC
00649 void bgav_options_set_vdpau(bgav_options_t* opt,
00650 int vdpau);
00651
00660 BGAV_PUBLIC
00661 void bgav_options_set_dump_headers(bgav_options_t* opt,
00662 int enable);
00663
00672 BGAV_PUBLIC
00673 void bgav_options_set_dump_indices(bgav_options_t* opt,
00674 int enable);
00675
00676
00677
00684 typedef enum
00685 {
00686 BGAV_LOG_DEBUG = (1<<0),
00687 BGAV_LOG_WARNING = (1<<1),
00688 BGAV_LOG_ERROR = (1<<2),
00689 BGAV_LOG_INFO = (1<<3)
00690 } bgav_log_level_t;
00691
00700 typedef void (*bgav_log_callback)(void*data, bgav_log_level_t level,
00701 const char * log_domain,
00702 const char * message);
00703
00711 BGAV_PUBLIC void
00712 bgav_options_set_log_callback(bgav_options_t* opt,
00713 bgav_log_callback callback,
00714 void * data);
00715
00724 BGAV_PUBLIC void
00725 bgav_options_set_log_level(bgav_options_t* opt,
00726 int level);
00727
00728
00729
00730
00731
00741 typedef void (*bgav_name_change_callback)(void*data, const char * name);
00742
00750 BGAV_PUBLIC void
00751 bgav_options_set_name_change_callback(bgav_options_t* opt,
00752 bgav_name_change_callback callback,
00753 void * data);
00754
00765 typedef void (*bgav_metadata_change_callback)(void*data, const bgav_metadata_t * metadata);
00766
00774 BGAV_PUBLIC void
00775 bgav_options_set_metadata_change_callback(bgav_options_t* opt,
00776 bgav_metadata_change_callback callback,
00777 void * data);
00778
00788 typedef void (*bgav_buffer_callback)(void*data, float percentage);
00789
00797 BGAV_PUBLIC void
00798 bgav_options_set_buffer_callback(bgav_options_t* opt,
00799 bgav_buffer_callback callback,
00800 void * data);
00801
00813 typedef int (*bgav_user_pass_callback)(void*data, const char * resource,
00814 char ** username, char ** password);
00815
00827 BGAV_PUBLIC void
00828 bgav_options_set_user_pass_callback(bgav_options_t* opt,
00829 bgav_user_pass_callback callback,
00830 void * data);
00831
00842 typedef void (*bgav_aspect_callback)(void*data, int stream,
00843 int pixel_width, int pixel_height);
00844
00845
00853 BGAV_PUBLIC void
00854 bgav_options_set_aspect_callback(bgav_options_t* opt,
00855 bgav_aspect_callback callback,
00856 void * data);
00857
00865 typedef void (*bgav_index_callback)(void*data, float percentage);
00866
00874 BGAV_PUBLIC void
00875 bgav_options_set_index_callback(bgav_options_t* opt,
00876 bgav_index_callback callback,
00877 void * data);
00878
00879
00880
00881
00899 typedef struct
00900 {
00901 char * device;
00902 char * name;
00903 } bgav_device_info_t;
00904
00905
00906
00914 BGAV_PUBLIC
00915 bgav_device_info_t * bgav_find_devices_vcd();
00916
00924 BGAV_PUBLIC
00925 int bgav_check_device_vcd(const char * device, char ** name);
00926
00934 BGAV_PUBLIC
00935 bgav_device_info_t * bgav_find_devices_dvd();
00936
00944 BGAV_PUBLIC
00945 int bgav_check_device_dvd(const char * device, char ** name);
00946
00954 BGAV_PUBLIC
00955 bgav_device_info_t * bgav_find_devices_dvb();
00956
00964 BGAV_PUBLIC
00965 int bgav_check_device_dvb(const char * device, char ** name);
00966
00973 BGAV_PUBLIC
00974 void bgav_device_info_destroy(bgav_device_info_t * arr);
00975
00982 BGAV_PUBLIC
00983 int bgav_eject_disc(const char * device);
00984
00991 BGAV_PUBLIC
00992 const char * bgav_get_disc_name(bgav_t * bgav);
00993
00994
00995
00996
00997
00998
00999
01007 BGAV_PUBLIC
01008 int bgav_open(bgav_t * bgav, const char * location);
01009
01017 BGAV_PUBLIC
01018 int bgav_open_vcd(bgav_t * bgav, const char * location);
01019
01027 BGAV_PUBLIC
01028 int bgav_open_dvd(bgav_t * bgav, const char * location);
01029
01041 BGAV_PUBLIC
01042 int bgav_open_dvb(bgav_t * bgav, const char * location);
01043
01044
01054 BGAV_PUBLIC
01055 int bgav_open_fd(bgav_t * bgav, int fd,
01056 int64_t total_size,
01057 const char * mimetype);
01058
01071 BGAV_PUBLIC
01072 int bgav_open_callbacks(bgav_t * bgav,
01073 int (*read_callback)(void * priv, uint8_t * data, int len),
01074 int64_t (*seek_callback)(void * priv, uint64_t pos, int whence),
01075 void * priv,
01076 const char * filename, const char * mimetype, int64_t total_bytes);
01077
01078
01079
01080
01086 BGAV_PUBLIC
01087 void bgav_close(bgav_t * bgav);
01088
01113 typedef struct
01114 {
01115 char * url;
01116
01117 int track;
01118 int stream;
01119 int timescale;
01120
01121 int64_t src_time;
01122
01123
01124
01125 int64_t dst_time;
01126 int64_t dst_duration;
01127
01128
01129 int32_t speed_num;
01130 int32_t speed_den;
01131
01132 } bgav_edl_segment_t;
01133
01137 typedef struct
01138 {
01139 bgav_edl_segment_t * segments;
01140 int num_segments;
01141 int timescale;
01142 } bgav_edl_stream_t;
01143
01147 typedef struct
01148 {
01149 char * name;
01150 bgav_metadata_t * metadata;
01151
01152 int num_audio_streams;
01153 bgav_edl_stream_t * audio_streams;
01154
01155 int num_video_streams;
01156 bgav_edl_stream_t * video_streams;
01157
01158 int num_subtitle_text_streams;
01159 bgav_edl_stream_t * subtitle_text_streams;
01160
01161 int num_subtitle_overlay_streams;
01162 bgav_edl_stream_t * subtitle_overlay_streams;
01163
01164 } bgav_edl_track_t;
01165
01169 struct bgav_edl_s
01170 {
01171 int num_tracks;
01172 bgav_edl_track_t * tracks;
01173 char * url;
01174 };
01175
01182 BGAV_PUBLIC
01183 bgav_edl_t * bgav_get_edl(bgav_t * bgav);
01184
01189 BGAV_PUBLIC
01190 void bgav_edl_dump(const bgav_edl_t * e);
01191
01196
01197
01198
01199
01200
01201
01202
01203
01226 BGAV_PUBLIC
01227 int bgav_is_redirector(bgav_t * bgav);
01228
01235 BGAV_PUBLIC
01236 int bgav_redirector_get_num_urls(bgav_t * bgav);
01237
01245 BGAV_PUBLIC
01246 const char * bgav_redirector_get_url(bgav_t * bgav, int index);
01247
01255 BGAV_PUBLIC
01256 const char * bgav_redirector_get_name(bgav_t * bgav, int index);
01257
01258
01259
01260
01261
01275 BGAV_PUBLIC
01276 int bgav_num_tracks(bgav_t * bgav);
01277
01284 BGAV_PUBLIC
01285 const char * bgav_get_description(bgav_t * bgav);
01286
01294 BGAV_PUBLIC
01295 gavl_time_t bgav_get_duration(bgav_t * bgav, int track);
01296
01297
01298
01306 BGAV_PUBLIC
01307 int bgav_num_audio_streams(bgav_t * bgav, int track);
01308
01316 BGAV_PUBLIC
01317 int bgav_num_video_streams(bgav_t * bgav, int track);
01318
01326 BGAV_PUBLIC
01327 int bgav_num_subtitle_streams(bgav_t * bgav, int track);
01328
01329
01337 BGAV_PUBLIC
01338 const char * bgav_get_track_name(bgav_t * bgav, int track);
01339
01347 BGAV_PUBLIC
01348 const bgav_metadata_t * bgav_get_metadata(bgav_t * bgav,int track);
01349
01361 BGAV_PUBLIC
01362 int bgav_select_track(bgav_t * bgav, int track);
01363
01376 BGAV_PUBLIC
01377 int bgav_get_num_chapters(bgav_t * bgav, int track, int * timescale);
01378
01387 BGAV_PUBLIC const char *
01388 bgav_get_chapter_name(bgav_t * bgav, int track, int chapter);
01389
01398 BGAV_PUBLIC
01399 int64_t bgav_get_chapter_time(bgav_t * bgav, int track, int chapter);
01400
01416 BGAV_PUBLIC
01417 const char * bgav_get_audio_language(bgav_t * bgav, int stream);
01418
01426 BGAV_PUBLIC
01427 int bgav_get_audio_bitrate(bgav_t * bgav, int stream);
01428
01436 BGAV_PUBLIC
01437 const bgav_metadata_t *
01438 bgav_get_audio_metadata(bgav_t * bgav, int stream);
01439
01447 BGAV_PUBLIC
01448 const char * bgav_get_subtitle_language(bgav_t * bgav, int stream);
01449
01457 BGAV_PUBLIC
01458 const bgav_metadata_t *
01459 bgav_get_subtitle_metadata(bgav_t * bgav, int stream);
01460
01468 BGAV_PUBLIC
01469 const bgav_metadata_t *
01470 bgav_get_video_metadata(bgav_t * bgav, int stream);
01471
01472
01480 typedef enum
01481 {
01482 BGAV_STREAM_MUTE = 0,
01483 BGAV_STREAM_DECODE = 1,
01484 BGAV_STREAM_PARSE = 2,
01485 BGAV_STREAM_READRAW = 3
01486 }
01487 bgav_stream_action_t;
01488
01519 BGAV_PUBLIC
01520 int bgav_get_audio_compression_info(bgav_t * bgav, int stream,
01521 gavl_compression_info_t * info);
01522
01535 BGAV_PUBLIC
01536 int bgav_get_video_compression_info(bgav_t * bgav, int stream,
01537 gavl_compression_info_t * info);
01538
01550 BGAV_PUBLIC
01551 int bgav_read_audio_packet(bgav_t * bgav, int stream, gavl_packet_t * p);
01552
01564 BGAV_PUBLIC
01565 int bgav_read_video_packet(bgav_t * bgav, int stream, gavl_packet_t * p);
01566
01567
01568
01579 BGAV_PUBLIC
01580 int bgav_set_audio_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
01581
01592 BGAV_PUBLIC
01593 int bgav_set_video_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
01594
01605 BGAV_PUBLIC
01606 int bgav_set_subtitle_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
01607
01608
01609
01610
01611
01612
01613
01614
01615
01616
01617
01618
01632 BGAV_PUBLIC
01633 int bgav_start(bgav_t * bgav);
01634
01650 BGAV_PUBLIC
01651 const gavl_audio_format_t * bgav_get_audio_format(bgav_t * bgav, int stream);
01652
01669 BGAV_PUBLIC
01670 const gavl_video_format_t * bgav_get_video_format(bgav_t * bgav, int stream);
01671
01691 BGAV_PUBLIC
01692 gavl_frame_table_t * bgav_get_frame_table(bgav_t * bgav, int stream);
01693
01694
01712 BGAV_PUBLIC const gavl_video_format_t *
01713 bgav_get_subtitle_format(bgav_t * bgav, int stream);
01714
01725 BGAV_PUBLIC
01726 int bgav_subtitle_is_text(bgav_t * bgav, int stream);
01727
01739 BGAV_PUBLIC
01740 const char * bgav_get_audio_description(bgav_t * bgav, int stream);
01741
01756 BGAV_PUBLIC
01757 const char * bgav_get_audio_info(bgav_t * bgav, int stream);
01758
01759
01771 BGAV_PUBLIC
01772 const char * bgav_get_video_description(bgav_t * bgav, int stream);
01773
01785 BGAV_PUBLIC
01786 const char * bgav_get_subtitle_description(bgav_t * bgav, int stream);
01787
01788
01803 BGAV_PUBLIC
01804 const char * bgav_get_subtitle_info(bgav_t * bgav, int stream);
01805
01815 BGAV_PUBLIC
01816 int bgav_can_pause(bgav_t * bgav);
01817
01818
01819
01820
01821
01843 BGAV_PUBLIC
01844 int bgav_video_has_still(bgav_t * bgav, int stream);
01845
01854 BGAV_PUBLIC
01855 int bgav_read_video(bgav_t * bgav, gavl_video_frame_t * frame, int stream);
01856
01870 BGAV_PUBLIC
01871 void bgav_skip_video(bgav_t * bgav, int stream,
01872 int64_t * time, int scale,
01873 int exact);
01874
01875
01885 BGAV_PUBLIC
01886 int bgav_read_audio(bgav_t * bgav, gavl_audio_frame_t * frame, int stream,
01887 int num_samples);
01888
01900 BGAV_PUBLIC
01901 int bgav_has_subtitle(bgav_t * bgav, int stream);
01902
01918 BGAV_PUBLIC
01919 int bgav_read_subtitle_overlay(bgav_t * bgav, gavl_overlay_t * ovl, int stream);
01920
01940 BGAV_PUBLIC
01941 int bgav_read_subtitle_text(bgav_t * bgav, char ** ret, int *ret_alloc,
01942 int64_t * start_time, int64_t * duration,
01943 int stream);
01944
01945
01946
01947
01948
01985 BGAV_PUBLIC
01986 int bgav_can_seek(bgav_t * bgav);
01987
01996 BGAV_PUBLIC
01997 void bgav_seek(bgav_t * bgav, gavl_time_t * time);
01998
01999
02023 BGAV_PUBLIC
02024 void bgav_seek_scaled(bgav_t * bgav, int64_t * time, int scale);
02025
02030 #define BGAV_TIMESTAMP_UNDEFINED GAVL_TIME_UNDEFINED // Don't change this
02031
02047 BGAV_PUBLIC
02048 int bgav_can_seek_sample(bgav_t * bgav);
02049
02050
02063 BGAV_PUBLIC
02064 int64_t bgav_audio_duration(bgav_t * bgav, int stream);
02065
02077 BGAV_PUBLIC
02078 int64_t bgav_audio_start_time(bgav_t * bgav, int stream);
02079
02092 BGAV_PUBLIC
02093 int64_t bgav_video_duration(bgav_t * bgav, int stream);
02094
02106 BGAV_PUBLIC
02107 int64_t bgav_video_start_time(bgav_t * bgav, int stream);
02108
02109
02119 BGAV_PUBLIC
02120 int64_t bgav_subtitle_duration(bgav_t * bgav, int stream);
02121
02135 BGAV_PUBLIC
02136 void bgav_seek_audio(bgav_t * bgav, int stream, int64_t sample);
02137
02151 BGAV_PUBLIC
02152 void bgav_seek_video(bgav_t * bgav, int stream, int64_t time);
02153
02169 BGAV_PUBLIC
02170 int64_t bgav_video_keyframe_before(bgav_t * bgav, int stream, int64_t time);
02171
02187 BGAV_PUBLIC
02188 int64_t bgav_video_keyframe_after(bgav_t * bgav, int stream, int64_t time);
02189
02190
02201 BGAV_PUBLIC
02202 void bgav_seek_subtitle(bgav_t * bgav, int stream, int64_t time);
02203
02204
02205
02206
02207
02208
02217 BGAV_PUBLIC
02218 void bgav_dump(bgav_t * bgav);
02219
02220
02221
02229 BGAV_PUBLIC
02230 void bgav_codecs_dump();
02231
02232
02233
02241 BGAV_PUBLIC
02242 void bgav_formats_dump();
02243
02251 BGAV_PUBLIC
02252 void bgav_inputs_dump();
02253
02261 BGAV_PUBLIC
02262 void bgav_redirectors_dump();
02263
02271 BGAV_PUBLIC
02272 void bgav_subreaders_dump();
02273
02274
02275 #ifdef __cplusplus
02276 }
02277 #endif
02278