libdvbv5  1.6.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
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation version 2
7  * of the License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  */
14 #ifndef _DVB_FILE_H
15 #define _DVB_FILE_H
16 
17 #include "dvb-fe.h"
18 
41 /*
42  * DVB structures used to represent all files opened by the libdvbv5 library.
43  *
44  * Those structs represents each individual entry on a file, and the file
45  * as a hole.
46  */
47 
57  uint8_t type;
58  uint16_t pid;
59 };
60 
102 struct dvb_entry {
103  struct dtv_property props[DTV_MAX_COMMAND];
104  unsigned int n_props;
105  struct dvb_entry *next;
106  uint16_t service_id;
107  uint16_t *video_pid, *audio_pid;
110  char *channel;
111  char *vchannel;
112 
113  char *location;
114 
116  unsigned freq_bpf;
117  unsigned diseqc_wait;
118  char *lnb;
119 };
120 
129 struct dvb_file {
130  char *fname;
133 };
134 
135 /*
136  * DVB file format tables
137  *
138  * The structs below are used to represent oneline formats like the ones
139  * commonly found on DVB legacy applications.
140  */
141 
160  unsigned int prop;
161  const char **table;
162  unsigned int size;
166 };
180  char *id;
181  uint32_t delsys;
182  const struct dvb_parse_table *table;
183  unsigned int size;
184 };
185 
199  char *delimiter;
201 };
202 
232 };
233 
234 struct dvb_v5_descriptors;
235 
236 #ifdef __cplusplus
237 extern "C" {
238 #endif
239 
249 static inline void dvb_file_free(struct dvb_file *dvb_file)
250 {
251  struct dvb_entry *entry = dvb_file->first_entry, *next;
252  while (entry) {
253  next = entry->next;
254  if (entry->channel)
255  free(entry->channel);
256  if (entry->vchannel)
257  free(entry->vchannel);
258  if (entry->location)
259  free(entry->location);
260  if (entry->video_pid)
261  free(entry->video_pid);
262  if (entry->audio_pid)
263  free(entry->audio_pid);
264  if (entry->other_el_pid)
265  free(entry->other_el_pid);
266  if (entry->lnb)
267  free(entry->lnb);
268  free(entry);
269  entry = next;
270  }
271  free(dvb_file);
272 }
273 
274 /*
275  * File format description structures defined for the several formats that
276  * the library can read natively.
277  */
278 
283 extern const struct dvb_parse_file channel_file_format;
284 
289 extern const struct dvb_parse_file channel_file_zap_format;
290 
291 /*
292  * Prototypes for the several functions defined at dvb-file.c
293  */
294 
304 struct dvb_file *dvb_read_file(const char *fname);
305 
315 int dvb_write_file(const char *fname, struct dvb_file *dvb_file);
316 
329 struct dvb_file *dvb_read_file_format(const char *fname,
330  uint32_t delsys,
331  enum dvb_file_formats format);
332 
345 int dvb_write_file_format(const char *fname,
346  struct dvb_file *dvb_file,
347  uint32_t delsys,
348  enum dvb_file_formats format);
349 
350 
366 int dvb_store_entry_prop(struct dvb_entry *entry,
367  uint32_t cmd, uint32_t value);
368 
383 int dvb_retrieve_entry_prop(struct dvb_entry *entry,
384  uint32_t cmd, uint32_t *value);
385 
419 int dvb_store_channel(struct dvb_file **dvb_file,
420  struct dvb_v5_fe_parms *parms,
422  int get_detected, int get_nit);
423 
442 int dvb_parse_delsys(const char *name);
443 
455 enum dvb_file_formats dvb_parse_format(const char *name);
456 
457 /*
458  * Routines to read a non-libdvbv5 format. They're called by
459  * dvb_read_file_format() or dvb_write_file_format()
460  */
461 
474 struct dvb_file *dvb_parse_format_oneline(const char *fname,
475  uint32_t delsys,
476  const struct dvb_parse_file *parse_file);
477 
491 int dvb_write_format_oneline(const char *fname,
492  struct dvb_file *dvb_file,
493  uint32_t delsys,
494  const struct dvb_parse_file *parse_file);
495 
507 int dvb_write_format_vdr(const char *fname,
508  struct dvb_file *dvb_file);
509 
510 #ifdef __cplusplus
511 }
512 #endif
513 
514 #endif // _DVB_FILE_H
File is at the dvb-apps output format for dvb-zap.
Definition: dvb-file.h:229
unsigned video_pid_len
Definition: dvb-file.h:109
char * channel
Definition: dvb-file.h:110
int n_entries
Definition: dvb-file.h:131
Describes an entire file format.
Definition: dvb-file.h:197
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:199
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:227
Describes an entire DVB file opened.
Definition: dvb-file.h:129
Describes the format to parse an specific delivery system.
Definition: dvb-file.h:179
struct dvb_elementary_pid * other_el_pid
Definition: dvb-file.h:108
int has_default_value
Definition: dvb-file.h:164
File is at libdvbv5 format.
Definition: dvb-file.h:230
File is at DVR format (as supported on version 2.1.6).
Definition: dvb-file.h:231
uint16_t * audio_pid
Definition: dvb-file.h:107
char * vchannel
Definition: dvb-file.h:111
const struct dvb_parse_table * table
Definition: dvb-file.h:182
char * lnb
Definition: dvb-file.h:118
const char ** table
Definition: dvb-file.h:161
unsigned other_el_pid_len
Definition: dvb-file.h:109
unsigned int n_props
Definition: dvb-file.h:104
uint16_t service_id
Definition: dvb-file.h:106
struct dvb_parse_struct formats[]
Definition: dvb-file.h:200
File is at the dvb-apps "dvbzap" format.
Definition: dvb-file.h:228
unsigned int size
Definition: dvb-file.h:183
dvb_file_formats
Known file formats.
Definition: dvb-file.h:226
int sat_number
Definition: dvb-file.h:115
unsigned int size
Definition: dvb-file.h:162
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:160
struct dvb_entry * next
Definition: dvb-file.h:105
struct dvb_entry * first_entry
Definition: dvb-file.h:132
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:118
char * fname
Definition: dvb-file.h:130
struct dtv_property props[DTV_MAX_COMMAND]
Definition: dvb-file.h:103
unsigned audio_pid_len
Definition: dvb-file.h:109
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:117
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:198
uint16_t * video_pid
Definition: dvb-file.h:107
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:159
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:116
Linked list containing the several descriptors found on a MPEG-TS table.
Definition: descriptors.h:118
associates an elementary stream type with its PID
Definition: dvb-file.h:56
char * location
Definition: dvb-file.h:113
Represents one entry on a DTV file.
Definition: dvb-file.h:102
uint32_t delsys
Definition: dvb-file.h:181
Contains the descriptors needed to scan the Service ID and other relevant info at a MPEG-TS Digital T...
Definition: dvb-scan.h:78
uint16_t pid
Definition: dvb-file.h:58
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:249
const struct dvb_parse_file channel_file_format
File format definitions for dvb-apps channel format.