dvb-file.h
Go to the documentation of this file.
/*
* Copyright (c) 2011-2014 - Mauro Carvalho Chehab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation version 2.1 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
*/
#ifndef _DVB_FILE_H
#define _DVB_FILE_H
#include "dvb-fe.h"
/*
* DVB structures used to represent all files opened by the libdvbv5 library.
*
* Those structs represents each individual entry on a file, and the file
* as a whole.
*/
struct dvb_elementary_pid {
uint8_t type;
uint16_t pid;
};
struct dvb_entry {
struct dtv_property props[DTV_MAX_COMMAND];
unsigned int n_props;
struct dvb_entry *next;
uint16_t service_id;
uint16_t *video_pid, *audio_pid;
struct dvb_elementary_pid *other_el_pid;
unsigned video_pid_len, audio_pid_len, other_el_pid_len;
char *channel;
char *vchannel;
char *location;
int sat_number;
unsigned freq_bpf;
unsigned diseqc_wait;
char *lnb;
uint16_t network_id;
uint16_t transport_id;
};
struct dvb_file {
char *fname;
int n_entries;
struct dvb_entry *first_entry;
};
/*
* DVB file format tables
*
* The structs below are used to represent oneline formats like the ones
* commonly found on DVB legacy applications.
*/
struct dvb_parse_table {
unsigned int prop;
const char **table;
unsigned int size;
int mult_factor;
int has_default_value;
int default_value;
};
struct dvb_parse_struct {
char *id;
uint32_t delsys;
const struct dvb_parse_table *table;
unsigned int size;
};
struct dvb_parse_file {
int has_delsys_id;
char *delimiter;
struct dvb_parse_struct formats[];
};
enum dvb_file_formats {
FILE_UNKNOWN,
FILE_ZAP,
FILE_CHANNEL,
FILE_DVBV5,
FILE_VDR,
};
struct dvb_v5_descriptors;
#ifdef __cplusplus
extern "C" {
#endif
static inline void dvb_file_free(struct dvb_file *dvb_file)
{
struct dvb_entry *entry = dvb_file->first_entry, *next;
while (entry) {
next = entry->next;
if (entry->channel)
free(entry->channel);
if (entry->vchannel)
free(entry->vchannel);
if (entry->location)
free(entry->location);
if (entry->video_pid)
free(entry->video_pid);
if (entry->audio_pid)
free(entry->audio_pid);
if (entry->other_el_pid)
free(entry->other_el_pid);
if (entry->lnb)
free(entry->lnb);
free(entry);
entry = next;
}
free(dvb_file);
}
/*
* File format description structures defined for the several formats that
* the library can read natively.
*/
extern const struct dvb_parse_file channel_file_format;
extern const struct dvb_parse_file channel_file_zap_format;
/*
* Prototypes for the several functions defined at dvb-file.c
*/
struct dvb_file *dvb_read_file(const char *fname);
int dvb_write_file(const char *fname, struct dvb_file *dvb_file);
struct dvb_file *dvb_read_file_format(const char *fname,
uint32_t delsys,
enum dvb_file_formats format);
int dvb_write_file_format(const char *fname,
struct dvb_file *dvb_file,
uint32_t delsys,
enum dvb_file_formats format);
int dvb_store_entry_prop(struct dvb_entry *entry,
uint32_t cmd, uint32_t value);
int dvb_retrieve_entry_prop(struct dvb_entry *entry,
uint32_t cmd, uint32_t *value);
int dvb_store_channel(struct dvb_file **dvb_file,
struct dvb_v5_fe_parms *parms,
struct dvb_v5_descriptors *dvb_desc,
int get_detected, int get_nit);
int dvb_parse_delsys(const char *name);
enum dvb_file_formats dvb_parse_format(const char *name);
/*
* Routines to read a non-libdvbv5 format. They're called by
* dvb_read_file_format() or dvb_write_file_format()
*/
struct dvb_file *dvb_parse_format_oneline(const char *fname,
uint32_t delsys,
const struct dvb_parse_file *parse_file);
int dvb_write_format_oneline(const char *fname,
struct dvb_file *dvb_file,
uint32_t delsys,
const struct dvb_parse_file *parse_file);
int dvb_write_format_vdr(const char *fname,
struct dvb_file *dvb_file);
#ifdef __cplusplus
}
#endif
#endif // _DVB_FILE_H
dvb-fe.h
Provides interfaces to deal with DVB frontend.
dvb_file_formats
dvb_file_formats
Definition dvb-file.h:232
FILE_VDR
@ FILE_VDR
File is at DVR format (as supported on version 2.1.6).
Definition dvb-file.h:237
FILE_ZAP
@ FILE_ZAP
File is at the dvb-apps "dvbzap" format.
Definition dvb-file.h:234
FILE_CHANNEL
@ FILE_CHANNEL
File is at the dvb-apps output format for dvb-zap.
Definition dvb-file.h:235
FILE_UNKNOWN
@ FILE_UNKNOWN
File format is unknown.
Definition dvb-file.h:233
FILE_DVBV5
@ FILE_DVBV5
File is at libdvbv5 format.
Definition dvb-file.h:236
dvb_read_file_format
struct dvb_file * dvb_read_file_format(const char *fname, uint32_t delsys, enum dvb_file_formats format)
Read a file on any format natively supported by the library.
dvb_retrieve_entry_prop
int dvb_retrieve_entry_prop(struct dvb_entry *entry, uint32_t cmd, uint32_t *value)
Retrieves the value associated witha key on a DVB file entry.
dvb_write_file_format
int dvb_write_file_format(const char *fname, struct dvb_file *dvb_file, uint32_t delsys, enum dvb_file_formats format)
Write a file on any format natively supported by the library.
dvb_file_free
static void dvb_file_free(struct dvb_file *dvb_file)
Deallocates memory associated with a struct dvb_file.
Definition dvb-file.h:255
dvb_parse_format_oneline
struct dvb_file * dvb_parse_format_oneline(const char *fname, uint32_t delsys, const struct dvb_parse_file *parse_file)
Read and parses a one line file format.
dvb_store_entry_prop
int dvb_store_entry_prop(struct dvb_entry *entry, uint32_t cmd, uint32_t value)
Stores a key/value pair on a DVB file entry.
channel_file_zap_format
const struct dvb_parse_file channel_file_zap_format
File format definitions for dvb-apps zap format.
dvb_store_channel
int dvb_store_channel(struct dvb_file **dvb_file, struct dvb_v5_fe_parms *parms, struct dvb_v5_descriptors *dvb_desc, int get_detected, int get_nit)
stored a new scanned channel into a dvb_file struct
dvb_write_format_oneline
int dvb_write_format_oneline(const char *fname, struct dvb_file *dvb_file, uint32_t delsys, const struct dvb_parse_file *parse_file)
Writes a file into an one line file format.
dvb_write_format_vdr
int dvb_write_format_vdr(const char *fname, struct dvb_file *dvb_file)
Writes a file into vdr format (compatible up to version 2.1)
dvb_read_file
struct dvb_file * dvb_read_file(const char *fname)
Read a file at libdvbv5 format.
dvb_parse_format
enum dvb_file_formats dvb_parse_format(const char *name)
Ancillary function that parses the name of a file format.
dvb_write_file
int dvb_write_file(const char *fname, struct dvb_file *dvb_file)
Write a file at libdvbv5 format.
channel_file_format
const struct dvb_parse_file channel_file_format
File format definitions for dvb-apps channel format.
dvb_parse_delsys
int dvb_parse_delsys(const char *name)
Ancillary function that seeks for a delivery system.
dvb_desc
Linked list containing the several descriptors found on a MPEG-TS table.
Definition descriptors.h:117
dvb_elementary_pid
associates an elementary stream type with its PID
Definition dvb-file.h:58
dvb_elementary_pid::pid
uint16_t pid
Definition dvb-file.h:60
dvb_elementary_pid::type
uint8_t type
Definition dvb-file.h:59
dvb_entry
Represents one entry on a DTV file.
Definition dvb-file.h:104
dvb_entry::audio_pid_len
unsigned audio_pid_len
Definition dvb-file.h:111
dvb_entry::lnb
char * lnb
Definition dvb-file.h:120
dvb_entry::location
char * location
Definition dvb-file.h:115
dvb_entry::n_props
unsigned int n_props
Definition dvb-file.h:106
dvb_entry::props
struct dtv_property props[DTV_MAX_COMMAND]
Definition dvb-file.h:105
dvb_entry::other_el_pid
struct dvb_elementary_pid * other_el_pid
Definition dvb-file.h:110
dvb_entry::video_pid
uint16_t * video_pid
Definition dvb-file.h:109
dvb_entry::audio_pid
uint16_t * audio_pid
Definition dvb-file.h:109
dvb_entry::diseqc_wait
unsigned diseqc_wait
Definition dvb-file.h:119
dvb_entry::video_pid_len
unsigned video_pid_len
Definition dvb-file.h:111
dvb_entry::other_el_pid_len
unsigned other_el_pid_len
Definition dvb-file.h:111
dvb_entry::network_id
uint16_t network_id
Definition dvb-file.h:122
dvb_entry::channel
char * channel
Definition dvb-file.h:112
dvb_entry::transport_id
uint16_t transport_id
Definition dvb-file.h:123
dvb_entry::service_id
uint16_t service_id
Definition dvb-file.h:108
dvb_entry::next
struct dvb_entry * next
Definition dvb-file.h:107
dvb_entry::freq_bpf
unsigned freq_bpf
Definition dvb-file.h:118
dvb_entry::sat_number
int sat_number
Definition dvb-file.h:117
dvb_entry::vchannel
char * vchannel
Definition dvb-file.h:113
dvb_file
Describes an entire DVB file opened.
Definition dvb-file.h:135
dvb_file::n_entries
int n_entries
Definition dvb-file.h:137
dvb_file::first_entry
struct dvb_entry * first_entry
Definition dvb-file.h:138
dvb_file::fname
char * fname
Definition dvb-file.h:136
dvb_parse_file
Describes an entire file format.
Definition dvb-file.h:203
dvb_parse_file::delimiter
char * delimiter
Definition dvb-file.h:205
dvb_parse_file::formats
struct dvb_parse_struct formats[]
Definition dvb-file.h:206
dvb_parse_file::has_delsys_id
int has_delsys_id
Definition dvb-file.h:204
dvb_parse_struct
Describes the format to parse an specific delivery system.
Definition dvb-file.h:185
dvb_parse_struct::size
unsigned int size
Definition dvb-file.h:189
dvb_parse_struct::id
char * id
Definition dvb-file.h:186
dvb_parse_struct::delsys
uint32_t delsys
Definition dvb-file.h:187
dvb_parse_struct::table
const struct dvb_parse_table * table
Definition dvb-file.h:188
dvb_parse_table
Describes the fields to parse on a file.
Definition dvb-file.h:165
dvb_parse_table::prop
unsigned int prop
Definition dvb-file.h:166
dvb_parse_table::has_default_value
int has_default_value
Definition dvb-file.h:170
dvb_parse_table::table
const char ** table
Definition dvb-file.h:167
dvb_parse_table::size
unsigned int size
Definition dvb-file.h:168
dvb_parse_table::mult_factor
int mult_factor
Definition dvb-file.h:169
dvb_parse_table::default_value
int default_value
Definition dvb-file.h:171
dvb_v5_descriptors
Contains the descriptors needed to scan the Service ID and other relevant info at a MPEG-TS Digital T...
Definition dvb-scan.h:87
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition dvb-fe.h:117