eitd: change some of char* to uint8_t*

This commit is contained in:
[CST] Focus
2012-02-07 16:16:03 +04:00
parent 240ec1838f
commit aa26713474
3 changed files with 24 additions and 22 deletions

View File

@@ -407,7 +407,7 @@ void SIsectionEIT::parseShortEventDescriptor(const char *buf, SIevent &e, unsign
}
void SIsectionEIT::parseDescriptors(const char *des, unsigned len, SIevent &e)
void SIsectionEIT::parseDescriptors(const uint8_t *des, unsigned len, SIevent &e)
{
struct descr_generic_header *desc;
/* we pass the buffer including the eit_event header, so we have to
@@ -441,8 +441,8 @@ void SIsectionEIT::parseDescriptors(const char *des, unsigned len, SIevent &e)
// Die infos aus dem Puffer holen
void SIsectionEIT::parse(void)
{
const char *actPos;
const char *bufEnd;
const uint8_t *actPos;
const uint8_t *bufEnd;
struct eit_event *evt;
unsigned short descriptors_loop_length;
@@ -454,8 +454,12 @@ void SIsectionEIT::parse(void)
return;
}
#if 0
unsigned char table_id = header()->table_id;
unsigned char version_number = header()->version_number;
#endif
unsigned char table_id = getTableId();
unsigned char version_number = getVersionNumber();
actPos = buffer + sizeof(SI_section_EIT_header);
bufEnd = buffer + bufferLength;
@@ -527,7 +531,7 @@ void SIsectionSDT::parsePrivateDataDescriptor(const char *buf, SIservice &s)
s.serviceTyp = 0x01;
}
void SIsectionSDT::parseDescriptors(const char *des, unsigned len, SIservice &s)
void SIsectionSDT::parseDescriptors(const uint8_t *des, unsigned len, SIservice &s)
{
struct descr_generic_header *desc;
des += sizeof(struct sdt_service);
@@ -558,8 +562,8 @@ void SIsectionSDT::parseDescriptors(const char *des, unsigned len, SIservice &s)
// Die infos aus dem Puffer holen
void SIsectionSDT::parse(void)
{
const char *actPos;
const char *bufEnd;
const uint8_t *actPos;
const uint8_t *bufEnd;
struct sdt_service *sv;
unsigned short descriptors_loop_length;

View File

@@ -26,6 +26,7 @@
//
#include <endian.h>
#include <dvbsi++/event_information_section.h>
struct SI_section_SDT_header {
unsigned table_id : 8;
@@ -127,13 +128,14 @@ struct SI_section_header {
} __attribute__ ((packed)) ; // 8 bytes
class SIsection
class SIsection: public LongSection
{
public:
SIsection(void) { buffer = 0; bufferLength = 0;}
//SIsection(void) { buffer = 0; bufferLength = 0;}
// Benutzt den uebergebenen Puffer (sollte mit new char[n] allokiert sein)
SIsection(unsigned bufLength, char *buf) {
SIsection(unsigned bufLength, uint8_t *buf) : LongSection(buf)
{
buffer = 0; bufferLength = 0;
if ((buf) && (bufLength >= sizeof(struct SI_section_header))) {
buffer = buf;
@@ -146,6 +148,7 @@ public:
bufferLength = 0;
}
#if 0
unsigned char tableID(void) const {
return buffer ? ((struct SI_section_header *)buffer)->table_id : (unsigned char) -1;
}
@@ -170,7 +173,7 @@ public:
unsigned char lastSectionNumber(void) const {
return buffer ? ((struct SI_section_header *)buffer)->last_section_number : (unsigned char) -1;
}
#endif
struct SI_section_header const *header(void) const {
return (struct SI_section_header *)buffer;
}
@@ -269,7 +272,7 @@ public:
}
protected:
char *buffer;
uint8_t *buffer;
unsigned bufferLength;
};
@@ -315,7 +318,7 @@ public:
}
// Benutzt den uebergebenen Puffer (sollte mit new char[n] allokiert sein)
SIsectionEIT(unsigned bufLength, char *buf) : SIsection(bufLength, buf) {
SIsectionEIT(unsigned bufLength, uint8_t *buf) : SIsection(bufLength, buf) {
parsed = 0;
parse();
}
@@ -375,7 +378,7 @@ protected:
SIevents evts;
int parsed;
void parse(void);
void parseDescriptors(const char *desc, unsigned len, SIevent &e);
void parseDescriptors(const uint8_t *desc, unsigned len, SIevent &e);
void parseShortEventDescriptor(const char *buf, SIevent &e, unsigned maxlen);
void parseExtendedEventDescriptor(const char *buf, SIevent &e, unsigned maxlen);
void parseContentDescriptor(const char *buf, SIevent &e, unsigned maxlen);
@@ -404,7 +407,7 @@ public:
}
// Benutzt den uebergebenen Puffer (sollte mit new char[n] allokiert sein)
SIsectionSDT(unsigned bufLength, char *buf) : SIsection(bufLength, buf) {
SIsectionSDT(unsigned bufLength, uint8_t *buf) : SIsection(bufLength, buf) {
parsed = 0;
parse();
}
@@ -452,7 +455,7 @@ private:
SIservices svs;
int parsed;
void parse(void);
void parseDescriptors(const char *desc, unsigned len, SIservice &s);
void parseDescriptors(const uint8_t *desc, unsigned len, SIservice &s);
void parseServiceDescriptor(const char *buf, SIservice &s);
void parsePrivateDataDescriptor(const char *buf, SIservice &s);
void parseNVODreferenceDescriptor(const char *buf, SIservice &s);

View File

@@ -3353,12 +3353,7 @@ static void *eitThread(void *)
//FIXME DMX check this already
if (header->current_next_indicator)
{
// Wir wollen nur aktuelle sections
// Houdini: added new constructor where the buffer is given as a parameter and must be allocated outside
// -> no allocation and copy of data into a 2nd buffer
// SIsectionEIT eit(SIsection(section_length + 3, buf));
SIsectionEIT eit(section_length + 3, (char *) static_buf);
SIsectionEIT eit(section_length + 3, static_buf);
// Houdini: if section is not parsed (too short) -> no need to check events
if (eit.is_parsed() && eit.header())
{
@@ -3624,7 +3619,7 @@ static void *cnThread(void *)
continue;
}
SIsectionEIT eit(section_length + 3, (char *) static_buf);
SIsectionEIT eit(section_length + 3, static_buf);
// Houdini: if section is not parsed (too short) -> no need to check events
if (!eit.is_parsed() || !eit.header())
continue;