123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- #ifndef __LIBV4L2RDS
- #define __LIBV4L2RDS
- #include <stdbool.h>
- #include <stdint.h>
- #include <linux/videodev2.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #if HAVE_VISIBILITY
- #define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
- #else
- #define LIBV4L_PUBLIC
- #endif
- #define V4L2_RDS_VERSION (2)
- #define MAX_ODA_CNT 18
- #define MAX_AF_CNT 25
- #define MAX_TMC_ADDITIONAL 28
- #define MAX_TMC_ALT_STATIONS 32
- #define MAX_TMC_AF_CNT 4
- #define MAX_EON_CNT 20
- #define V4L2_RDS_PI 0x01
- #define V4L2_RDS_PTY 0x02
- #define V4L2_RDS_TP 0x04
- #define V4L2_RDS_PS 0x08
- #define V4L2_RDS_TA 0x10
- #define V4L2_RDS_DI 0x20
- #define V4L2_RDS_MS 0x40
- #define V4L2_RDS_PTYN 0x80
- #define V4L2_RDS_RT 0x100
- #define V4L2_RDS_TIME 0x200
- #define V4L2_RDS_TMC 0x400
- #define V4L2_RDS_AF 0x800
- #define V4L2_RDS_ECC 0x1000
- #define V4L2_RDS_LC 0x2000
- #define V4L2_RDS_TMC_SG 0x4000
- #define V4L2_RDS_TMC_MG 0x8000
- #define V4L2_RDS_TMC_SYS 0x10000
- #define V4L2_RDS_EON 0x20000
- #define V4L2_RDS_LSF 0x40000
- #define V4L2_RDS_TMC_TUNING 0x80000
- #define V4L2_RDS_GROUP_NEW 0x01
- #define V4L2_RDS_ODA 0x02
- #define V4L2_RDS_FLAG_STEREO 0x01
- #define V4L2_RDS_FLAG_ARTIFICIAL_HEAD 0x02
- #define V4L2_RDS_FLAG_COMPRESSED 0x04
- #define V4L2_RDS_FLAG_DYNAMIC_PTY 0x08
- #define V4L2_TMC_TUNING_INFO 0x10
- #define V4L2_TMC_SINGLE_GROUP 0x08
- struct v4l2_rds_group {
- uint16_t pi;
- char group_version;
- uint8_t group_id;
-
- uint8_t data_b_lsb;
- uint8_t data_c_msb;
- uint8_t data_c_lsb;
- uint8_t data_d_msb;
- uint8_t data_d_lsb;
- };
- struct v4l2_rds_statistics {
- uint32_t block_cnt;
- uint32_t group_cnt;
- uint32_t block_error_cnt;
- uint32_t group_error_cnt;
- uint32_t block_corrected_cnt;
- uint32_t group_type_cnt[16];
- };
- struct v4l2_rds_oda {
- uint8_t group_id;
- char group_version;
- uint16_t aid;
- };
- struct v4l2_rds_oda_set {
- uint8_t size;
- struct v4l2_rds_oda oda[MAX_ODA_CNT];
- };
- struct v4l2_rds_af_set {
- uint8_t size;
- uint8_t announced_af;
- uint32_t af[MAX_AF_CNT];
- };
- struct v4l2_rds_eon {
- uint32_t valid_fields;
- uint16_t pi;
- uint8_t ps[9];
- uint8_t pty;
- bool ta;
- bool tp;
- uint16_t lsf;
- struct v4l2_rds_af_set af;
- };
- struct v4l2_rds_eon_set {
- uint8_t size;
- uint8_t index;
- struct v4l2_rds_eon eon[MAX_EON_CNT];
- };
- struct v4l2_tmc_alt_freq {
- uint8_t af_size;
- uint8_t af_index;
- uint8_t mapped_af_size;
- uint8_t mapped_af_index;
- uint32_t af[MAX_TMC_AF_CNT];
- uint32_t mapped_af[MAX_TMC_AF_CNT];
- uint32_t mapped_af_tuning[MAX_TMC_AF_CNT];
- };
- struct v4l2_tmc_station {
- uint16_t pi;
- uint8_t ltn;
- uint8_t msg;
- uint8_t sid;
- struct v4l2_tmc_alt_freq afi;
- };
- struct v4l2_tmc_tuning {
- uint8_t station_cnt;
- uint8_t index;
- struct v4l2_tmc_station station[MAX_TMC_ALT_STATIONS];
- };
- struct v4l2_tmc_additional {
- uint8_t label;
- uint16_t data;
- };
- struct v4l2_tmc_additional_set {
- uint8_t size;
- struct v4l2_tmc_additional fields[MAX_TMC_ADDITIONAL];
- };
- struct v4l2_rds_tmc_msg {
- uint8_t length;
- uint8_t sid;
- uint8_t extent;
- uint8_t dp;
- uint16_t event;
- uint16_t location;
- bool follow_diversion;
- bool neg_direction;
-
- struct v4l2_tmc_additional_set additional;
- };
- struct v4l2_rds_tmc {
- uint8_t ltn;
- bool afi;
- bool enhanced_mode;
- uint8_t mgs;
- uint8_t sid;
- uint8_t gap;
- uint8_t t_a;
- uint8_t t_w;
- uint8_t t_d;
- uint8_t spn[9];
- struct v4l2_rds_tmc_msg tmc_msg;
-
- struct v4l2_tmc_tuning tuning;
- };
- struct v4l2_rds {
-
- uint32_t decode_information;
- uint32_t valid_fields;
-
- bool is_rbds;
- uint16_t pi;
- uint8_t ps[9];
- uint8_t pty;
- uint8_t ptyn[9];
- bool ptyn_ab_flag;
- uint8_t rt_length;
- uint8_t rt[65];
- bool rt_ab_flag;
- bool ta;
- bool tp;
- bool ms;
- uint8_t di;
- uint8_t ecc;
- uint8_t lc;
- time_t time;
- struct v4l2_rds_statistics rds_statistics;
- struct v4l2_rds_oda_set rds_oda;
- struct v4l2_rds_af_set rds_af;
- struct v4l2_rds_eon_set rds_eon;
- struct v4l2_rds_tmc tmc;
- };
- LIBV4L_PUBLIC struct v4l2_rds *v4l2_rds_create(bool is_rbds);
- LIBV4L_PUBLIC void v4l2_rds_destroy(struct v4l2_rds *handle);
- LIBV4L_PUBLIC void v4l2_rds_reset(struct v4l2_rds *handle, bool reset_statistics);
- LIBV4L_PUBLIC uint32_t v4l2_rds_add(struct v4l2_rds *handle, struct v4l2_rds_data *rds_data);
- LIBV4L_PUBLIC const char *v4l2_rds_get_pty_str(const struct v4l2_rds *handle);
- LIBV4L_PUBLIC const char *v4l2_rds_get_language_str(const struct v4l2_rds *handle);
- LIBV4L_PUBLIC const char *v4l2_rds_get_country_str(const struct v4l2_rds *handle);
- LIBV4L_PUBLIC const char *v4l2_rds_get_coverage_str(const struct v4l2_rds *handle);
- LIBV4L_PUBLIC const struct v4l2_rds_group *v4l2_rds_get_group
- (const struct v4l2_rds *handle);
- #ifdef __cplusplus
- }
- #endif
- #endif
|