00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _SERVICES_H
00024 #define _SERVICES_H
00025
00026 #include <stdint.h>
00027
00028 #ifndef _DVBPSI_DESCRIPTOR_H_
00029 #include <dvbpsi/descriptor.h>
00030 #endif
00031
00032 #include "types.h"
00033 #include "objects.h"
00034 #include "multiplexes.h"
00035
00060 typedef enum {
00061 ServiceType_TV,
00062 ServiceType_Radio,
00063 ServiceType_Data,
00064 ServiceType_Unknown
00065 }ServiceType;
00066
00070 typedef struct Service_t
00071 {
00072 char *name;
00073 int multiplexUID;
00074 int id;
00075 int source;
00078 bool conditionalAccess;
00079 ServiceType type;
00080 int pmtVersion;
00081 int pmtPid;
00082 int pcrPid;
00084 char *provider;
00085 char *defaultAuthority;
00086 }
00087 Service_t;
00088
00092 typedef void *ServiceEnumerator_t;
00093
00097 #define ServiceAreEqual(_service1, _service2) \
00098 (((_service1)->multiplexUID == (_service2)->multiplexUID) && \
00099 ((_service1)->id == (_service2)->id))
00100
00105 int ServiceInit(void);
00106
00111 int ServiceDeinit(void);
00112
00113
00118 int ServiceCount();
00119
00125 int ServiceForMultiplexCount(int multiplexuid);
00126
00132 int ServiceDelete(Service_t *service);
00133
00147 int ServiceAdd(int multiplexuid, char *name, int id, int source, bool ca,
00148 ServiceType type, int pmtversion, int pmtpid, int pcrpid);
00149
00156 int ServicePMTVersionSet(Service_t *service, int pmtversion);
00157
00164 int ServicePMTPIDSet(Service_t *service, int pmtpid);
00165
00172 int ServicePCRPIDSet(Service_t *service, int pcrpid);
00173
00180 int ServiceNameSet(Service_t *service, char *name);
00181
00188 int ServiceSourceSet(Service_t *service, int source);
00189
00196 int ServiceConditionalAccessSet(Service_t *service, bool ca);
00197
00204 int ServiceTypeSet(Service_t *service, ServiceType type);
00211 int ServiceProviderSet(Service_t *service, char *provider);
00212
00219 int ServiceDefaultAuthoritySet(Service_t *service, char *defaultAuthority);
00220
00228 Service_t *ServiceFind(char *name);
00229
00236 Service_t *ServiceFindName(char *name);
00237
00245 Service_t *ServiceFindId(Multiplex_t *multiplex, int id);
00246
00255 Service_t *ServiceFindFQID(uint16_t networkId, uint16_t tsId, uint16_t serviceId);
00256
00265 Service_t *ServiceFindFQIDStr(char *FQIdStr);
00266
00271 ServiceEnumerator_t ServiceEnumeratorGet();
00272
00278 ServiceEnumerator_t ServiceEnumeratorForMultiplex(Multiplex_t *multiplex);
00279
00287 ServiceEnumerator_t ServiceFindByPID(int pid, Multiplex_t *opt_multiplex);
00288
00295 ServiceEnumerator_t ServiceQueryNameLike(char *query);
00296
00300 void ServiceEnumeratorDestroy(ServiceEnumerator_t enumerator);
00301
00309 Service_t *ServiceGetNext(ServiceEnumerator_t enumerator);
00310
00314 #define ServiceNew() (Service_t*)ObjectCreateType(Service_t)
00315
00320 #define ServiceRefInc(__service) \
00321 do{ \
00322 if ((__service)) \
00323 { \
00324 ObjectRefInc(__service); \
00325 } \
00326 }while(0)
00327
00333 #define ServiceRefDec(__service) \
00334 do{ \
00335 if ((__service)) \
00336 { \
00337 ObjectRefDec(__service); \
00338 } \
00339 }while(0)
00340
00342 #endif