• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * camutils.h - GStreamer CAM (EN50221) support
3  * Copyright (C) 2007 Alessandro Decina
4  *
5  * Authors:
6  *   Alessandro Decina <alessandro.d@gmail.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef CAM_UTILS_H
25 #define CAM_UTILS_H
26 
27 #include <glib.h>
28 #include <gst/gst.h>
29 #include <gst/mpegts/mpegts.h>
30 
31 #define TPDU_HEADER_SIZE_INDICATOR 0x80
32 
33 #define CAM_FAILED(ret) (ret <= CAM_RETURN_ERROR)
34 
35 typedef enum
36 {
37   /* generic */
38   CAM_RETURN_OK = 0,
39   CAM_RETURN_ERROR = -1,
40 
41   /* transport specific */
42   CAM_RETURN_TRANSPORT_ERROR = -10,
43   CAM_RETURN_TRANSPORT_TOO_MANY_CONNECTIONS = -11,
44   CAM_RETURN_TRANSPORT_TIMEOUT = -12,
45   CAM_RETURN_TRANSPORT_POLL = -13,
46 
47   /* session specific */
48   CAM_RETURN_SESSION_ERROR = -30,
49   CAM_RETURN_SESSION_TOO_MANY_SESSIONS = -31,
50 
51   /* application specific */
52   CAM_RETURN_APPLICATION_ERROR = -40,
53 } CamReturn;
54 
55 guint8 cam_calc_length_field_size (guint length);
56 guint8 cam_write_length_field (guint8 *buff, guint length);
57 guint8 cam_read_length_field (guint8 *buff, guint *length);
58 guint8 *cam_build_ca_pmt (GstMpegtsPMT *pmt, guint8 list_management, guint8 cmd_id, guint *size);
59 
60 #endif /* CAM_UTILS_H */
61