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 - 2024 Members of the Gmerlin project
5 * http://github.com/bplaum
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * *****************************************************************/
20
21
22
23/* Public entry points */
24
25#ifndef BGAV_AVDEC_H_INCLUDED
26#define BGAV_AVDEC_H_INCLUDED
27
32
33#include <gavl/gavl.h>
34#include <gavl/compression.h>
35#include <gavl/metadata.h>
36#include <gavl/chapterlist.h>
37#include <gavl/connectors.h>
38#include <gavl/edl.h>
39#include <gavl/msg.h>
40
41#include "bgavdefs.h" // This is ugly, but works
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
69
73
79
80typedef struct bgav_s bgav_t;
81
86
87BGAV_PUBLIC
89
105
110
113
119
120typedef gavl_dictionary_t bgav_metadata_t;
121
127
128BGAV_PUBLIC
129const char * bgav_metadata_get_author(const bgav_metadata_t*metadata);
130
136
137BGAV_PUBLIC
138const char * bgav_metadata_get_title(const bgav_metadata_t * metadata);
139
145
146BGAV_PUBLIC
147const char * bgav_metadata_get_comment(const bgav_metadata_t * metadata);
148
154
155BGAV_PUBLIC
156const char * bgav_metadata_get_copyright(const bgav_metadata_t * metadata);
157
163
164BGAV_PUBLIC
165const char * bgav_metadata_get_album(const bgav_metadata_t * metadata);
166
172
173BGAV_PUBLIC
174const char * bgav_metadata_get_artist(const bgav_metadata_t * metadata);
175
181
182BGAV_PUBLIC
183const char * bgav_metadata_get_albumartist(const bgav_metadata_t * metadata);
184
190
191BGAV_PUBLIC
192const char * bgav_metadata_get_genre(const bgav_metadata_t * metadata);
193
199
200BGAV_PUBLIC
201const char * bgav_metadata_get_date(const bgav_metadata_t * metadata);
202
208
209BGAV_PUBLIC
211
212/***************************************************
213 * Housekeeping Functions
214 ***************************************************/
215
216/***************************************************
217 * Set parameters
218 ***************************************************/
219
220
224
225typedef struct bgav_options_s bgav_options_t;
226
235
236BGAV_PUBLIC
238
252
253BGAV_PUBLIC
255
264
265BGAV_PUBLIC
267
273
274BGAV_PUBLIC
276
285
286BGAV_PUBLIC
288
297
298BGAV_PUBLIC
300
313
314
315BGAV_PUBLIC
317
326
327BGAV_PUBLIC
329
338
339BGAV_PUBLIC
341
342
343/* HTTP Options */
344
354
355BGAV_PUBLIC
357
366
367BGAV_PUBLIC
369
378
379BGAV_PUBLIC
381
391
392BGAV_PUBLIC
394
402
403BGAV_PUBLIC
405
413
414BGAV_PUBLIC
416
424
425BGAV_PUBLIC
427
428/* Set FTP options */
429
435
436BGAV_PUBLIC
438
446
447BGAV_PUBLIC
449
460
461BGAV_PUBLIC
463 const char* encoding);
464
474
475BGAV_PUBLIC
477 int audio_dynrange);
478
479
488
489BGAV_PUBLIC
491
502
503BGAV_PUBLIC
505
514
515BGAV_PUBLIC
517
532
533BGAV_PUBLIC
535 int seek_subtitles);
536
545
546BGAV_PUBLIC
548 int pp_level);
549
557
558BGAV_PUBLIC
560 float pp_level);
561
569
570BGAV_PUBLIC
572
573
584
585BGAV_PUBLIC
587 const char * file);
588
599
600BGAV_PUBLIC
602 int prefer);
603
609
610BGAV_PUBLIC
612 int datetime);
613
622
623BGAV_PUBLIC
625 int factor);
626
637
638BGAV_PUBLIC
640 int vdpau);
641
650
651BGAV_PUBLIC
653 int vaapi);
654
662
663BGAV_PUBLIC
665 int enable);
666
674
675BGAV_PUBLIC
677 int enable);
678
679
687
688BGAV_PUBLIC
690 int enable);
691
692BGAV_PUBLIC
693void bgav_options_set_video_hw_context(bgav_options_t * opt, gavl_hw_context_t * hwctx);
694
695
701
702
703/* Set callbacks */
704
713
714
715typedef void (*bgav_metadata_change_callback)(void*data, const bgav_metadata_t * metadata);
716
723
724BGAV_PUBLIC void
727 void * data);
728
737
738typedef void (*bgav_buffer_callback)(void*data, float percentage);
739
746
747BGAV_PUBLIC void
749 bgav_buffer_callback callback,
750 void * data);
751
762
763typedef int (*bgav_user_pass_callback)(void*data, const char * resource,
764 char ** username, char ** password);
765
776
777BGAV_PUBLIC void
780 void * data);
781
791
792typedef void (*bgav_aspect_callback)(void*data, int stream,
793 int pixel_width, int pixel_height);
794
795
802
803BGAV_PUBLIC void
805 bgav_aspect_callback callback,
806 void * data);
807
814
815typedef void (*bgav_index_callback)(void*data, float percentage);
816
823
824BGAV_PUBLIC void
826 bgav_index_callback callback,
827 void * data);
828
829BGAV_PUBLIC void
830bgav_set_msg_callback_by_id(bgav_t* b,
831 int id,
832 gavl_handle_msg_func callback,
833 void * data);
834
835
836
837/* Device description */
838
847
855
856typedef struct
857 {
858 char * device;
859 char * name;
861
862/* Scan for devices */
863
870
871BGAV_PUBLIC
873
880
881BGAV_PUBLIC
882int bgav_check_device_vcd(const char * device, char ** name);
883
890
891BGAV_PUBLIC
893
900
901BGAV_PUBLIC
902int bgav_check_device_dvd(const char * device, char ** name);
903
910
911BGAV_PUBLIC
913
920
921BGAV_PUBLIC
922int bgav_check_device_dvb(const char * device, char ** name);
923
928
929
930BGAV_PUBLIC
932
938
939BGAV_PUBLIC
940int bgav_eject_disc(const char * device);
941
947
948BGAV_PUBLIC
949const char * bgav_get_disc_name(bgav_t * bgav);
950
951/******************************************************
952 * Open
953 ******************************************************/
954
955/* Open a file or URL, return 1 on success */
956
963
964BGAV_PUBLIC
965int bgav_open(bgav_t * bgav, const char * location);
966
973
974BGAV_PUBLIC
975int bgav_open_vcd(bgav_t * bgav, const char * location);
976
983
984BGAV_PUBLIC
985int bgav_open_dvd(bgav_t * bgav, const char * location);
986
997
998BGAV_PUBLIC
999int bgav_open_dvb(bgav_t * bgav, const char * location);
1000
1012
1013BGAV_PUBLIC
1015 int (*read_callback)(void * priv, uint8_t * data, int len),
1016 int64_t (*seek_callback)(void * priv, int64_t pos, int whence),
1017 void * priv,
1018 const char * filename, const char * mimetype, int64_t total_bytes);
1019
1020
1021
1022
1023
1024/* Close and destroy everything */
1025
1030
1031BGAV_PUBLIC
1032void bgav_close(bgav_t * bgav);
1033
1039
1040BGAV_PUBLIC
1041const gavl_dictionary_t * bgav_get_edl(bgav_t * bgav);
1042
1043/***************************************************
1044 * Check for redirecting: You MUST check if you opened
1045 * a redirector, because reading data from redirectors
1046 * crashes
1047 * After you read the URLs, close the bgav_t object
1048 * and open a new one with one of the URLs.
1049 ***************************************************/
1050
1063
1072
1073#if 0
1074
1075
1081
1082BGAV_PUBLIC
1083int bgav_redirector_get_num_urls(bgav_t * bgav);
1084
1091
1092BGAV_PUBLIC
1093const char * bgav_redirector_get_url(bgav_t * bgav, int index);
1094
1101
1102BGAV_PUBLIC
1103const char * bgav_redirector_get_name(bgav_t * bgav, int index);
1104
1111
1112BGAV_PUBLIC
1113const gavl_dictionary_t * bgav_redirector_get_metadata(bgav_t * b, int index);
1114
1115#endif
1116
1117/***************************************************
1118 * Get information about the file
1119 ***************************************************/
1120
1127
1133
1134BGAV_PUBLIC
1136
1142
1143BGAV_PUBLIC
1144const char * bgav_get_description(bgav_t * bgav);
1145
1152
1153BGAV_PUBLIC
1155
1156/* Query stream numbers */
1157
1164
1165BGAV_PUBLIC
1166int bgav_num_audio_streams(bgav_t * bgav, int track);
1167
1174
1175BGAV_PUBLIC
1176int bgav_num_video_streams(bgav_t * bgav, int track);
1177
1189
1190BGAV_PUBLIC
1191int bgav_num_subtitle_streams(bgav_t * bgav, int track);
1192
1199
1200BGAV_PUBLIC
1201int bgav_num_text_streams(bgav_t * bgav, int track);
1202
1209
1210BGAV_PUBLIC
1211int bgav_num_overlay_streams(bgav_t * bgav, int track);
1212
1219
1220BGAV_PUBLIC
1221const char * bgav_get_track_name(bgav_t * bgav, int track);
1222
1229
1230BGAV_PUBLIC
1231const bgav_metadata_t * bgav_get_metadata(bgav_t * bgav,int track);
1232
1246
1247BGAV_PUBLIC
1248gavl_dictionary_t * bgav_get_media_info(bgav_t * bgav);
1249
1250
1260
1261
1262BGAV_PUBLIC
1263int bgav_select_track(bgav_t * bgav, int track);
1264
1276
1277BGAV_PUBLIC
1278int bgav_get_num_chapters(bgav_t * bgav, int track, int * timescale);
1279
1287
1288BGAV_PUBLIC const char *
1289bgav_get_chapter_name(bgav_t * bgav, int track, int chapter);
1290
1298
1299BGAV_PUBLIC
1300int64_t bgav_get_chapter_time(bgav_t * bgav, int track, int chapter);
1301
1311
1312BGAV_PUBLIC
1313const gavl_chapter_list_t * bgav_get_chapter_list(bgav_t * bgav, int track);
1314
1315
1323
1330
1331BGAV_PUBLIC
1332const char * bgav_get_audio_language(bgav_t * bgav, int stream);
1333
1340
1341BGAV_PUBLIC
1342int bgav_get_audio_bitrate(bgav_t * bgav, int stream);
1343
1350
1351BGAV_PUBLIC
1352const bgav_metadata_t *
1354
1362
1363BGAV_PUBLIC
1365
1372
1373BGAV_PUBLIC
1374const char * bgav_get_subtitle_language(bgav_t * bgav, int stream);
1375
1382
1383BGAV_PUBLIC
1384const bgav_metadata_t *
1386
1393
1394BGAV_PUBLIC
1395const bgav_metadata_t *
1397
1405
1406BGAV_PUBLIC
1407const bgav_metadata_t *
1408bgav_get_text_metadata_t(bgav_t * b, int track, int stream);
1409
1416
1417BGAV_PUBLIC
1418const bgav_metadata_t *
1420
1428
1429BGAV_PUBLIC
1430const bgav_metadata_t *
1431bgav_get_overlay_metadata_t(bgav_t * b, int track, int stream);
1432
1433
1440
1441BGAV_PUBLIC
1442const bgav_metadata_t *
1444
1452
1453BGAV_PUBLIC
1454const bgav_metadata_t *
1456
1457
1464
1474
1491
1492
1504
1505BGAV_PUBLIC
1508
1520
1521BGAV_PUBLIC
1524
1536
1537BGAV_PUBLIC
1540
1541
1552
1553BGAV_PUBLIC
1554int bgav_read_audio_packet(bgav_t * bgav, int stream, gavl_packet_t * p);
1555
1564
1565BGAV_PUBLIC
1566gavl_packet_source_t *
1568
1569
1580
1581BGAV_PUBLIC
1582int bgav_read_video_packet(bgav_t * bgav, int stream, gavl_packet_t * p);
1583
1592
1593BGAV_PUBLIC
1594gavl_packet_source_t *
1596
1605
1606BGAV_PUBLIC
1607gavl_packet_source_t *
1609
1616
1617BGAV_PUBLIC
1618gavl_packet_source_t *
1620
1621
1631
1632BGAV_PUBLIC
1633int bgav_set_audio_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
1634
1644
1645BGAV_PUBLIC
1646int bgav_set_video_stream(bgav_t * bgav, int stream, bgav_stream_action_t action);
1647
1657
1658BGAV_PUBLIC
1659int bgav_set_subtitle_stream(bgav_t * bgav, int stream,
1660 bgav_stream_action_t action);
1661
1671
1672BGAV_PUBLIC
1673int bgav_set_text_stream(bgav_t * bgav, int stream,
1674 bgav_stream_action_t action);
1675
1685
1686BGAV_PUBLIC
1687int bgav_set_overlay_stream(bgav_t * bgav, int stream,
1688 bgav_stream_action_t action);
1689
1690/***************************************************
1691 * Stream handling functions
1692 ***************************************************/
1693
1694/*
1695 * You MUST these, if you want to decode anything.
1696 * After bgav_open(), all streams are switched off by
1697 * default
1698 */
1699
1700
1704
1713
1714BGAV_PUBLIC
1715int bgav_start(bgav_t * bgav);
1716
1717BGAV_PUBLIC
1718int bgav_pause(bgav_t * bgav);
1719
1720BGAV_PUBLIC
1721int bgav_resume(bgav_t * bgav);
1722
1723
1727
1738
1739BGAV_PUBLIC
1741
1753
1754
1755 BGAV_PUBLIC
1756 const gavl_audio_format_t * bgav_get_audio_format_t(bgav_t * bgav, int track, int stream);
1757
1773
1774BGAV_PUBLIC
1776
1793
1794BGAV_PUBLIC
1795const gavl_video_format_t * bgav_get_video_format_t(bgav_t * bgav, int t, int stream);
1796
1808
1809BGAV_PUBLIC
1811
1822
1823BGAV_PUBLIC
1824int bgav_get_text_timescale(bgav_t * bgav, int stream);
1825
1826
1845
1846BGAV_PUBLIC
1848
1849
1864
1865
1866
1867BGAV_PUBLIC const gavl_video_format_t *
1869
1879
1880BGAV_PUBLIC
1881int bgav_subtitle_is_text(bgav_t * bgav, int stream);
1882
1893
1894BGAV_PUBLIC
1895const char * bgav_get_audio_description(bgav_t * bgav, int stream);
1896
1910
1911BGAV_PUBLIC
1912const char * bgav_get_audio_info(bgav_t * bgav, int stream);
1913
1914
1925
1926BGAV_PUBLIC
1927const char * bgav_get_video_description(bgav_t * bgav, int stream);
1928
1939
1940BGAV_PUBLIC
1941const char * bgav_get_subtitle_description(bgav_t * bgav, int stream);
1942
1943
1957
1958BGAV_PUBLIC
1959const char * bgav_get_subtitle_info(bgav_t * bgav, int stream);
1960
1969
1970BGAV_PUBLIC
1972
1973/***************************************************
1974 * Decoding functions
1975 ***************************************************/
1976
1980
1997
1998BGAV_PUBLIC
1999int bgav_video_has_still(bgav_t * bgav, int stream);
2000
2008
2009BGAV_PUBLIC
2010int bgav_read_video(bgav_t * bgav, gavl_video_frame_t * frame, int stream);
2011
2029
2030BGAV_PUBLIC
2031int bgav_skip_video(bgav_t * bgav, int stream,
2032 int64_t * time, int scale,
2033 int exact);
2034
2035/*
2036 * Set a skip mode (see GAVL_MSG_SRC_SKIP_* in gavl/msg.h)
2037 */
2038
2039BGAV_PUBLIC
2040void bgav_set_video_skip_mode(bgav_t * bgav, int stream,
2041 int mode);
2042
2055
2056BGAV_PUBLIC
2057gavl_video_source_t * bgav_get_video_source(bgav_t * bgav, int stream);
2058
2066
2067BGAV_PUBLIC
2068gavl_video_source_t * bgav_get_overlay_source(bgav_t * bgav, int stream);
2069
2070
2079
2080BGAV_PUBLIC
2081int bgav_read_audio(bgav_t * bgav, gavl_audio_frame_t * frame, int stream,
2082 int num_samples);
2083
2095
2096BGAV_PUBLIC
2097gavl_audio_source_t * bgav_get_audio_source(bgav_t * bgav, int stream);
2098
2099
2100
2111
2112BGAV_PUBLIC
2113int bgav_has_subtitle(bgav_t * bgav, int stream);
2114
2129
2130BGAV_PUBLIC
2131int bgav_read_subtitle_overlay(bgav_t * bgav, gavl_overlay_t * ovl, int stream);
2132
2151
2152BGAV_PUBLIC
2153int bgav_read_subtitle_text(bgav_t * bgav, char ** ret, int *ret_alloc,
2154 int64_t * start_time, int64_t * duration,
2155 int stream);
2156
2157/***************************************************
2158 * Seek to a timestamp. This also resyncs all streams
2159 ***************************************************/
2160
2169
2189
2190
2196
2197BGAV_PUBLIC
2199
2200
2208
2209BGAV_PUBLIC
2210void bgav_seek(bgav_t * bgav, gavl_time_t * time);
2211
2212
2237
2238BGAV_PUBLIC
2239int bgav_seek_scaled(bgav_t * bgav, int64_t * time, int scale);
2240
2244
2251
2252BGAV_PUBLIC
2254
2255
2267
2268BGAV_PUBLIC
2269int64_t bgav_audio_duration(bgav_t * bgav, int stream);
2270
2281
2282BGAV_PUBLIC
2283int64_t bgav_audio_start_time(bgav_t * bgav, int stream);
2284
2296
2297BGAV_PUBLIC
2298int64_t bgav_video_duration(bgav_t * bgav, int stream);
2299
2310
2311BGAV_PUBLIC
2312int64_t bgav_video_start_time(bgav_t * bgav, int stream);
2313
2314
2323
2324BGAV_PUBLIC
2325int64_t bgav_subtitle_duration(bgav_t * bgav, int stream);
2326
2335
2336BGAV_PUBLIC
2337int64_t bgav_text_duration(bgav_t * bgav, int stream);
2338
2347
2348BGAV_PUBLIC
2349int64_t bgav_overlay_duration(bgav_t * bgav, int stream);
2350
2351BGAV_PUBLIC
2352int64_t bgav_get_num_video_frames(bgav_t * bgav, int stream);
2353
2361
2362BGAV_PUBLIC
2363int bgav_seek_to_video_frame(bgav_t * bgav, int stream, int frame);
2364
2379
2380BGAV_PUBLIC
2381int64_t bgav_video_keyframe_before(bgav_t * bgav, int stream, int64_t time);
2382
2397
2398BGAV_PUBLIC
2399int64_t bgav_video_keyframe_after(bgav_t * bgav, int stream, int64_t time);
2400
2412
2417
2418typedef struct bgav_stream_decoder_s bgav_stream_decoder_t;
2419
2423
2424BGAV_PUBLIC
2426
2431
2432BGAV_PUBLIC bgav_options_t *
2434
2450
2451BGAV_PUBLIC gavl_audio_source_t *
2453 gavl_packet_source_t * src,
2454 gavl_dictionary_t * s);
2455
2471
2472BGAV_PUBLIC gavl_video_source_t *
2474 gavl_packet_source_t * src,
2475 gavl_dictionary_t * s);
2476
2492
2493BGAV_PUBLIC gavl_video_source_t *
2495 gavl_packet_source_t * src,
2496 gavl_dictionary_t * s);
2497
2507
2508BGAV_PUBLIC int64_t
2510
2516
2517BGAV_PUBLIC void
2519
2523
2524BGAV_PUBLIC void
2526
2534
2535
2536BGAV_PUBLIC gavl_codec_id_t *
2538
2546
2547BGAV_PUBLIC
2549
2550BGAV_PUBLIC
2551uint32_t * bgav_supported_audio_fourccs(void);
2552
2553BGAV_PUBLIC
2554uint32_t * bgav_supported_video_fourccs(void);
2555
2556
2557BGAV_PUBLIC
2558int bgav_set_stream_action_all(bgav_t * bgav, int idx, bgav_stream_action_t action);
2559
2563
2564
2565/***************************************************
2566 * Debugging functions
2567 ***************************************************/
2568
2571
2576
2577BGAV_PUBLIC
2578void bgav_dump(bgav_t * bgav);
2579
2580/* Dump infos about the installed codecs */
2581
2588
2589BGAV_PUBLIC
2591
2592/* Dump known media formats */
2593
2600
2601BGAV_PUBLIC
2603
2610
2611BGAV_PUBLIC
2613
2620
2621BGAV_PUBLIC
2623
2630
2631BGAV_PUBLIC
2633
2634
2635#ifdef __cplusplus
2636}
2637#endif
2638
2639
2640#endif // BGAV_AVDEC_H_INCLUDED
BGAV_PUBLIC gavl_video_source_t * bgav_stream_decoder_connect_video(bgav_stream_decoder_t *dec, gavl_packet_source_t *src, gavl_dictionary_t *s)
Connect a video stream decoder.
BGAV_PUBLIC gavl_codec_id_t * bgav_supported_audio_compressions(void)
Get supported audio compressions.
struct bgav_stream_decoder_s bgav_stream_decoder_t
Forward declaration for a stream decoder.
Definition avdec.h:2418
BGAV_PUBLIC int64_t bgav_stream_decoder_skip(bgav_stream_decoder_t *dec, int64_t t, int scale)
Skip to a specified time.
BGAV_PUBLIC bgav_options_t * bgav_stream_decoder_get_options(bgav_stream_decoder_t *dec)
Get options for a stream decoder.
BGAV_PUBLIC gavl_audio_source_t * bgav_stream_decoder_connect_audio(bgav_stream_decoder_t *dec, gavl_packet_source_t *src, gavl_dictionary_t *s)
Connect an audio stream decoder.
BGAV_PUBLIC void bgav_stream_decoder_reset(bgav_stream_decoder_t *dec)
Reset a stream decoder.
BGAV_PUBLIC bgav_stream_decoder_t * bgav_stream_decoder_create(void)
Create 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_overlay(bgav_stream_decoder_t *dec, gavl_packet_source_t *src, gavl_dictionary_t *s)
Connect an overlay stream decoder.
BGAV_PUBLIC gavl_codec_id_t * bgav_supported_video_compressions(void)
Get supported video compressions.
gavl_codec_id_t
BGAV_PUBLIC void bgav_dump(bgav_t *bgav)
Dump informations of all tracks to stderr.
BGAV_PUBLIC void bgav_redirectors_dump(void)
Dump informations about all available redirectors to stderr.
BGAV_PUBLIC void bgav_subreaders_dump(void)
Dump informations about all available subtitle readers to stderr.
BGAV_PUBLIC void bgav_inputs_dump(void)
Dump informations about all available input modules to stderr.
BGAV_PUBLIC void bgav_codecs_dump(void)
Dump informations about all available codecs to stderr.
BGAV_PUBLIC void bgav_formats_dump(void)
Dump informations about all available format demuxers 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_overlay_source(bgav_t *bgav, int stream)
Return the video source for an overlay stream.
BGAV_PUBLIC int bgav_video_has_still(bgav_t *bgav, int stream)
Determine if a still image is available for reading.
BGAV_PUBLIC int bgav_read_subtitle_overlay(bgav_t *bgav, gavl_overlay_t *ovl, int stream)
Decode an overlay subtitle.
BGAV_PUBLIC int bgav_skip_video(bgav_t *bgav, int stream, int64_t *time, int scale, int exact)
Skip forward in a video stream.
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_read_video(bgav_t *bgav, gavl_video_frame_t *frame, int stream)
Decode a video frame.
struct bgav_s bgav_t
Opaque decoder structure.
Definition avdec.h:80
BGAV_PUBLIC void bgav_close(bgav_t *bgav)
Close a decoder and free all associated memory.
BGAV_PUBLIC const gavl_dictionary_t * bgav_get_edl(bgav_t *bgav)
Get an EDL from an open decoder.
BGAV_PUBLIC bgav_t * bgav_create(void)
Create a decoder instance.
BGAV_PUBLIC const char * bgav_get_disc_name(bgav_t *bgav)
Get the name of a disc.
BGAV_PUBLIC bgav_device_info_t * bgav_find_devices_dvb(void)
Scan for DVB capable devices.
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_vcd(void)
Scan for VCD capable devices.
BGAV_PUBLIC int bgav_check_device_dvd(const char *device, char **name)
Test if a device is DVD capable.
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(void)
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 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_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 int bgav_metadata_get_track(const bgav_metadata_t *metadata)
Get the track index.
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_albumartist(const bgav_metadata_t *metadata)
Get the album artist of this track.
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_copyright(const bgav_metadata_t *metadata)
Get the copyright notice of the track.
gavl_dictionary_t bgav_metadata_t
Opaque metadata container.
Definition avdec.h:120
BGAV_PUBLIC const char * bgav_metadata_get_comment(const bgav_metadata_t *metadata)
Get an additional comment of the track.
BGAV_PUBLIC const char * bgav_metadata_get_artist(const bgav_metadata_t *metadata)
Get the artist (or performer) of this track.
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_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.
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:792
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:763
BGAV_PUBLIC void bgav_options_set_http_proxy_auth(bgav_options_t *opt, int enable)
Enable or disable proxy authentication.
BGAV_PUBLIC bgav_options_t * bgav_options_create(void)
Create an options container.
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 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.
void(* bgav_index_callback)(void *data, float percentage)
Function to be called periodically while an index is built.
Definition avdec.h:815
void(* bgav_metadata_change_callback)(void *data, const bgav_metadata_t *metadata)
Enumeration for log levels.
Definition avdec.h:715
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:225
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_vaapi(bgav_options_t *opt, int vaapi)
VAAPI acceleration.
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:738
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_destroy(bgav_options_t *opt)
Destroy option cotainer.
BGAV_PUBLIC bgav_options_t * bgav_get_options(bgav_t *bgav)
Get the options of a decoder instance.
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 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_audio_packet_source(bgav_t *bgav, int stream)
Get a packet source for an audio 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_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_video_packet_source(bgav_t *bgav, int stream)
Get a packet source for a video stream.
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_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 int bgav_seek_to_video_frame(bgav_t *bgav, int stream, int frame)
Seek to video frame given by index.
BGAV_PUBLIC int64_t bgav_text_duration(bgav_t *bgav, int stream)
Get the text duration.
BGAV_PUBLIC int64_t bgav_overlay_duration(bgav_t *bgav, int stream)
Get the overlay duration.
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 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 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)
Time value indicating an invalid time.
BGAV_PUBLIC int64_t bgav_subtitle_duration(bgav_t *bgav, int stream)
Get the subtitle duration.
BGAV_PUBLIC int 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_info(bgav_t *bgav, int stream)
Get additional info about an audio stream.
BGAV_PUBLIC const char * bgav_get_audio_description(bgav_t *bgav, int stream)
Get the description 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 gavl_audio_format_t * bgav_get_audio_format_t(bgav_t *bgav, int track, int stream)
Get the format of an audio 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 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_can_pause(bgav_t *bgav)
Query if a track is pausable.
BGAV_PUBLIC const gavl_video_format_t * bgav_get_video_format_t(bgav_t *bgav, int t, int stream)
Get the format of a video stream.
BGAV_PUBLIC const gavl_audio_format_t * bgav_get_audio_format(bgav_t *bgav, int stream)
Get the format of an audio stream of the current track.
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 char * bgav_get_video_description(bgav_t *bgav, int stream)
Get the description of a video stream.
BGAV_PUBLIC const char * bgav_get_subtitle_description(bgav_t *bgav, int stream)
Get the description of a subtitle stream.
BGAV_PUBLIC int bgav_get_text_timescale(bgav_t *bgav, int stream)
Get the timescale for a text stream.
BGAV_PUBLIC const char * bgav_get_subtitle_info(bgav_t *bgav, int stream)
Get additional info about a subtitle stream.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_text_metadata(bgav_t *b, int stream)
Get the metadata of a text stream of the current track.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_text_metadata_t(bgav_t *b, int track, int stream)
Get the metadata of a text stream.
BGAV_PUBLIC int bgav_get_audio_bitrate(bgav_t *bgav, int stream)
Get the bitrate of an audio stream.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_video_metadata_t(bgav_t *b, int t, int s)
Get the metadata of a video 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 bgav_metadata_t * bgav_get_audio_metadata_t(bgav_t *b, int t, int s)
Get the metadata 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 int bgav_set_text_stream(bgav_t *bgav, int stream, bgav_stream_action_t action)
Select mode for a text stream.
BGAV_PUBLIC const char * bgav_get_subtitle_language(bgav_t *bgav, int stream)
Get the language of a subtitle stream.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_overlay_metadata_t(bgav_t *b, int track, int stream)
Get the metadata of an overlay stream.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_video_metadata(bgav_t *bgav, int stream)
Get the metadata of a video stream of the current track.
bgav_stream_action_t
Stream action.
Definition avdec.h:1466
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 of the current track.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_overlay_metadata(bgav_t *b, int stream)
Get the metadata of an overlay stream of the current track.
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 const char * bgav_get_audio_language(bgav_t *bgav, int stream)
Get the language of an audio stream.
@ BGAV_STREAM_INIT
Definition avdec.h:1471
@ BGAV_STREAM_READRAW
Definition avdec.h:1470
@ BGAV_STREAM_MUTE
Definition avdec.h:1467
@ BGAV_STREAM_PARSE
Definition avdec.h:1469
@ BGAV_STREAM_DECODE
Definition avdec.h:1468
int64_t gavl_time_t
BGAV_PUBLIC const char * bgav_get_chapter_name(bgav_t *bgav, int track, int chapter)
Get the name of a chapter.
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_track_name(bgav_t *bgav, int track)
Get the name a track.
BGAV_PUBLIC int bgav_get_num_chapters(bgav_t *bgav, int track, int *timescale)
Get the number of chapters.
BGAV_PUBLIC int bgav_select_track(bgav_t *bgav, int track)
Select a track.
BGAV_PUBLIC const bgav_metadata_t * bgav_get_metadata(bgav_t *bgav, int track)
Get metadata for 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 const char * bgav_get_description(bgav_t *bgav)
Get a technical description of the format.
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 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 const gavl_chapter_list_t * bgav_get_chapter_list(bgav_t *bgav, int track)
Get the chapter list.
BGAV_PUBLIC gavl_dictionary_t * bgav_get_media_info(bgav_t *bgav)
Get media information.
BGAV_PUBLIC int bgav_num_tracks(bgav_t *bgav)
Get the number of tracks.
struct gavl_video_format_s gavl_video_format_t
Info structure for a device.
Definition avdec.h:857
char * name
Definition avdec.h:859
char * device
Definition avdec.h:858