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 - 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 /* Public entry points */
23 
29 #include <gavl/gavl.h>
30 #include <gavl/compression.h>
31 #include <gavl/metadata.h>
32 
33 #include "bgavdefs.h" // This is ugly, but works
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
43 typedef struct bgav_edl_s bgav_edl_t;
44 
78 typedef struct bgav_s bgav_t;
79 
85 BGAV_PUBLIC
87 
118 typedef gavl_metadata_t bgav_metadata_t;
119 
126 BGAV_PUBLIC
127 const char * bgav_metadata_get_author(const bgav_metadata_t*metadata);
128 
135 BGAV_PUBLIC
136 const char * bgav_metadata_get_title(const bgav_metadata_t * metadata);
137 
144 BGAV_PUBLIC
145 const char * bgav_metadata_get_comment(const bgav_metadata_t * metadata);
146 
153 BGAV_PUBLIC
154 const char * bgav_metadata_get_copyright(const bgav_metadata_t * metadata);
155 
162 BGAV_PUBLIC
163 const char * bgav_metadata_get_album(const bgav_metadata_t * metadata);
164 
171 BGAV_PUBLIC
172 const char * bgav_metadata_get_artist(const bgav_metadata_t * metadata);
173 
180 BGAV_PUBLIC
181 const char * bgav_metadata_get_albumartist(const bgav_metadata_t * metadata);
182 
189 BGAV_PUBLIC
190 const char * bgav_metadata_get_genre(const bgav_metadata_t * metadata);
191 
198 BGAV_PUBLIC
199 const char * bgav_metadata_get_date(const bgav_metadata_t * metadata);
200 
207 BGAV_PUBLIC
208 int bgav_metadata_get_track(const bgav_metadata_t * metadata);
209 
210 /***************************************************
211  * Housekeeping Functions
212  ***************************************************/
213 
214 /***************************************************
215  * Set parameters
216  ***************************************************/
217 
218 
223 typedef struct bgav_options_s bgav_options_t;
224 
234 BGAV_PUBLIC
236 
251 BGAV_PUBLIC
253 
263 BGAV_PUBLIC
265 
272 BGAV_PUBLIC
273 void bgav_options_copy(bgav_options_t * dst, const bgav_options_t * src);
274 
284 BGAV_PUBLIC
285 void bgav_options_set_connect_timeout(bgav_options_t * opt, int timeout);
286 
296 BGAV_PUBLIC
297 void bgav_options_set_read_timeout(bgav_options_t * opt, int timeout);
298 
313 BGAV_PUBLIC
315 
325 BGAV_PUBLIC
326 void bgav_options_set_rtp_try_tcp(bgav_options_t * opt, int enable);
327 
337 BGAV_PUBLIC
338 void bgav_options_set_network_bandwidth(bgav_options_t * opt, int bandwidth);
339 
349 BGAV_PUBLIC
351 
352 /* HTTP Options */
353 
364 BGAV_PUBLIC
365 void bgav_options_set_http_use_proxy(bgav_options_t* opt, int enable);
366 
376 BGAV_PUBLIC
377 void bgav_options_set_http_proxy_host(bgav_options_t* opt, const char * host);
378 
388 BGAV_PUBLIC
390 
401 BGAV_PUBLIC
402 void bgav_options_set_http_proxy_auth(bgav_options_t* opt, int enable);
403 
412 BGAV_PUBLIC
413 void bgav_options_set_http_proxy_user(bgav_options_t* opt, const char * user);
414 
423 BGAV_PUBLIC
424 void bgav_options_set_http_proxy_pass(bgav_options_t* opt, const char * pass);
425 
434 BGAV_PUBLIC
436 
437 /* Set FTP options */
438 
445 BGAV_PUBLIC
446 void bgav_options_set_ftp_anonymous(bgav_options_t* opt, int enable);
447 
456 BGAV_PUBLIC
457 void bgav_options_set_ftp_anonymous_password(bgav_options_t* opt, const char* pass);
458 
470 BGAV_PUBLIC
472  const char* encoding);
473 
484 BGAV_PUBLIC
486  int audio_dynrange);
487 
488 
502 BGAV_PUBLIC
504 
516 BGAV_PUBLIC
518 
528 BGAV_PUBLIC
530 
546 BGAV_PUBLIC
548  int seek_subtitles);
549 
559 BGAV_PUBLIC
561  int pp_level);
562 
571 BGAV_PUBLIC
573  float pp_level);
574 
583 BGAV_PUBLIC
584 void bgav_options_set_threads(bgav_options_t * opt, int threads);
585 
586 
598 BGAV_PUBLIC
600  const char * file);
601 
613 BGAV_PUBLIC
615  int prefer);
616 
623 BGAV_PUBLIC
625  int datetime);
626 
636 BGAV_PUBLIC
638  int factor);
639 
648 BGAV_PUBLIC
650  int vdpau);
651 
660 BGAV_PUBLIC
662  int enable);
663 
672 BGAV_PUBLIC
674  int enable);
675 
676 
677 
684 typedef enum
685  {
686  BGAV_LOG_DEBUG = (1<<0),
687  BGAV_LOG_WARNING = (1<<1),
688  BGAV_LOG_ERROR = (1<<2),
689  BGAV_LOG_INFO = (1<<3)
691 
700 typedef void (*bgav_log_callback)(void*data, bgav_log_level_t level,
701  const char * log_domain,
702  const char * message);
703 
711 BGAV_PUBLIC void
713  bgav_log_callback callback,
714  void * data);
715 
724 BGAV_PUBLIC void
726  int level);
727 
728 
729 
730 /* Set callbacks */
731 
741 typedef void (*bgav_name_change_callback)(void*data, const char * name);
742 
750 BGAV_PUBLIC void
752  bgav_name_change_callback callback,
753  void * data);
754 
765 typedef void (*bgav_metadata_change_callback)(void*data, const bgav_metadata_t * metadata);
766 
774 BGAV_PUBLIC void
777  void * data);
778 
788 typedef void (*bgav_buffer_callback)(void*data, float percentage);
789 
797 BGAV_PUBLIC void
799  bgav_buffer_callback callback,
800  void * data);
801 
813 typedef int (*bgav_user_pass_callback)(void*data, const char * resource,
814  char ** username, char ** password);
815 
827 BGAV_PUBLIC void
829  bgav_user_pass_callback callback,
830  void * data);
831 
842 typedef void (*bgav_aspect_callback)(void*data, int stream,
843  int pixel_width, int pixel_height);
844 
845 
853 BGAV_PUBLIC void
855  bgav_aspect_callback callback,
856  void * data);
857 
865 typedef void (*bgav_index_callback)(void*data, float percentage);
866 
874 BGAV_PUBLIC void
876  bgav_index_callback callback,
877  void * data);
878 
879 
880 /* Device description */
881 
899 typedef struct
900  {
901  char * device;
902  char * name;
904 
905 /* Scan for devices */
906 
914 BGAV_PUBLIC
916 
924 BGAV_PUBLIC
925 int bgav_check_device_vcd(const char * device, char ** name);
926 
934 BGAV_PUBLIC
936 
944 BGAV_PUBLIC
945 int bgav_check_device_dvd(const char * device, char ** name);
946 
954 BGAV_PUBLIC
956 
964 BGAV_PUBLIC
965 int bgav_check_device_dvb(const char * device, char ** name);
966 
973 BGAV_PUBLIC
975 
982 BGAV_PUBLIC
983 int bgav_eject_disc(const char * device);
984 
991 BGAV_PUBLIC
992 const char * bgav_get_disc_name(bgav_t * bgav);
993 
994 /******************************************************
995  * Open
996  ******************************************************/
997 
998 /* Open a file or URL, return 1 on success */
999 
1007 BGAV_PUBLIC
1008 int bgav_open(bgav_t * bgav, const char * location);
1009 
1017 BGAV_PUBLIC
1018 int bgav_open_vcd(bgav_t * bgav, const char * location);
1019 
1027 BGAV_PUBLIC
1028 int bgav_open_dvd(bgav_t * bgav, const char * location);
1029 
1041 BGAV_PUBLIC
1042 int bgav_open_dvb(bgav_t * bgav, const char * location);
1043 
1044 
1054 BGAV_PUBLIC
1055 int bgav_open_fd(bgav_t * bgav, int fd,
1056  int64_t total_size,
1057  const char * mimetype);
1058 
1071 BGAV_PUBLIC
1072 int bgav_open_callbacks(bgav_t * bgav,
1073  int (*read_callback)(void * priv, uint8_t * data, int len),
1074  int64_t (*seek_callback)(void * priv, uint64_t pos, int whence),
1075  void * priv,
1076  const char * filename, const char * mimetype, int64_t total_bytes);
1077 
1078 
1079 /* Close and destroy everything */
1080 
1086 BGAV_PUBLIC
1087 void bgav_close(bgav_t * bgav);
1088 
1113 typedef struct
1114  {
1115  char * url;
1116 
1117  int track;
1118  int stream;
1120 
1121  int64_t src_time;
1122 
1123  /* Time and duration within the destination in destination
1124  timescale */
1125  int64_t dst_time;
1126  int64_t dst_duration;
1127 
1128  /* */
1129  int32_t speed_num;
1130  int32_t speed_den;
1131 
1133 
1137 typedef struct
1138  {
1143 
1147 typedef struct
1148  {
1149  char * name;
1150  bgav_metadata_t * metadata;
1151 
1154 
1157 
1160 
1163 
1164  } bgav_edl_track_t;
1165 
1170  {
1173  char * url;
1174  };
1175 
1182 BGAV_PUBLIC
1183 bgav_edl_t * bgav_get_edl(bgav_t * bgav);
1184 
1189 BGAV_PUBLIC
1190 void bgav_edl_dump(const bgav_edl_t * e);
1191 
1196 /***************************************************
1197  * Check for redirecting: You MUST check if you opened
1198  * a redirector, because reading data from redirectors
1199  * crashes
1200  * After you read the URLs, close the bgav_t object
1201  * and open a new one with one of the URLs.
1202  ***************************************************/
1203 
1226 BGAV_PUBLIC
1227 int bgav_is_redirector(bgav_t * bgav);
1228 
1235 BGAV_PUBLIC
1237 
1245 BGAV_PUBLIC
1246 const char * bgav_redirector_get_url(bgav_t * bgav, int index);
1247 
1255 BGAV_PUBLIC
1256 const char * bgav_redirector_get_name(bgav_t * bgav, int index);
1257 
1258 /***************************************************
1259  * Get information about the file
1260  ***************************************************/
1261 
1275 BGAV_PUBLIC
1276 int bgav_num_tracks(bgav_t * bgav);
1277 
1284 BGAV_PUBLIC
1285 const char * bgav_get_description(bgav_t * bgav);
1286 
1294 BGAV_PUBLIC
1295 gavl_time_t bgav_get_duration(bgav_t * bgav, int track);
1296 
1297 /* Query stream numbers */
1298 
1306 BGAV_PUBLIC
1307 int bgav_num_audio_streams(bgav_t * bgav, int track);
1308 
1316 BGAV_PUBLIC
1317 int bgav_num_video_streams(bgav_t * bgav, int track);
1318 
1326 BGAV_PUBLIC
1327 int bgav_num_subtitle_streams(bgav_t * bgav, int track);
1328 
1329 
1337 BGAV_PUBLIC
1338 const char * bgav_get_track_name(bgav_t * bgav, int track);
1339 
1347 BGAV_PUBLIC
1348 const bgav_metadata_t * bgav_get_metadata(bgav_t * bgav,int track);
1349 
1361 BGAV_PUBLIC
1362 int bgav_select_track(bgav_t * bgav, int track);
1363 
1376 BGAV_PUBLIC
1377 int bgav_get_num_chapters(bgav_t * bgav, int track, int * timescale);
1378 
1387 BGAV_PUBLIC const char *
1388 bgav_get_chapter_name(bgav_t * bgav, int track, int chapter);
1389 
1398 BGAV_PUBLIC
1399 int64_t bgav_get_chapter_time(bgav_t * bgav, int track, int chapter);
1400 
1416 BGAV_PUBLIC
1417 const char * bgav_get_audio_language(bgav_t * bgav, int stream);
1418 
1426 BGAV_PUBLIC
1427 int bgav_get_audio_bitrate(bgav_t * bgav, int stream);
1428 
1436 BGAV_PUBLIC
1437 const bgav_metadata_t *
1438 bgav_get_audio_metadata(bgav_t * bgav, int stream);
1439 
1447 BGAV_PUBLIC
1448 const char * bgav_get_subtitle_language(bgav_t * bgav, int stream);
1449 
1457 BGAV_PUBLIC
1458 const bgav_metadata_t *
1459 bgav_get_subtitle_metadata(bgav_t * bgav, int stream);
1460 
1468 BGAV_PUBLIC
1469 const bgav_metadata_t *
1470 bgav_get_video_metadata(bgav_t * bgav, int stream);
1471 
1472 
1480 typedef enum
1481  {
1486  }
1488 
1519 BGAV_PUBLIC
1520 int bgav_get_audio_compression_info(bgav_t * bgav, int stream,
1521  gavl_compression_info_t * info);
1522 
1535 BGAV_PUBLIC
1536 int bgav_get_video_compression_info(bgav_t * bgav, int stream,
1537  gavl_compression_info_t * info);
1538 
1550 BGAV_PUBLIC
1551 int bgav_read_audio_packet(bgav_t * bgav, int stream, gavl_packet_t * p);
1552 
1564 BGAV_PUBLIC
1565 int bgav_read_video_packet(bgav_t * bgav, int stream, gavl_packet_t * p);
1566 
1567 
1568 
1579 BGAV_PUBLIC
1580 int bgav_set_audio_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
1581 
1592 BGAV_PUBLIC
1593 int bgav_set_video_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
1594 
1605 BGAV_PUBLIC
1606 int bgav_set_subtitle_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
1607 
1608 /***************************************************
1609  * Stream handling functions
1610  ***************************************************/
1611 
1612 /*
1613  * You MUST these, if you want to decode anything.
1614  * After bgav_open(), all streams are switched off by
1615  * default
1616  */
1617 
1618 
1632 BGAV_PUBLIC
1633 int bgav_start(bgav_t * bgav);
1634 
1650 BGAV_PUBLIC
1651 const gavl_audio_format_t * bgav_get_audio_format(bgav_t * bgav, int stream);
1652 
1669 BGAV_PUBLIC
1670 const gavl_video_format_t * bgav_get_video_format(bgav_t * bgav, int stream);
1671 
1691 BGAV_PUBLIC
1692 gavl_frame_table_t * bgav_get_frame_table(bgav_t * bgav, int stream);
1693 
1694 
1712 BGAV_PUBLIC const gavl_video_format_t *
1713 bgav_get_subtitle_format(bgav_t * bgav, int stream);
1714 
1725 BGAV_PUBLIC
1726 int bgav_subtitle_is_text(bgav_t * bgav, int stream);
1727 
1739 BGAV_PUBLIC
1740 const char * bgav_get_audio_description(bgav_t * bgav, int stream);
1741 
1756 BGAV_PUBLIC
1757 const char * bgav_get_audio_info(bgav_t * bgav, int stream);
1758 
1759 
1771 BGAV_PUBLIC
1772 const char * bgav_get_video_description(bgav_t * bgav, int stream);
1773 
1785 BGAV_PUBLIC
1786 const char * bgav_get_subtitle_description(bgav_t * bgav, int stream);
1787 
1788 
1803 BGAV_PUBLIC
1804 const char * bgav_get_subtitle_info(bgav_t * bgav, int stream);
1805 
1815 BGAV_PUBLIC
1816 int bgav_can_pause(bgav_t * bgav);
1817 
1818 /***************************************************
1819  * Decoding functions
1820  ***************************************************/
1821 
1843 BGAV_PUBLIC
1844 int bgav_video_has_still(bgav_t * bgav, int stream);
1845 
1854 BGAV_PUBLIC
1855 int bgav_read_video(bgav_t * bgav, gavl_video_frame_t * frame, int stream);
1856 
1870 BGAV_PUBLIC
1871 void bgav_skip_video(bgav_t * bgav, int stream,
1872  int64_t * time, int scale,
1873  int exact);
1874 
1875 
1885 BGAV_PUBLIC
1886 int bgav_read_audio(bgav_t * bgav, gavl_audio_frame_t * frame, int stream,
1887  int num_samples);
1888 
1900 BGAV_PUBLIC
1901 int bgav_has_subtitle(bgav_t * bgav, int stream);
1902 
1918 BGAV_PUBLIC
1919 int bgav_read_subtitle_overlay(bgav_t * bgav, gavl_overlay_t * ovl, int stream);
1920 
1940 BGAV_PUBLIC
1941 int bgav_read_subtitle_text(bgav_t * bgav, char ** ret, int *ret_alloc,
1942  int64_t * start_time, int64_t * duration,
1943  int stream);
1944 
1945 /***************************************************
1946  * Seek to a timestamp. This also resyncs all streams
1947  ***************************************************/
1948 
1985 BGAV_PUBLIC
1986 int bgav_can_seek(bgav_t * bgav);
1987 
1996 BGAV_PUBLIC
1997 void bgav_seek(bgav_t * bgav, gavl_time_t * time);
1998 
1999 
2023 BGAV_PUBLIC
2024 void bgav_seek_scaled(bgav_t * bgav, int64_t * time, int scale);
2025 
2030 #define BGAV_TIMESTAMP_UNDEFINED GAVL_TIME_UNDEFINED // Don't change this
2031 
2047 BGAV_PUBLIC
2048 int bgav_can_seek_sample(bgav_t * bgav);
2049 
2050 
2063 BGAV_PUBLIC
2064 int64_t bgav_audio_duration(bgav_t * bgav, int stream);
2065 
2077 BGAV_PUBLIC
2078 int64_t bgav_audio_start_time(bgav_t * bgav, int stream);
2079 
2092 BGAV_PUBLIC
2093 int64_t bgav_video_duration(bgav_t * bgav, int stream);
2094 
2106 BGAV_PUBLIC
2107 int64_t bgav_video_start_time(bgav_t * bgav, int stream);
2108 
2109 
2119 BGAV_PUBLIC
2120 int64_t bgav_subtitle_duration(bgav_t * bgav, int stream);
2121 
2135 BGAV_PUBLIC
2136 void bgav_seek_audio(bgav_t * bgav, int stream, int64_t sample);
2137 
2151 BGAV_PUBLIC
2152 void bgav_seek_video(bgav_t * bgav, int stream, int64_t time);
2153 
2169 BGAV_PUBLIC
2170 int64_t bgav_video_keyframe_before(bgav_t * bgav, int stream, int64_t time);
2171 
2187 BGAV_PUBLIC
2188 int64_t bgav_video_keyframe_after(bgav_t * bgav, int stream, int64_t time);
2189 
2190 
2201 BGAV_PUBLIC
2202 void bgav_seek_subtitle(bgav_t * bgav, int stream, int64_t time);
2203 
2204 
2205 /***************************************************
2206  * Debugging functions
2207  ***************************************************/
2208 
2217 BGAV_PUBLIC
2218 void bgav_dump(bgav_t * bgav);
2219 
2220 /* Dump infos about the installed codecs */
2221 
2229 BGAV_PUBLIC
2230 void bgav_codecs_dump();
2231 
2232 /* Dump known media formats */
2233 
2241 BGAV_PUBLIC
2242 void bgav_formats_dump();
2243 
2251 BGAV_PUBLIC
2252 void bgav_inputs_dump();
2253 
2261 BGAV_PUBLIC
2262 void bgav_redirectors_dump();
2263 
2271 BGAV_PUBLIC
2272 void bgav_subreaders_dump();
2273 
2274 
2275 #ifdef __cplusplus
2276 }
2277 #endif
2278 
BGAV_PUBLIC int bgav_set_subtitle_stream(bgav_t *bgav, int stream, bgav_stream_action_t action)
Select mode for a subtitle stream.
BGAV_PUBLIC int bgav_subtitle_is_text(bgav_t *bgav, int stream)
Check if a subtitle is text or graphics based.
gavl_metadata_t bgav_metadata_t
Opaque metadata container.
Definition: avdec.h:118
BGAV_PUBLIC void bgav_inputs_dump()
Dump informations about all available input modules to stderr.
BGAV_PUBLIC int bgav_check_device_dvb(const char *device, char **name)
Test if a device is DVB capable.
BGAV_PUBLIC const char * bgav_get_video_description(bgav_t *bgav, int stream)
Get the description of a video stream.
char * device
Definition: avdec.h:901
BGAV_PUBLIC void bgav_options_set_network_bandwidth(bgav_options_t *opt, int bandwidth)
Set network bandwidth.
BGAV_PUBLIC void bgav_seek_video(bgav_t *bgav, int stream, int64_t time)
Seek to a specific video time.
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_dump(bgav_t *bgav)
Dump informations of all tracks to stderr.
BGAV_PUBLIC const char * bgav_get_chapter_name(bgav_t *bgav, int track, int chapter)
Get the name of a chapter.
bgav_edl_track_t * tracks
Logical tracks.
Definition: avdec.h:1172
BGAV_PUBLIC bgav_device_info_t * bgav_find_devices_vcd()
Scan for VCD capable devices.
BGAV_PUBLIC bgav_device_info_t * bgav_find_devices_dvb()
Scan for DVB capable devices.
BGAV_PUBLIC int bgav_read_subtitle_overlay(bgav_t *bgav, gavl_overlay_t *ovl, int stream)
Decode an overlay subtitle.
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 const gavl_audio_format_t * bgav_get_audio_format(bgav_t *bgav, int stream)
Get the format of an audio stream.
BGAV_PUBLIC void bgav_options_set_pp_level(bgav_options_t *opt, int pp_level)
Set postprocessing level.
bgav_edl_stream_t * audio_streams
Logical audio streams.
Definition: avdec.h:1153
BGAV_PUBLIC int bgav_get_num_chapters(bgav_t *bgav, int track, int *timescale)
Get the number of chapters.
BGAV_PUBLIC int bgav_can_seek(bgav_t *bgav)
Check if a track is seekabkle.
BGAV_PUBLIC const char * bgav_get_track_name(bgav_t *bgav, int track)
Get the name a track.
void(* bgav_metadata_change_callback)(void *data, const bgav_metadata_t *metadata)
Function to be called if the metadata change.
Definition: avdec.h:765
BGAV_PUBLIC void bgav_options_set_http_use_proxy(bgav_options_t *opt, int enable)
Set proxy usage.
BGAV_PUBLIC void bgav_options_set_vdpau(bgav_options_t *opt, int vdpau)
VDPAU acceleration.
bgav_metadata_t * metadata
Metadata (optional)
Definition: avdec.h:1150
BGAV_PUBLIC void bgav_options_set_log_callback(bgav_options_t *opt, bgav_log_callback callback, void *data)
Set the callback for log messages.
BGAV_PUBLIC const char * bgav_get_subtitle_language(bgav_t *bgav, int stream)
Get the language of a subtitle stream.
BGAV_PUBLIC const char * bgav_get_audio_description(bgav_t *bgav, int stream)
Get the description of an audio stream.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_metadata(bgav_t *bgav, int track)
Get metadata for a track.
A locical stream.
Definition: avdec.h:1137
BGAV_PUBLIC int bgav_check_device_vcd(const char *device, char **name)
Test if a device is VCD capable.
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_audio_bitrate(bgav_t *bgav, int stream)
Get the bitrate of an audio stream.
int32_t speed_num
Playback speed numerator.
Definition: avdec.h:1129
char * name
Name (optional)
Definition: avdec.h:1149
BGAV_PUBLIC void bgav_options_set_sample_accurate(bgav_options_t *opt, int enable)
Try to be sample accurate.
BGAV_PUBLIC int bgav_is_redirector(bgav_t *bgav)
Query if the decoder opened a redirector.
BGAV_PUBLIC bgav_options_t * bgav_get_options(bgav_t *bgav)
Get the options of a decoder instance.
BGAV_PUBLIC void bgav_options_set_shrink(bgav_options_t *opt, int factor)
Shrink factor.
int64_t dst_time
Time within the destination in destination timescale.
Definition: avdec.h:1125
struct bgav_s bgav_t
Opaque decoder structure.
Definition: avdec.h:78
BGAV_PUBLIC void bgav_options_destroy(bgav_options_t *opt)
Destroy option cotainer.
BGAV_PUBLIC void bgav_seek_audio(bgav_t *bgav, int stream, int64_t sample)
Seek to a specific audio sample.
bgav_edl_segment_t * segments
Segments.
Definition: avdec.h:1139
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_buffer_callback(bgav_options_t *opt, bgav_buffer_callback callback, void *data)
Set the callback for buffering notification.
BGAV_PUBLIC void bgav_device_info_destroy(bgav_device_info_t *arr)
Destroy a device info array.
BGAV_PUBLIC void bgav_close(bgav_t *bgav)
Close a decoder and free all associated memory.
BGAV_PUBLIC void bgav_options_set_ftp_anonymous_password(bgav_options_t *opt, const char *pass)
Set anonymous password.
BGAV_PUBLIC int bgav_set_video_stream(bgav_t *bgav, int stream, bgav_stream_action_t action)
Select mode for a video stream.
bgav_edl_stream_t * video_streams
Logical video streams.
Definition: avdec.h:1156
BGAV_PUBLIC void bgav_options_set_dump_indices(bgav_options_t *opt, int enable)
Dump file indices.
BGAV_PUBLIC void bgav_options_set_http_proxy_user(bgav_options_t *opt, const char *user)
Set proxy username.
BGAV_PUBLIC int64_t bgav_audio_start_time(bgav_t *bgav, int stream)
Get the audio start time.
BGAV_PUBLIC void bgav_redirectors_dump()
Dump informations about all available redirectors to stderr.
BGAV_PUBLIC const char * bgav_metadata_get_comment(const bgav_metadata_t *metadata)
Get an additional comment of the track.
BGAV_PUBLIC void bgav_options_set_postprocessing_level(bgav_options_t *opt, float pp_level)
Set postprocessing level.
int num_video_streams
Number of logical video streams.
Definition: avdec.h:1155
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 int bgav_open(bgav_t *bgav, const char *location)
Open a file or URL.
char * name
Definition: avdec.h:902
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_rtp_try_tcp(bgav_options_t *opt, int enable)
Try TCP before UDP.
Definition: avdec.h:1484
bgav_log_level_t
Enumeration for log levels.
Definition: avdec.h:684
BGAV_PUBLIC int64_t bgav_video_duration(bgav_t *bgav, int stream)
Get the video duration.
BGAV_PUBLIC void bgav_formats_dump()
Dump informations about all available format demuxers to stderr.
BGAV_PUBLIC int bgav_can_pause(bgav_t *bgav)
Query if a track is pausable.
BGAV_PUBLIC const char * bgav_metadata_get_copyright(const bgav_metadata_t *metadata)
Get the copyright notice of the track.
BGAV_PUBLIC void bgav_subreaders_dump()
Dump informations about all available subtitle readers to stderr.
BGAV_PUBLIC void bgav_options_set_log_level(bgav_options_t *opt, int level)
Set the verbosity for log messages.
int64_t src_time
Time within the source in source timescale.
Definition: avdec.h:1121
BGAV_PUBLIC int64_t bgav_video_start_time(bgav_t *bgav, int stream)
Get the video start time.
BGAV_PUBLIC const char * bgav_get_description(bgav_t *bgav)
Get a technical description of the format.
BGAV_PUBLIC int bgav_check_device_dvd(const char *device, char **name)
Test if a device is DVD capable.
BGAV_PUBLIC void bgav_edl_dump(const bgav_edl_t *e)
Dump an EDL to stderr.
BGAV_PUBLIC int bgav_read_video(bgav_t *bgav, gavl_video_frame_t *frame, int stream)
Decode a video frame.
bgav_stream_action_t
Stream action.
Definition: avdec.h:1480
BGAV_PUBLIC const char * bgav_metadata_get_artist(const bgav_metadata_t *metadata)
Get the artist (or performer) of this track.
EDL structure.
Definition: avdec.h:1169
int num_subtitle_text_streams
Number of logical text subtitle streams.
Definition: avdec.h:1158
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_dvb(bgav_t *bgav, const char *location)
Open a DVB device.
int num_tracks
Number of logical tracks.
Definition: avdec.h:1171
BGAV_PUBLIC int bgav_start(bgav_t *bgav)
Start all codecs.
BGAV_PUBLIC void bgav_options_set_dvb_channels_file(bgav_options_t *opt, const char *file)
Set DVB channels file.
BGAV_PUBLIC void bgav_seek(bgav_t *bgav, gavl_time_t *time)
Seek to a specific time.
struct bgav_options_s bgav_options_t
Opaque option container.
Definition: avdec.h:223
BGAV_PUBLIC void bgav_options_set_http_proxy_port(bgav_options_t *opt, int port)
Set proxy port.
int num_audio_streams
Number of logical audio streams.
Definition: avdec.h:1152
BGAV_PUBLIC const char * bgav_metadata_get_date(const bgav_metadata_t *metadata)
Get the date of the recording.
BGAV_PUBLIC bgav_t * bgav_create()
Create a decoder instance.
BGAV_PUBLIC void bgav_options_set_dump_headers(bgav_options_t *opt, int enable)
Dump file headers.
Info structure for a device.
Definition: avdec.h:899
BGAV_PUBLIC gavl_time_t bgav_get_duration(bgav_t *bgav, int track)
Get the duration of a track.
BGAV_PUBLIC void bgav_seek_scaled(bgav_t *bgav, int64_t *time, int scale)
Seek to a specific stream position.
int32_t speed_den
Playback speed demoninator.
Definition: avdec.h:1130
BGAV_PUBLIC int bgav_get_audio_compression_info(bgav_t *bgav, int stream, gavl_compression_info_t *info)
Get audio compression info.
bgav_edl_stream_t * subtitle_overlay_streams
Logical overlay subtitle streams.
Definition: avdec.h:1162
BGAV_PUBLIC int bgav_redirector_get_num_urls(bgav_t *bgav)
Get the number of URLs found in the redirector.
BGAV_PUBLIC int bgav_set_audio_stream(bgav_t *bgav, int stream, bgav_stream_action_t action)
Select mode for an audio stream.
int64_t dst_duration
Duration within the destination in destination timescale.
Definition: avdec.h:1126
BGAV_PUBLIC void bgav_options_set_ftp_anonymous(bgav_options_t *opt, int enable)
Enable or disable anonymous ftp login.
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 int bgav_read_audio(bgav_t *bgav, gavl_audio_frame_t *frame, int stream, int num_samples)
Decode audio samples.
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_get_disc_name(bgav_t *bgav)
Get the name of a disc.
BGAV_PUBLIC void bgav_options_copy(bgav_options_t *dst, const bgav_options_t *src)
Copy options.
Definition: avdec.h:1483
BGAV_PUBLIC int bgav_metadata_get_track(const bgav_metadata_t *metadata)
Get the track index.
BGAV_PUBLIC int64_t bgav_audio_duration(bgav_t *bgav, int stream)
Get the audio duration.
BGAV_PUBLIC int bgav_num_tracks(bgav_t *bgav)
Get the number of tracks.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_audio_metadata(bgav_t *bgav, int stream)
Get the metadata of an audio stream.
BGAV_PUBLIC void bgav_options_set_rtp_port_base(bgav_options_t *opt, int p)
Set RTP port pase.
One segment of a physical stream to appear in a logical stream.
Definition: avdec.h:1113
BGAV_PUBLIC int bgav_read_audio_packet(bgav_t *bgav, int stream, gavl_packet_t *p)
Read compressed audio packet.
void(* bgav_buffer_callback)(void *data, float percentage)
Function to be called if the input module is buffering data.
Definition: avdec.h:788
int track
Track index for multitrack inputs.
Definition: avdec.h:1117
BGAV_PUBLIC void bgav_options_set_read_timeout(bgav_options_t *opt, int timeout)
Set read timeout.
BGAV_PUBLIC void bgav_codecs_dump()
Dump informations about all available codecs to stderr.
char * url
Filename if all streams are from the same file.
Definition: avdec.h:1173
BGAV_PUBLIC const char * bgav_metadata_get_albumartist(const bgav_metadata_t *metadata)
Get the album artist of this track.
BGAV_PUBLIC int bgav_video_has_still(bgav_t *bgav, int stream)
Determine if a still image is available for reading.
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:842
int64_t gavl_time_t
BGAV_PUBLIC void bgav_options_set_seek_subtitles(bgav_options_t *opt, int seek_subtitles)
Enable external subtitle files.
char * url
Location of that segment. If NULL, the "master url" in bgav_edl_t is valid.
Definition: avdec.h:1115
int timescale
Destination timescale.
Definition: avdec.h:1141
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 int bgav_has_subtitle(bgav_t *bgav, int stream)
Check, if a new subtitle is available.
BGAV_PUBLIC int bgav_eject_disc(const char *device)
Eject a disc.
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 const bgav_metadata_t * bgav_get_video_metadata(bgav_t *bgav, int stream)
Get the metadata of a video stream.
BGAV_PUBLIC void bgav_options_set_default_subtitle_encoding(bgav_options_t *opt, const char *encoding)
Set default subtitle encoding.
BGAV_PUBLIC bgav_options_t * bgav_options_create()
Create an options container.
BGAV_PUBLIC void bgav_options_set_threads(bgav_options_t *opt, int threads)
Set number of threads.
BGAV_PUBLIC int bgav_num_audio_streams(bgav_t *bgav, int track)
Get the number of audio streams of a track.
BGAV_PUBLIC void bgav_options_set_connect_timeout(bgav_options_t *opt, int timeout)
Set connect timeout.
BGAV_PUBLIC int bgav_num_subtitle_streams(bgav_t *bgav, int track)
Get the number of subtitle streams of a track.
BGAV_PUBLIC bgav_device_info_t * bgav_find_devices_dvd()
Scan for DVD capable devices.
BGAV_PUBLIC int bgav_open_vcd(bgav_t *bgav, const char *location)
Open a VCD device.
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 const char * bgav_metadata_get_author(const bgav_metadata_t *metadata)
Get the author (or composer) of the track.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_subtitle_metadata(bgav_t *bgav, int stream)
Get the metadata of a subtitle stream.
BGAV_PUBLIC void bgav_options_set_cache_time(bgav_options_t *opt, int t)
Set the index creation time for caching.
BGAV_PUBLIC int64_t bgav_subtitle_duration(bgav_t *bgav, int stream)
Get the subtitle duration.
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_prefer_ffmpeg_demuxers(bgav_options_t *opt, int prefer)
Preference of ffmpeg demultiplexers.
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_options_set_http_proxy_host(bgav_options_t *opt, const char *host)
Set proxy host.
BGAV_PUBLIC int bgav_get_video_compression_info(bgav_t *bgav, int stream, gavl_compression_info_t *info)
Get video compression info.
int stream
Index of the A/V stream.
Definition: avdec.h:1118
BGAV_PUBLIC bgav_edl_t * bgav_get_edl(bgav_t *bgav)
Get an EDL from an open decoder.
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, uint64_t pos, int whence), void *priv, const char *filename, const char *mimetype, int64_t total_bytes)
Open a decoder with callbacks.
BGAV_PUBLIC int bgav_select_track(bgav_t *bgav, int track)
Select a track.
BGAV_PUBLIC const char * bgav_get_subtitle_description(bgav_t *bgav, int stream)
Get the description 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 void bgav_options_set_name_change_callback(bgav_options_t *opt, bgav_name_change_callback callback, void *data)
Set the callback for name change events.
BGAV_PUBLIC void bgav_options_set_audio_dynrange(bgav_options_t *opt, int audio_dynrange)
Enable dynamic range control.
A locical track.
Definition: avdec.h:1147
Definition: avdec.h:1485
void(* bgav_index_callback)(void *data, float percentage)
Function to be called periodically while an index is built.
Definition: avdec.h:865
BGAV_PUBLIC int bgav_open_dvd(bgav_t *bgav, const char *location)
Open a DVD device.
BGAV_PUBLIC const char * bgav_get_audio_language(bgav_t *bgav, int stream)
Get the language of an audio stream.
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:813
BGAV_PUBLIC void bgav_options_set_http_proxy_pass(bgav_options_t *opt, const char *pass)
Set proxy password.
BGAV_PUBLIC int bgav_can_seek_sample(bgav_t *bgav)
Check if a track is seekabkle with sample accuracy.
BGAV_PUBLIC void bgav_seek_subtitle(bgav_t *bgav, int stream, int64_t time)
Seek to a specific subtitle position.
BGAV_PUBLIC const char * bgav_get_audio_info(bgav_t *bgav, int stream)
Get additional info about an audio stream.
BGAV_PUBLIC const char * bgav_redirector_get_url(bgav_t *bgav, int index)
Get the address of an URL.
BGAV_PUBLIC void bgav_options_set_network_buffer_size(bgav_options_t *opt, int size)
Set network buffer size.
void(* bgav_name_change_callback)(void *data, const char *name)
Function to be called if the track name changes.
Definition: avdec.h:741
BGAV_PUBLIC void bgav_options_set_http_shoutcast_metadata(bgav_options_t *opt, int enable)
Enable or disable shoutcast metadata streaming.
int timescale
Source timescale.
Definition: avdec.h:1119
BGAV_PUBLIC const char * bgav_metadata_get_title(const bgav_metadata_t *metadata)
Get the title of the track.
BGAV_PUBLIC const char * bgav_redirector_get_name(bgav_t *bgav, int index)
Get the address of an URL.
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 int64_t bgav_get_chapter_time(bgav_t *bgav, int track, int chapter)
Get the name of a chapter.
BGAV_PUBLIC void bgav_options_set_aspect_callback(bgav_options_t *opt, bgav_aspect_callback callback, void *data)
Set aspect ratio change callback.
Definition: avdec.h:1482
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:700
BGAV_PUBLIC const char * bgav_get_subtitle_info(bgav_t *bgav, int stream)
Get additional info about a subtitle stream.
bgav_edl_stream_t * subtitle_text_streams
Logical text subtitle streams.
Definition: avdec.h:1159
BGAV_PUBLIC const char * bgav_metadata_get_album(const bgav_metadata_t *metadata)
Get the album this track comes from.
int num_segments
Number of segments.
Definition: avdec.h:1140
BGAV_PUBLIC int bgav_num_video_streams(bgav_t *bgav, int track)
Get the number of video streams of a track.
int num_subtitle_overlay_streams
Number of logical overlay subtitle streams.
Definition: avdec.h:1161