libdvbv5  1.11.0
Library to work with Digital TV devices on Linux
dvb-file.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2014 - Mauro Carvalho Chehab
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation version 2.1 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, write to the Free Software
15  */
16 #ifndef _DVB_FILE_H
17 #define _DVB_FILE_H
18 
19 #include "dvb-fe.h"
20 
43 /*
44  * DVB structures used to represent all files opened by the libdvbv5 library.
45  *
46  * Those structs represents each individual entry on a file, and the file
47  * as a whole.
48  */
49 
59  uint8_t type;
60  uint16_t pid;
61 };
62 
104 struct dvb_entry {
105  struct dtv_property props[DTV_MAX_COMMAND];
106  unsigned int n_props;
107  struct dvb_entry *next;
108  uint16_t service_id;
109  uint16_t *video_pid, *audio_pid;
112  char *channel;
113  char *vchannel;
114 
115  char *location;
116 
118  unsigned freq_bpf;
119  unsigned diseqc_wait;
120  char *lnb;
121 };
122 
131 struct dvb_file {
132  char *fname;
135 };
136 
137 /*
138  * DVB file format tables
139  *
140  * The structs below are used to represent oneline formats like the ones
141  * commonly found on DVB legacy applications.
142  */
143 
162  unsigned int prop;
163  const char **table;
164  unsigned int size;
168 };
182  char *id;
183  uint32_t delsys;
184  const struct dvb_parse_table *table;
185  unsigned int size;
186 };
187 
201  char *delimiter;
203 };
204 
234 };
235 
236 struct dvb_v5_descriptors;
237 
238 #ifdef __cplusplus
239 extern "C" {
240 #endif
241 
251 static inline void dvb_file_free(struct dvb_file *dvb_file)
252 {
253  struct dvb_entry *entry = dvb_file->first_entry, *next;
254  while (entry) {
255  next = entry->next;
256  if (entry->channel)
257  free(entry->channel);
258  if (entry->vchannel)
259  free(entry->vchannel);
260  if (entry->location)
261  free(entry->location);
262  if (entry->video_pid)
263  free(entry->video_pid);
264  if (entry->audio_pid)
265  free(entry->audio_pid);
266  if (entry->other_el_pid)
267  free(entry->other_el_pid);
268  if (entry->lnb)
269  free(entry->lnb);
270  free(entry);
271  entry = next;
272  }
273  free(dvb_file);
274 }
275 
276 /*
277  * File format description structures defined for the several formats that
278  * the library can read natively.
279  */
280 
285 extern const struct dvb_parse_file channel_file_format;
286 
291 extern const struct dvb_parse_file channel_file_zap_format;
292 
293 /*
294  * Prototypes for the several functions defined at dvb-file.c
295  */
296 
306 struct dvb_file *dvb_read_file(const char *fname);
307 
317 int dvb_write_file(const char *fname, struct dvb_file *dvb_file);
318 
331 struct dvb_file *dvb_read_file_format(const char *fname,
332  uint32_t delsys,
333  enum dvb_file_formats format);
334 
347 int dvb_write_file_format(const char *fname,
348  struct dvb_file *dvb_file,
349  uint32_t delsys,
350  enum dvb_file_formats format);
351 
352 
368 int dvb_store_entry_prop(struct dvb_entry *entry,
369  uint32_t cmd, uint32_t value);
370 
385 int dvb_retrieve_entry_prop(struct dvb_entry *entry,
386  uint32_t cmd, uint32_t *value);
387 
421 int dvb_store_channel(struct dvb_file **dvb_file,
422  struct dvb_v5_fe_parms *parms,
424  int get_detected, int get_nit);
425 
444 int dvb_parse_delsys(const char *name);
445 
457 enum dvb_file_formats dvb_parse_format(const char *name);
458 
459 /*
460  * Routines to read a non-libdvbv5 format. They're called by
461  * dvb_read_file_format() or dvb_write_file_format()
462  */
463 
476 struct dvb_file *dvb_parse_format_oneline(const char *fname,
477  uint32_t delsys,
478  const struct dvb_parse_file *parse_file);
479 
493 int dvb_write_format_oneline(const char *fname,
494  struct dvb_file *dvb_file,
495  uint32_t delsys,
496  const struct dvb_parse_file *parse_file);
497 
509 int dvb_write_format_vdr(const char *fname,
510  struct dvb_file *dvb_file);
511 
512 #ifdef __cplusplus
513 }
514 #endif
515 
516 #endif // _DVB_FILE_H
File is at the dvb-apps output format for dvb-zap.
Definition: dvb-file.h:231
unsigned video_pid_len
Definition: dvb-file.h:111
char * channel
Definition: dvb-file.h:112
int n_entries
Definition: dvb-file.h:133
Describes an entire file format.
Definition: dvb-file.h:199
int dvb_parse_delsys(const char *name)
Ancillary function that seeks for a delivery system.
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)
char * delimiter
Definition: dvb-file.h:201
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.
File format is unknown.
Definition: dvb-file.h:229
Describes an entire DVB file opened.
Definition: dvb-file.h:131
Describes the format to parse an specific delivery system.
Definition: dvb-file.h:181
struct dvb_elementary_pid * other_el_pid
Definition: dvb-file.h:110
int has_default_value
Definition: dvb-file.h:166
File is at libdvbv5 format.
Definition: dvb-file.h:232
File is at DVR format (as supported on version 2.1.6).
Definition: dvb-file.h:233
uint16_t * audio_pid
Definition: dvb-file.h:109
char * vchannel
Definition: dvb-file.h:113
const struct dvb_parse_table * table
Definition: dvb-file.h:184
char * lnb
Definition: dvb-file.h:120
const char ** table
Definition: dvb-file.h:163
unsigned other_el_pid_len
Definition: dvb-file.h:111
unsigned int n_props
Definition: dvb-file.h:106
uint16_t service_id
Definition: dvb-file.h:108
struct dvb_parse_struct formats[]
Definition: dvb-file.h:202
File is at the dvb-apps "dvbzap" format.
Definition: dvb-file.h:230
unsigned int size
Definition: dvb-file.h:185
dvb_file_formats
Known file formats.
Definition: dvb-file.h:228
int sat_number
Definition: dvb-file.h:117
unsigned int size
Definition: dvb-file.h:164
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.
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.
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
unsigned int prop
Definition: dvb-file.h:162
struct dvb_entry * next
Definition: dvb-file.h:107
struct dvb_entry * first_entry
Definition: dvb-file.h:134
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.
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:117
char * fname
Definition: dvb-file.h:132
struct dtv_property props[DTV_MAX_COMMAND]
Definition: dvb-file.h:105
unsigned audio_pid_len
Definition: dvb-file.h:111
int dvb_write_file(const char *fname, struct dvb_file *dvb_file)
Write a file at libdvbv5 format.
unsigned diseqc_wait
Definition: dvb-file.h:119
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.
int has_delsys_id
Definition: dvb-file.h:200
uint16_t * video_pid
Definition: dvb-file.h:109
const struct dvb_parse_file channel_file_zap_format
File format definitions for dvb-apps zap 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.
Describes the fields to parse on a file.
Definition: dvb-file.h:161
enum dvb_file_formats dvb_parse_format(const char *name)
Ancillary function that parses the name of a file format.
unsigned freq_bpf
Definition: dvb-file.h:118
Linked list containing the several descriptors found on a MPEG-TS table.
Definition: descriptors.h:117
associates an elementary stream type with its PID
Definition: dvb-file.h:58
char * location
Definition: dvb-file.h:115
Represents one entry on a DTV file.
Definition: dvb-file.h:104
uint32_t delsys
Definition: dvb-file.h:183
Contains the descriptors needed to scan the Service ID and other relevant info at a MPEG-TS Digital T...
Definition: dvb-scan.h:87
uint16_t pid
Definition: dvb-file.h:60
struct dvb_file * dvb_read_file(const char *fname)
Read a file at libdvbv5 format.
Provides interfaces to deal with DVB frontend.
static void dvb_file_free(struct dvb_file *dvb_file)
Deallocates memory associated with a struct dvb_file.
Definition: dvb-file.h:251
const struct dvb_parse_file channel_file_format
File format definitions for dvb-apps channel format.