1 /* 2 * camapplication.h - GStreamer CAM (EN50221) Application Layer 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_APPLICATION_LAYER_H 25 #define CAM_APPLICATION_LAYER_H 26 27 #include "cam.h" 28 #include "camsession.h" 29 30 #define CAM_AL(obj) ((CamAL *) obj) 31 #define CAM_AL_APPLICATION(obj) ((CamALApplication *) obj) 32 33 #define CAM_AL_RESOURCE_ID_IS_PUBLIC(resource_id) ((resource_id >> 30) != 3) 34 #define CAM_AL_RESOURCE_ID_CLASS(resource_id) ((resource_id >> 16) & 0x3FFF) 35 #define CAM_AL_RESOURCE_ID_TYPE(resource_id) ((resource_id >> 6) & 0x03FF) 36 #define CAM_AL_RESOURCE_ID_VERSION(resource_id) (resource_id & 0x3F) 37 38 #define CAM_AL_RESOURCE_MANAGER_ID 0x10041 39 #define CAM_AL_APPLICATION_INFO_ID 0x20041 40 #define CAM_AL_CONDITIONAL_ACCESS_ID 0x30041 41 42 typedef struct _CamAL CamAL; 43 typedef struct _CamALApplication CamALApplication; 44 45 struct _CamAL 46 { 47 CamSL *sl; 48 49 GHashTable *applications; 50 }; 51 52 struct _CamALApplication 53 { 54 CamAL *al; 55 guint resource_id; 56 GList *sessions; 57 58 /* vtable */ 59 CamReturn (*session_request) (CamALApplication *application, 60 CamSLSession *session, CamSLResourceStatus *status); 61 CamReturn (*open) (CamALApplication *application, CamSLSession *session); 62 CamReturn (*close) (CamALApplication *application, CamSLSession *session); 63 CamReturn (*data) (CamALApplication *application, CamSLSession *session, 64 guint tag, guint8 *buffer, guint length); 65 }; 66 67 CamAL *cam_al_new (CamSL *sl); 68 void cam_al_destroy (CamAL *al); 69 70 gboolean cam_al_install (CamAL *al, CamALApplication *application); 71 gboolean cam_al_uninstall (CamAL *al, CamALApplication *application); 72 CamALApplication *cam_al_get (CamAL *al, guint resource_id); 73 GList *cam_al_get_resource_ids (CamAL *al); 74 75 void cam_al_calc_buffer_size (CamAL *al, guint body_length, 76 guint *buffer_size, guint *offset); 77 78 void _cam_al_application_init (CamALApplication *application); 79 void _cam_al_application_destroy (CamALApplication *application); 80 81 CamReturn cam_al_application_write (CamALApplication *application, 82 CamSLSession *session, guint tag, guint8 *buffer, 83 guint buffer_size, guint body_length); 84 #endif /* CAM_APPLICATION_LAYER_H */ 85