gmerlin-avdecoder
avdec.h
Go to the documentation of this file.
1 /*****************************************************************
2  * gmerlin-avdecoder - a general purpose multimedia decoding library
3  *
4  * Copyright (c) 2001 - 2012 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 /* Public entry points */
23 
29 #include <gavl/gavl.h>
30 #include <gavl/compression.h>
31 #include <gavl/metadata.h>
32 #include <gavl/chapterlist.h>
33 #include <gavl/connectors.h>
34 #include <gavl/edl.h>
35 
36 #include "bgavdefs.h" // This is ugly, but works
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
75 typedef struct bgav_s bgav_t;
76 
82 BGAV_PUBLIC
84 
115 typedef gavl_metadata_t bgav_metadata_t;
116 
123 BGAV_PUBLIC
124 const char * bgav_metadata_get_author(const bgav_metadata_t*metadata);
125 
132 BGAV_PUBLIC
133 const char * bgav_metadata_get_title(const bgav_metadata_t * metadata);
134 
141 BGAV_PUBLIC
142 const char * bgav_metadata_get_comment(const bgav_metadata_t * metadata);
143 
150 BGAV_PUBLIC
151 const char * bgav_metadata_get_copyright(const bgav_metadata_t * metadata);
152 
159 BGAV_PUBLIC
160 const char * bgav_metadata_get_album(const bgav_metadata_t * metadata);
161 
168 BGAV_PUBLIC
169 const char * bgav_metadata_get_artist(const bgav_metadata_t * metadata);
170 
177 BGAV_PUBLIC
178 const char * bgav_metadata_get_albumartist(const bgav_metadata_t * metadata);
179 
186 BGAV_PUBLIC
187 const char * bgav_metadata_get_genre(const bgav_metadata_t * metadata);
188 
195 BGAV_PUBLIC
196 const char * bgav_metadata_get_date(const bgav_metadata_t * metadata);
197 
204 BGAV_PUBLIC
206 
207 /***************************************************
208  * Housekeeping Functions
209  ***************************************************/
210 
211 /***************************************************
212  * Set parameters
213  ***************************************************/
214 
215 
220 typedef struct bgav_options_s bgav_options_t;
221 
231 BGAV_PUBLIC
233 
248 BGAV_PUBLIC
250 
260 BGAV_PUBLIC
262 
269 BGAV_PUBLIC
271 
281 BGAV_PUBLIC
283 
293 BGAV_PUBLIC
295 
310 BGAV_PUBLIC
312 
322 BGAV_PUBLIC
324 
334 BGAV_PUBLIC
336 
346 BGAV_PUBLIC
348 
349 /* HTTP Options */
350 
361 BGAV_PUBLIC
363 
373 BGAV_PUBLIC
374 void bgav_options_set_http_proxy_host(bgav_options_t* opt, const char * host);
375 
385 BGAV_PUBLIC
387 
398 BGAV_PUBLIC
400 
409 BGAV_PUBLIC
410 void bgav_options_set_http_proxy_user(bgav_options_t* opt, const char * user);
411 
420 BGAV_PUBLIC
421 void bgav_options_set_http_proxy_pass(bgav_options_t* opt, const char * pass);
422 
431 BGAV_PUBLIC
433 
434 /* Set FTP options */
435 
442 BGAV_PUBLIC
444 
453 BGAV_PUBLIC
455 
467 BGAV_PUBLIC
469  const char* encoding);
470 
481 BGAV_PUBLIC
483  int audio_dynrange);
484 
485 
499 BGAV_PUBLIC
501 
513 BGAV_PUBLIC
515 
525 BGAV_PUBLIC
527 
543 BGAV_PUBLIC
545  int seek_subtitles);
546 
556 BGAV_PUBLIC
558  int pp_level);
559 
568 BGAV_PUBLIC
570  float pp_level);
571 
580 BGAV_PUBLIC
581 void bgav_options_set_threads(bgav_options_t * opt, int threads);
582 
583 
595 BGAV_PUBLIC
597  const char * file);
598 
610 BGAV_PUBLIC
612  int prefer);
613 
620 BGAV_PUBLIC
622  int datetime);
623 
633 BGAV_PUBLIC
635  int factor);
636 
645 BGAV_PUBLIC
647  int vdpau);
648 
657 BGAV_PUBLIC
659  int enable);
660 
669 BGAV_PUBLIC
671  int enable);
672 
673 
682 BGAV_PUBLIC
684  int enable);
685 
686 
693 typedef enum
694  {
695  BGAV_LOG_DEBUG = (1<<0),
696  BGAV_LOG_WARNING = (1<<1),
697  BGAV_LOG_ERROR = (1<<2),
698  BGAV_LOG_INFO = (1<<3)
700 
709 typedef void (*bgav_log_callback)(void*data, bgav_log_level_t level,
710  const char * log_domain,
711  const char * message);
712 
720 BGAV_PUBLIC void
722  bgav_log_callback callback,
723  void * data);
724 
733 BGAV_PUBLIC void
735  int level);
736 
737 
738 
739 /* Set callbacks */
740 
751 typedef void (*bgav_metadata_change_callback)(void*data, const bgav_metadata_t * metadata);
752 
760 BGAV_PUBLIC void
763  void * data);
764 
774 typedef void (*bgav_buffer_callback)(void*data, float percentage);
775 
783 BGAV_PUBLIC void
785  bgav_buffer_callback callback,
786  void * data);
787 
799 typedef int (*bgav_user_pass_callback)(void*data, const char * resource,
800  char ** username, char ** password);
801 
813 BGAV_PUBLIC void
815  bgav_user_pass_callback callback,
816  void * data);
817 
828 typedef void (*bgav_aspect_callback)(void*data, int stream,
829  int pixel_width, int pixel_height);
830 
831 
839 BGAV_PUBLIC void
841  bgav_aspect_callback callback,
842  void * data);
843 
851 typedef void (*bgav_index_callback)(void*data, float percentage);
852 
860 BGAV_PUBLIC void
862  bgav_index_callback callback,
863  void * data);
864 
865 
866 /* Device description */
867 
885 typedef struct
886  {
887  char * device;
888  char * name;
890 
891 /* Scan for devices */
892 
900 BGAV_PUBLIC
902 
910 BGAV_PUBLIC
911 int bgav_check_device_vcd(const char * device, char ** name);
912 
920 BGAV_PUBLIC
922 
930 BGAV_PUBLIC
931 int bgav_check_device_dvd(const char * device, char ** name);
932 
940 BGAV_PUBLIC
942 
950 BGAV_PUBLIC
951 int bgav_check_device_dvb(const char * device, char ** name);
952 
959 BGAV_PUBLIC
961 
968 BGAV_PUBLIC
969 int bgav_eject_disc(const char * device);
970 
977 BGAV_PUBLIC
978 const char * bgav_get_disc_name(bgav_t * bgav);
979 
980 /******************************************************
981  * Open
982  ******************************************************/
983 
984 /* Open a file or URL, return 1 on success */
985 
993 BGAV_PUBLIC
994 int bgav_open(bgav_t * bgav, const char * location);
995 
1003 BGAV_PUBLIC
1004 int bgav_open_vcd(bgav_t * bgav, const char * location);
1005 
1013 BGAV_PUBLIC
1014 int bgav_open_dvd(bgav_t * bgav, const char * location);
1015 
1027 BGAV_PUBLIC
1028 int bgav_open_dvb(bgav_t * bgav, const char * location);
1029 
1030 
1040 BGAV_PUBLIC
1041 int bgav_open_fd(bgav_t * bgav, int fd,
1042  int64_t total_size,
1043  const char * mimetype);
1044 
1057 BGAV_PUBLIC
1059  int (*read_callback)(void * priv, uint8_t * data, int len),
1060  int64_t (*seek_callback)(void * priv, int64_t pos, int whence),
1061  void * priv,
1062  const char * filename, const char * mimetype, int64_t total_bytes);
1063 
1064 
1065 /* Close and destroy everything */
1066 
1072 BGAV_PUBLIC
1073 void bgav_close(bgav_t * bgav);
1074 
1081 BGAV_PUBLIC
1082 gavl_edl_t * bgav_get_edl(bgav_t * bgav);
1083 
1084 /***************************************************
1085  * Check for redirecting: You MUST check if you opened
1086  * a redirector, because reading data from redirectors
1087  * crashes
1088  * After you read the URLs, close the bgav_t object
1089  * and open a new one with one of the URLs.
1090  ***************************************************/
1091 
1114 BGAV_PUBLIC
1116 
1123 BGAV_PUBLIC
1125 
1133 BGAV_PUBLIC
1134 const char * bgav_redirector_get_url(bgav_t * bgav, int index);
1135 
1143 BGAV_PUBLIC
1144 const char * bgav_redirector_get_name(bgav_t * bgav, int index);
1145 
1153 BGAV_PUBLIC
1154 const gavl_metadata_t * bgav_redirector_get_metadata(bgav_t * b, int index);
1155 
1156 /***************************************************
1157  * Get information about the file
1158  ***************************************************/
1159 
1173 BGAV_PUBLIC
1175 
1182 BGAV_PUBLIC
1183 const char * bgav_get_description(bgav_t * bgav);
1184 
1192 BGAV_PUBLIC
1194 
1195 /* Query stream numbers */
1196 
1204 BGAV_PUBLIC
1205 int bgav_num_audio_streams(bgav_t * bgav, int track);
1206 
1214 BGAV_PUBLIC
1215 int bgav_num_video_streams(bgav_t * bgav, int track);
1216 
1229 BGAV_PUBLIC
1230 int bgav_num_subtitle_streams(bgav_t * bgav, int track);
1231 
1239 BGAV_PUBLIC
1240 int bgav_num_text_streams(bgav_t * bgav, int track);
1241 
1249 BGAV_PUBLIC
1250 int bgav_num_overlay_streams(bgav_t * bgav, int track);
1251 
1252 
1253 
1261 BGAV_PUBLIC
1262 const char * bgav_get_track_name(bgav_t * bgav, int track);
1263 
1271 BGAV_PUBLIC
1272 const bgav_metadata_t * bgav_get_metadata(bgav_t * bgav,int track);
1273 
1285 BGAV_PUBLIC
1286 int bgav_select_track(bgav_t * bgav, int track);
1287 
1300 BGAV_PUBLIC
1301 int bgav_get_num_chapters(bgav_t * bgav, int track, int * timescale);
1302 
1311 BGAV_PUBLIC const char *
1312 bgav_get_chapter_name(bgav_t * bgav, int track, int chapter);
1313 
1322 BGAV_PUBLIC
1323 int64_t bgav_get_chapter_time(bgav_t * bgav, int track, int chapter);
1324 
1335 BGAV_PUBLIC
1336 const gavl_chapter_list_t * bgav_get_chapter_list(bgav_t * bgav, int track);
1337 
1338 
1354 BGAV_PUBLIC
1355 const char * bgav_get_audio_language(bgav_t * bgav, int stream);
1356 
1364 BGAV_PUBLIC
1365 int bgav_get_audio_bitrate(bgav_t * bgav, int stream);
1366 
1374 BGAV_PUBLIC
1375 const bgav_metadata_t *
1376 bgav_get_audio_metadata(bgav_t * bgav, int stream);
1377 
1385 BGAV_PUBLIC
1386 const char * bgav_get_subtitle_language(bgav_t * bgav, int stream);
1387 
1395 BGAV_PUBLIC
1396 const bgav_metadata_t *
1398 
1406 BGAV_PUBLIC
1407 const bgav_metadata_t *
1409 
1417 BGAV_PUBLIC
1418 const bgav_metadata_t *
1420 
1421 
1429 BGAV_PUBLIC
1430 const bgav_metadata_t *
1431 bgav_get_video_metadata(bgav_t * bgav, int stream);
1432 
1433 
1441 typedef enum
1442  {
1446  BGAV_STREAM_READRAW = 3
1447  }
1449 
1480 BGAV_PUBLIC
1482  gavl_compression_info_t * info);
1483 
1496 BGAV_PUBLIC
1498  gavl_compression_info_t * info);
1499 
1512 BGAV_PUBLIC
1514  gavl_compression_info_t * info);
1515 
1516 
1528 BGAV_PUBLIC
1529 int bgav_read_audio_packet(bgav_t * bgav, int stream, gavl_packet_t * p);
1530 
1540 BGAV_PUBLIC
1541 gavl_packet_source_t *
1543 
1544 
1556 BGAV_PUBLIC
1557 int bgav_read_video_packet(bgav_t * bgav, int stream, gavl_packet_t * p);
1558 
1568 BGAV_PUBLIC
1569 gavl_packet_source_t *
1571 
1581 BGAV_PUBLIC
1582 gavl_packet_source_t *
1584 
1592 BGAV_PUBLIC
1593 gavl_packet_source_t *
1595 
1596 
1607 BGAV_PUBLIC
1608 int bgav_set_audio_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
1609 
1620 BGAV_PUBLIC
1621 int bgav_set_video_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
1622 
1633 BGAV_PUBLIC
1634 int bgav_set_subtitle_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
1635 
1646 BGAV_PUBLIC
1647 int bgav_set_text_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
1648 
1659 BGAV_PUBLIC
1660 int bgav_set_overlay_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
1661 
1662 /***************************************************
1663  * Stream handling functions
1664  ***************************************************/
1665 
1666 /*
1667  * You MUST these, if you want to decode anything.
1668  * After bgav_open(), all streams are switched off by
1669  * default
1670  */
1671 
1672 
1686 BGAV_PUBLIC
1687 int bgav_start(bgav_t * bgav);
1688 
1704 BGAV_PUBLIC
1706 
1723 BGAV_PUBLIC
1725 
1738 BGAV_PUBLIC
1740 
1752 BGAV_PUBLIC
1753 int bgav_get_text_timescale(bgav_t * bgav, int stream);
1754 
1755 
1775 BGAV_PUBLIC
1777 
1778 
1796 BGAV_PUBLIC const gavl_video_format_t *
1797 bgav_get_subtitle_format(bgav_t * bgav, int stream);
1798 
1809 BGAV_PUBLIC
1810 int bgav_subtitle_is_text(bgav_t * bgav, int stream);
1811 
1823 BGAV_PUBLIC
1824 const char * bgav_get_audio_description(bgav_t * bgav, int stream);
1825 
1840 BGAV_PUBLIC
1841 const char * bgav_get_audio_info(bgav_t * bgav, int stream);
1842 
1843 
1855 BGAV_PUBLIC
1856 const char * bgav_get_video_description(bgav_t * bgav, int stream);
1857 
1869 BGAV_PUBLIC
1870 const char * bgav_get_subtitle_description(bgav_t * bgav, int stream);
1871 
1872 
1887 BGAV_PUBLIC
1888 const char * bgav_get_subtitle_info(bgav_t * bgav, int stream);
1889 
1899 BGAV_PUBLIC
1901 
1902 /***************************************************
1903  * Decoding functions
1904  ***************************************************/
1905 
1927 BGAV_PUBLIC
1928 int bgav_video_has_still(bgav_t * bgav, int stream);
1929 
1938 BGAV_PUBLIC
1939 int bgav_read_video(bgav_t * bgav, gavl_video_frame_t * frame, int stream);
1940 
1954 BGAV_PUBLIC
1955 void bgav_skip_video(bgav_t * bgav, int stream,
1956  int64_t * time, int scale,
1957  int exact);
1958 
1972 BGAV_PUBLIC
1973 gavl_video_source_t * bgav_get_video_source(bgav_t * bgav, int stream);
1974 
1983 BGAV_PUBLIC
1984 gavl_video_source_t * bgav_get_overlay_source(bgav_t * bgav, int stream);
1985 
1986 
1996 BGAV_PUBLIC
1997 int bgav_read_audio(bgav_t * bgav, gavl_audio_frame_t * frame, int stream,
1998  int num_samples);
1999 
2012 BGAV_PUBLIC
2013 gavl_audio_source_t * bgav_get_audio_source(bgav_t * bgav, int stream);
2014 
2015 
2016 
2028 BGAV_PUBLIC
2029 int bgav_has_subtitle(bgav_t * bgav, int stream);
2030 
2046 BGAV_PUBLIC
2047 int bgav_read_subtitle_overlay(bgav_t * bgav, gavl_overlay_t * ovl, int stream);
2048 
2068 BGAV_PUBLIC
2069 int bgav_read_subtitle_text(bgav_t * bgav, char ** ret, int *ret_alloc,
2070  int64_t * start_time, int64_t * duration,
2071  int stream);
2072 
2073 /***************************************************
2074  * Seek to a timestamp. This also resyncs all streams
2075  ***************************************************/
2076 
2113 BGAV_PUBLIC
2114 int bgav_can_seek(bgav_t * bgav);
2115 
2124 BGAV_PUBLIC
2125 void bgav_seek(bgav_t * bgav, gavl_time_t * time);
2126 
2127 
2151 BGAV_PUBLIC
2152 void bgav_seek_scaled(bgav_t * bgav, int64_t * time, int scale);
2153 
2158 #define BGAV_TIMESTAMP_UNDEFINED GAVL_TIME_UNDEFINED // Don't change this
2175 BGAV_PUBLIC
2177 
2178 
2191 BGAV_PUBLIC
2192 int64_t bgav_audio_duration(bgav_t * bgav, int stream);
2193 
2205 BGAV_PUBLIC
2206 int64_t bgav_audio_start_time(bgav_t * bgav, int stream);
2207 
2220 BGAV_PUBLIC
2221 int64_t bgav_video_duration(bgav_t * bgav, int stream);
2222 
2234 BGAV_PUBLIC
2235 int64_t bgav_video_start_time(bgav_t * bgav, int stream);
2236 
2237 
2247 BGAV_PUBLIC
2248 int64_t bgav_subtitle_duration(bgav_t * bgav, int stream);
2249 
2259 BGAV_PUBLIC
2260 int64_t bgav_text_duration(bgav_t * bgav, int stream);
2261 
2271 BGAV_PUBLIC
2272 int64_t bgav_overlay_duration(bgav_t * bgav, int stream);
2273 
2274 
2275 
2289 BGAV_PUBLIC
2290 void bgav_seek_audio(bgav_t * bgav, int stream, int64_t sample);
2291 
2305 BGAV_PUBLIC
2306 void bgav_seek_video(bgav_t * bgav, int stream, int64_t time);
2307 
2323 BGAV_PUBLIC
2324 int64_t bgav_video_keyframe_before(bgav_t * bgav, int stream, int64_t time);
2325 
2341 BGAV_PUBLIC
2342 int64_t bgav_video_keyframe_after(bgav_t * bgav, int stream, int64_t time);
2343 
2344 
2355 BGAV_PUBLIC
2356 void bgav_seek_subtitle(bgav_t * bgav, int stream, int64_t time);
2357 
2368 BGAV_PUBLIC
2369 void bgav_seek_text(bgav_t * bgav, int stream, int64_t time);
2370 
2381 BGAV_PUBLIC
2382 void bgav_seek_overlay(bgav_t * bgav, int stream, int64_t time);
2383 
2384 
2402 typedef struct bgav_stream_decoder_s bgav_stream_decoder_t;
2403 
2408 BGAV_PUBLIC
2410 
2416 BGAV_PUBLIC bgav_options_t *
2418 
2435 BGAV_PUBLIC gavl_audio_source_t *
2437  gavl_packet_source_t * src,
2438  const gavl_compression_info_t * ci,
2439  const gavl_audio_format_t * fmt,
2440  gavl_metadata_t * m);
2441 
2458 BGAV_PUBLIC gavl_video_source_t *
2460  gavl_packet_source_t * src,
2461  const gavl_compression_info_t * ci,
2462  const gavl_video_format_t * fmt,
2463  gavl_metadata_t * m);
2464 
2481 BGAV_PUBLIC gavl_video_source_t *
2483  gavl_packet_source_t * src,
2484  const gavl_compression_info_t * ci,
2485  const gavl_video_format_t * fmt,
2486  gavl_metadata_t * m);
2487 
2498 BGAV_PUBLIC int64_t
2500 
2507 BGAV_PUBLIC void
2509 
2514 BGAV_PUBLIC void
2516 
2526 BGAV_PUBLIC gavl_codec_id_t *
2528 
2537 BGAV_PUBLIC
2539 
2540 
2546 /***************************************************
2547  * Debugging functions
2548  ***************************************************/
2549 
2558 BGAV_PUBLIC
2559 void bgav_dump(bgav_t * bgav);
2560 
2561 /* Dump infos about the installed codecs */
2562 
2570 BGAV_PUBLIC
2572 
2573 /* Dump known media formats */
2574 
2582 BGAV_PUBLIC
2584 
2592 BGAV_PUBLIC
2594 
2602 BGAV_PUBLIC
2604 
2612 BGAV_PUBLIC
2614 
2615 
2616 #ifdef __cplusplus
2617 }
2618 #endif
2619 
struct bgav_stream_decoder_s bgav_stream_decoder_t
Forward declaration for a stream decoder.
Definition: avdec.h:2402
BGAV_PUBLIC gavl_codec_id_t * bgav_supported_video_compressions()
Get supported video compressions.
BGAV_PUBLIC bgav_stream_decoder_t * bgav_stream_decoder_create()
Create a stream decoder.
BGAV_PUBLIC void bgav_stream_decoder_reset(bgav_stream_decoder_t *dec)
Reset a stream decoder.
BGAV_PUBLIC gavl_video_source_t * bgav_stream_decoder_connect_overlay(bgav_stream_decoder_t *dec, gavl_packet_source_t *src, const gavl_compression_info_t *ci, const gavl_video_format_t *fmt, gavl_metadata_t *m)
Connect an overlay stream decoder.
BGAV_PUBLIC bgav_options_t * bgav_stream_decoder_get_options(bgav_stream_decoder_t *dec)
Get options for a stream decoder.
BGAV_PUBLIC void bgav_stream_decoder_destroy(bgav_stream_decoder_t *dec)
Destroy a stream decoder.
BGAV_PUBLIC gavl_video_source_t * bgav_stream_decoder_connect_video(bgav_stream_decoder_t *dec, gavl_packet_source_t *src, const gavl_compression_info_t *ci, const gavl_video_format_t *fmt, gavl_metadata_t *m)
Connect a video stream decoder.
BGAV_PUBLIC gavl_codec_id_t * bgav_supported_audio_compressions()
Get supported audio compressions.
BGAV_PUBLIC gavl_audio_source_t * bgav_stream_decoder_connect_audio(bgav_stream_decoder_t *dec, gavl_packet_source_t *src, const gavl_compression_info_t *ci, const gavl_audio_format_t *fmt, gavl_metadata_t *m)
Connect an audio stream decoder.
BGAV_PUBLIC int64_t bgav_stream_decoder_skip(bgav_stream_decoder_t *dec, int64_t t)
Skip to a specified time.
gavl_codec_id_t
BGAV_PUBLIC void bgav_subreaders_dump()
Dump informations about all available subtitle readers to stderr.
BGAV_PUBLIC void bgav_dump(bgav_t *bgav)
Dump informations of all tracks to stderr.
BGAV_PUBLIC void bgav_codecs_dump()
Dump informations about all available codecs to stderr.
BGAV_PUBLIC void bgav_inputs_dump()
Dump informations about all available input modules to stderr.
BGAV_PUBLIC void bgav_formats_dump()
Dump informations about all available format demuxers to stderr.
BGAV_PUBLIC void bgav_redirectors_dump()
Dump informations about all available redirectors to stderr.
BGAV_PUBLIC gavl_audio_source_t * bgav_get_audio_source(bgav_t *bgav, int stream)
Return the audio source for this stream.
BGAV_PUBLIC int bgav_read_subtitle_text(bgav_t *bgav, char **ret, int *ret_alloc, int64_t *start_time, int64_t *duration, int stream)
Decode a text subtitle.
BGAV_PUBLIC int bgav_has_subtitle(bgav_t *bgav, int stream)
Check, if a new subtitle is available.
BGAV_PUBLIC int bgav_read_audio(bgav_t *bgav, gavl_audio_frame_t *frame, int stream, int num_samples)
Decode audio samples.
BGAV_PUBLIC gavl_video_source_t * bgav_get_video_source(bgav_t *bgav, int stream)
Return the video source for a video stream.
BGAV_PUBLIC int bgav_video_has_still(bgav_t *bgav, int stream)
Determine if a still image is available for reading.
BGAV_PUBLIC void bgav_skip_video(bgav_t *bgav, int stream, int64_t *time, int scale, int exact)
Skip forward in a video stream.
BGAV_PUBLIC int bgav_read_subtitle_overlay(bgav_t *bgav, gavl_overlay_t *ovl, int stream)
Decode an overlay subtitle.
BGAV_PUBLIC gavl_video_source_t * bgav_get_overlay_source(bgav_t *bgav, int stream)
Return the video source for an overlay stream.
BGAV_PUBLIC int bgav_read_video(bgav_t *bgav, gavl_video_frame_t *frame, int stream)
Decode a video frame.
BGAV_PUBLIC gavl_edl_t * bgav_get_edl(bgav_t *bgav)
Get an EDL from an open decoder.
struct bgav_s bgav_t
Opaque decoder structure.
Definition: avdec.h:75
BGAV_PUBLIC void bgav_close(bgav_t *bgav)
Close a decoder and free all associated memory.
BGAV_PUBLIC bgav_t * bgav_create()
Create a decoder instance.
BGAV_PUBLIC int bgav_check_device_dvb(const char *device, char **name)
Test if a device is DVB capable.
BGAV_PUBLIC bgav_device_info_t * bgav_find_devices_dvb()
Scan for DVB capable devices.
BGAV_PUBLIC int bgav_check_device_dvd(const char *device, char **name)
Test if a device is DVD capable.
BGAV_PUBLIC const char * bgav_get_disc_name(bgav_t *bgav)
Get the name of a disc.
BGAV_PUBLIC void bgav_device_info_destroy(bgav_device_info_t *arr)
Destroy a device info array.
BGAV_PUBLIC bgav_device_info_t * bgav_find_devices_dvd()
Scan for DVD capable devices.
BGAV_PUBLIC int bgav_check_device_vcd(const char *device, char **name)
Test if a device is VCD capable.
BGAV_PUBLIC int bgav_eject_disc(const char *device)
Eject a disc.
BGAV_PUBLIC bgav_device_info_t * bgav_find_devices_vcd()
Scan for VCD capable devices.
BGAV_PUBLIC const char * bgav_metadata_get_albumartist(const bgav_metadata_t *metadata)
Get the album artist of this track.
BGAV_PUBLIC const char * bgav_metadata_get_copyright(const bgav_metadata_t *metadata)
Get the copyright notice of the track.
BGAV_PUBLIC const char * bgav_metadata_get_author(const bgav_metadata_t *metadata)
Get the author (or composer) of the track.
BGAV_PUBLIC const char * bgav_metadata_get_comment(const bgav_metadata_t *metadata)
Get an additional comment of the track.
BGAV_PUBLIC int bgav_metadata_get_track(const bgav_metadata_t *metadata)
Get the track index.
BGAV_PUBLIC const char * bgav_metadata_get_genre(const bgav_metadata_t *metadata)
Get the genre this track belongs to.
BGAV_PUBLIC const char * bgav_metadata_get_date(const bgav_metadata_t *metadata)
Get the date of the recording.
BGAV_PUBLIC const char * bgav_metadata_get_album(const bgav_metadata_t *metadata)
Get the album this track comes from.
BGAV_PUBLIC const char * bgav_metadata_get_title(const bgav_metadata_t *metadata)
Get the title of the track.
BGAV_PUBLIC const char * bgav_metadata_get_artist(const bgav_metadata_t *metadata)
Get the artist (or performer) of this track.
gavl_metadata_t bgav_metadata_t
Opaque metadata container.
Definition: avdec.h:115
BGAV_PUBLIC int bgav_open_dvb(bgav_t *bgav, const char *location)
Open a DVB device.
BGAV_PUBLIC int bgav_open(bgav_t *bgav, const char *location)
Open a file or URL.
BGAV_PUBLIC int bgav_open_dvd(bgav_t *bgav, const char *location)
Open a DVD device.
BGAV_PUBLIC int bgav_open_vcd(bgav_t *bgav, const char *location)
Open a VCD device.
BGAV_PUBLIC int bgav_open_fd(bgav_t *bgav, int fd, int64_t total_size, const char *mimetype)
Open a decoder from a filedescriptor.
BGAV_PUBLIC int bgav_open_callbacks(bgav_t *bgav, int(*read_callback)(void *priv, uint8_t *data, int len), int64_t(*seek_callback)(void *priv, int64_t pos, int whence), void *priv, const char *filename, const char *mimetype, int64_t total_bytes)
Open a decoder with callbacks.
void(* bgav_log_callback)(void *data, bgav_log_level_t level, const char *log_domain, const char *message)
Function to be called for loggins messages.
Definition: avdec.h:709
BGAV_PUBLIC void bgav_options_set_http_proxy_host(bgav_options_t *opt, const char *host)
Set proxy host.
BGAV_PUBLIC void bgav_options_set_http_proxy_port(bgav_options_t *opt, int port)
Set proxy port.
BGAV_PUBLIC void bgav_options_set_default_subtitle_encoding(bgav_options_t *opt, const char *encoding)
Set default subtitle encoding.
BGAV_PUBLIC void bgav_options_set_threads(bgav_options_t *opt, int threads)
Set number of threads.
BGAV_PUBLIC void bgav_options_set_shrink(bgav_options_t *opt, int factor)
Shrink factor.
void(* bgav_aspect_callback)(void *data, int stream, int pixel_width, int pixel_height)
Function to be called if a change of the aspect ratio was detected.
Definition: avdec.h:828
int(* bgav_user_pass_callback)(void *data, const char *resource, char **username, char **password)
Function to be called if the input module needs authentication data.
Definition: avdec.h:799
BGAV_PUBLIC void bgav_options_set_http_proxy_auth(bgav_options_t *opt, int enable)
Enable or disable proxy authentication.
BGAV_PUBLIC void bgav_options_set_network_buffer_size(bgav_options_t *opt, int size)
Set network buffer size.
BGAV_PUBLIC void bgav_options_set_prefer_ffmpeg_demuxers(bgav_options_t *opt, int prefer)
Preference of ffmpeg demultiplexers.
BGAV_PUBLIC void bgav_options_set_ftp_anonymous_password(bgav_options_t *opt, const char *pass)
Set anonymous password.
BGAV_PUBLIC bgav_options_t * bgav_get_options(bgav_t *bgav)
Get the options of a decoder instance.
BGAV_PUBLIC void bgav_options_set_seek_subtitles(bgav_options_t *opt, int seek_subtitles)
Enable external subtitle files.
BGAV_PUBLIC void bgav_options_set_cache_time(bgav_options_t *opt, int t)
Set the index creation time for caching.
BGAV_PUBLIC void bgav_options_set_log_callback(bgav_options_t *opt, bgav_log_callback callback, void *data)
Set the callback for log messages.
void(* bgav_index_callback)(void *data, float percentage)
Function to be called periodically while an index is built.
Definition: avdec.h:851
bgav_log_level_t
Enumeration for log levels.
Definition: avdec.h:694
void(* bgav_metadata_change_callback)(void *data, const bgav_metadata_t *metadata)
Function to be called if the metadata change.
Definition: avdec.h:751
BGAV_PUBLIC void bgav_options_set_dump_packets(bgav_options_t *opt, int enable)
Dump packets.
BGAV_PUBLIC void bgav_options_set_http_shoutcast_metadata(bgav_options_t *opt, int enable)
Enable or disable shoutcast metadata streaming.
struct bgav_options_s bgav_options_t
Opaque option container.
Definition: avdec.h:220
BGAV_PUBLIC void bgav_options_set_rtp_port_base(bgav_options_t *opt, int p)
Set RTP port pase.
BGAV_PUBLIC void bgav_options_set_connect_timeout(bgav_options_t *opt, int timeout)
Set connect timeout.
BGAV_PUBLIC void bgav_options_set_sample_accurate(bgav_options_t *opt, int enable)
Try to be sample accurate.
BGAV_PUBLIC void bgav_options_set_dvb_channels_file(bgav_options_t *opt, const char *file)
Set DVB channels file.
BGAV_PUBLIC void bgav_options_set_metadata_change_callback(bgav_options_t *opt, bgav_metadata_change_callback callback, void *data)
Set the callback for metadata change events.
BGAV_PUBLIC void bgav_options_set_network_bandwidth(bgav_options_t *opt, int bandwidth)
Set network bandwidth.
BGAV_PUBLIC void bgav_options_copy(bgav_options_t *dst, const bgav_options_t *src)
Copy options.
BGAV_PUBLIC void bgav_options_set_pp_level(bgav_options_t *opt, int pp_level)
Set postprocessing level.
BGAV_PUBLIC void bgav_options_set_postprocessing_level(bgav_options_t *opt, float pp_level)
Set postprocessing level.
BGAV_PUBLIC void bgav_options_set_dv_datetime(bgav_options_t *opt, int datetime)
Exports the date and time as timecode field of DV streams.
BGAV_PUBLIC void bgav_options_set_aspect_callback(bgav_options_t *opt, bgav_aspect_callback callback, void *data)
Set aspect ratio change callback.
BGAV_PUBLIC void bgav_options_set_ftp_anonymous(bgav_options_t *opt, int enable)
Enable or disable anonymous ftp login.
BGAV_PUBLIC void bgav_options_set_vdpau(bgav_options_t *opt, int vdpau)
VDPAU acceleration.
BGAV_PUBLIC void bgav_options_set_read_timeout(bgav_options_t *opt, int timeout)
Set read timeout.
BGAV_PUBLIC void bgav_options_set_http_proxy_pass(bgav_options_t *opt, const char *pass)
Set proxy password.
void(* bgav_buffer_callback)(void *data, float percentage)
Function to be called if the input module is buffering data.
Definition: avdec.h:774
BGAV_PUBLIC void bgav_options_set_http_proxy_user(bgav_options_t *opt, const char *user)
Set proxy username.
BGAV_PUBLIC void bgav_options_set_audio_dynrange(bgav_options_t *opt, int audio_dynrange)
Enable dynamic range control.
BGAV_PUBLIC void bgav_options_set_index_callback(bgav_options_t *opt, bgav_index_callback callback, void *data)
Set index build callback.
BGAV_PUBLIC void bgav_options_set_rtp_try_tcp(bgav_options_t *opt, int enable)
Try TCP before UDP.
BGAV_PUBLIC void bgav_options_set_cache_size(bgav_options_t *opt, int s)
Set the maximum total size of the index cache.
BGAV_PUBLIC void bgav_options_set_dump_headers(bgav_options_t *opt, int enable)
Dump file headers.
BGAV_PUBLIC void bgav_options_set_log_level(bgav_options_t *opt, int level)
Set the verbosity for log messages.
BGAV_PUBLIC void bgav_options_destroy(bgav_options_t *opt)
Destroy option cotainer.
BGAV_PUBLIC void bgav_options_set_buffer_callback(bgav_options_t *opt, bgav_buffer_callback callback, void *data)
Set the callback for buffering notification.
BGAV_PUBLIC void bgav_options_set_user_pass_callback(bgav_options_t *opt, bgav_user_pass_callback callback, void *data)
Set the callback for user authentication.
BGAV_PUBLIC bgav_options_t * bgav_options_create()
Create an options container.
BGAV_PUBLIC void bgav_options_set_dump_indices(bgav_options_t *opt, int enable)
Dump file indices.
BGAV_PUBLIC void bgav_options_set_http_use_proxy(bgav_options_t *opt, int enable)
Set proxy usage.
BGAV_PUBLIC gavl_packet_source_t * bgav_get_overlay_packet_source(bgav_t *bgav, int stream)
Get a packet source for an overlay stream.
BGAV_PUBLIC int bgav_get_overlay_compression_info(bgav_t *bgav, int stream, gavl_compression_info_t *info)
Get overlay compression info.
BGAV_PUBLIC gavl_packet_source_t * bgav_get_audio_packet_source(bgav_t *bgav, int stream)
Get a packet source for an audio stream.
BGAV_PUBLIC gavl_packet_source_t * bgav_get_video_packet_source(bgav_t *bgav, int stream)
Get a packet source for a video stream.
BGAV_PUBLIC gavl_packet_source_t * bgav_get_text_packet_source(bgav_t *bgav, int stream)
Get a packet source for a text subtitle stream.
BGAV_PUBLIC int bgav_get_audio_compression_info(bgav_t *bgav, int stream, gavl_compression_info_t *info)
Get audio compression info.
BGAV_PUBLIC int bgav_read_audio_packet(bgav_t *bgav, int stream, gavl_packet_t *p)
Read compressed audio packet.
BGAV_PUBLIC int bgav_read_video_packet(bgav_t *bgav, int stream, gavl_packet_t *p)
Read compressed video packet.
BGAV_PUBLIC int bgav_get_video_compression_info(bgav_t *bgav, int stream, gavl_compression_info_t *info)
Get video compression info.
BGAV_PUBLIC const char * bgav_redirector_get_url(bgav_t *bgav, int index)
Get the address of an URL.
BGAV_PUBLIC int bgav_is_redirector(bgav_t *bgav)
Query if the decoder opened a redirector.
BGAV_PUBLIC const char * bgav_redirector_get_name(bgav_t *bgav, int index)
Get the address of an URL.
BGAV_PUBLIC const gavl_metadata_t * bgav_redirector_get_metadata(bgav_t *b, int index)
Get the metadata for an URL.
BGAV_PUBLIC int bgav_redirector_get_num_urls(bgav_t *bgav)
Get the number of URLs found in the redirector.
BGAV_PUBLIC void bgav_seek_overlay(bgav_t *bgav, int stream, int64_t time)
Seek to a specific overlay position.
BGAV_PUBLIC int64_t bgav_text_duration(bgav_t *bgav, int stream)
Get the text duration.
BGAV_PUBLIC void bgav_seek_video(bgav_t *bgav, int stream, int64_t time)
Seek to a specific video time.
BGAV_PUBLIC int64_t bgav_overlay_duration(bgav_t *bgav, int stream)
Get the overlay duration.
BGAV_PUBLIC void bgav_seek_audio(bgav_t *bgav, int stream, int64_t sample)
Seek to a specific audio sample.
BGAV_PUBLIC int64_t bgav_audio_duration(bgav_t *bgav, int stream)
Get the audio duration.
BGAV_PUBLIC int64_t bgav_video_start_time(bgav_t *bgav, int stream)
Get the video start time.
BGAV_PUBLIC void bgav_seek_text(bgav_t *bgav, int stream, int64_t time)
Seek to a specific text position.
BGAV_PUBLIC int64_t bgav_video_duration(bgav_t *bgav, int stream)
Get the video duration.
BGAV_PUBLIC int64_t bgav_video_keyframe_after(bgav_t *bgav, int stream, int64_t time)
Get the time of the closest keyframe after a given time.
BGAV_PUBLIC void bgav_seek_subtitle(bgav_t *bgav, int stream, int64_t time)
Seek to a specific subtitle position.
BGAV_PUBLIC int64_t bgav_video_keyframe_before(bgav_t *bgav, int stream, int64_t time)
Get the time of the closest keyframe before a given time.
BGAV_PUBLIC int64_t bgav_audio_start_time(bgav_t *bgav, int stream)
Get the audio start time.
BGAV_PUBLIC int bgav_can_seek_sample(bgav_t *bgav)
Check if a track is seekabkle with sample accuracy.
BGAV_PUBLIC int64_t bgav_subtitle_duration(bgav_t *bgav, int stream)
Get the subtitle duration.
BGAV_PUBLIC void bgav_seek_scaled(bgav_t *bgav, int64_t *time, int scale)
Seek to a specific stream position.
BGAV_PUBLIC void bgav_seek(bgav_t *bgav, gavl_time_t *time)
Seek to a specific time.
BGAV_PUBLIC int bgav_can_seek(bgav_t *bgav)
Check if a track is seekabkle.
BGAV_PUBLIC int bgav_start(bgav_t *bgav)
Start all codecs.
BGAV_PUBLIC const gavl_video_format_t * bgav_get_video_format(bgav_t *bgav, int stream)
Get the format of a video stream.
BGAV_PUBLIC const char * bgav_get_audio_description(bgav_t *bgav, int stream)
Get the description of an audio stream.
BGAV_PUBLIC const char * bgav_get_subtitle_info(bgav_t *bgav, int stream)
Get additional info about a subtitle stream.
BGAV_PUBLIC const gavl_video_format_t * bgav_get_overlay_format(bgav_t *bgav, int stream)
Get the format of an overlay stream.
BGAV_PUBLIC const gavl_audio_format_t * bgav_get_audio_format(bgav_t *bgav, int stream)
Get the format of an audio stream.
BGAV_PUBLIC int bgav_subtitle_is_text(bgav_t *bgav, int stream)
Check if a subtitle is text or graphics based.
BGAV_PUBLIC const char * bgav_get_video_description(bgav_t *bgav, int stream)
Get the description of a video stream.
BGAV_PUBLIC const char * bgav_get_audio_info(bgav_t *bgav, int stream)
Get additional info about an audio stream.
BGAV_PUBLIC int bgav_can_pause(bgav_t *bgav)
Query if a track is pausable.
BGAV_PUBLIC const char * bgav_get_subtitle_description(bgav_t *bgav, int stream)
Get the description of a subtitle stream.
BGAV_PUBLIC const gavl_video_format_t * bgav_get_subtitle_format(bgav_t *bgav, int stream)
Get the video format of a subtitle stream.
BGAV_PUBLIC gavl_frame_table_t * bgav_get_frame_table(bgav_t *bgav, int stream)
Get the frame table of a video stream.
BGAV_PUBLIC int bgav_get_text_timescale(bgav_t *bgav, int stream)
Get the timescale for a text stream.
BGAV_PUBLIC int bgav_get_audio_bitrate(bgav_t *bgav, int stream)
Get the bitrate of an audio stream.
BGAV_PUBLIC int bgav_set_audio_stream(bgav_t *bgav, int stream, bgav_stream_action_t action)
Select mode for an audio stream.
BGAV_PUBLIC const char * bgav_get_audio_language(bgav_t *bgav, int stream)
Get the language of an audio stream.
BGAV_PUBLIC int bgav_set_overlay_stream(bgav_t *bgav, int stream, bgav_stream_action_t action)
Select mode for an overlay stream.
BGAV_PUBLIC int bgav_set_video_stream(bgav_t *bgav, int stream, bgav_stream_action_t action)
Select mode for a video stream.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_text_metadata(bgav_t *b, int stream)
Get the metadata of a text stream.
BGAV_PUBLIC int bgav_set_text_stream(bgav_t *bgav, int stream, bgav_stream_action_t action)
Select mode for a text stream.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_video_metadata(bgav_t *bgav, int stream)
Get the metadata of a video stream.
BGAV_PUBLIC const char * bgav_get_subtitle_language(bgav_t *bgav, int stream)
Get the language of a subtitle stream.
bgav_stream_action_t
Stream action.
Definition: avdec.h:1442
BGAV_PUBLIC const bgav_metadata_t * bgav_get_overlay_metadata(bgav_t *b, int stream)
Get the metadata of an overlay stream.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_subtitle_metadata(bgav_t *bgav, int stream)
Get the metadata of a subtitle stream.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_audio_metadata(bgav_t *bgav, int stream)
Get the metadata of an audio stream.
BGAV_PUBLIC int bgav_set_subtitle_stream(bgav_t *bgav, int stream, bgav_stream_action_t action)
Select mode for a subtitle stream.
@ BGAV_STREAM_READRAW
Definition: avdec.h:1446
@ BGAV_STREAM_MUTE
Definition: avdec.h:1443
@ BGAV_STREAM_PARSE
Definition: avdec.h:1445
@ BGAV_STREAM_DECODE
Definition: avdec.h:1444
int64_t gavl_time_t
BGAV_PUBLIC const char * bgav_get_track_name(bgav_t *bgav, int track)
Get the name a track.
BGAV_PUBLIC gavl_time_t bgav_get_duration(bgav_t *bgav, int track)
Get the duration of a track.
BGAV_PUBLIC const char * bgav_get_chapter_name(bgav_t *bgav, int track, int chapter)
Get the name of a chapter.
BGAV_PUBLIC const gavl_chapter_list_t * bgav_get_chapter_list(bgav_t *bgav, int track)
Get the chapter list.
BGAV_PUBLIC int bgav_get_num_chapters(bgav_t *bgav, int track, int *timescale)
Get the number of chapters.
BGAV_PUBLIC const char * bgav_get_description(bgav_t *bgav)
Get a technical description of the format.
BGAV_PUBLIC int bgav_select_track(bgav_t *bgav, int track)
Select a track.
BGAV_PUBLIC int bgav_num_video_streams(bgav_t *bgav, int track)
Get the number of video streams of a track.
BGAV_PUBLIC int bgav_num_audio_streams(bgav_t *bgav, int track)
Get the number of audio streams of a track.
BGAV_PUBLIC int bgav_num_text_streams(bgav_t *bgav, int track)
Get the number of text streams of a track.
BGAV_PUBLIC int bgav_num_overlay_streams(bgav_t *bgav, int track)
Get the number of overlay streams of a track.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_metadata(bgav_t *bgav, int track)
Get metadata for a track.
BGAV_PUBLIC int64_t bgav_get_chapter_time(bgav_t *bgav, int track, int chapter)
Get the name of a chapter.
BGAV_PUBLIC int bgav_num_subtitle_streams(bgav_t *bgav, int track)
Get the number of subtitle streams of a track.
BGAV_PUBLIC int bgav_num_tracks(bgav_t *bgav)
Get the number of tracks.
Info structure for a device.
Definition: avdec.h:886
char * name
Definition: avdec.h:888
char * device
Definition: avdec.h:887