mirror of
				https://github.com/rofafor/vdr-plugin-femon.git
				synced 2023-10-10 11:36:53 +00:00 
			
		
		
		
	Adapted cFemonBitStream for vdr-1.7.22.
This commit is contained in:
		
							
								
								
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							@@ -415,7 +415,7 @@ VDR Plugin 'femon' Revision History
 | 
			
		||||
- Updated for vdr-1.7.18.
 | 
			
		||||
- Added scaling for symbols.
 | 
			
		||||
 | 
			
		||||
2011-xx-xx: Version 1.7.11
 | 
			
		||||
2011-12-04: Version 1.7.11
 | 
			
		||||
 | 
			
		||||
- Updated for vdr-1.7.22: New API functions for signal strength
 | 
			
		||||
  and quality used to provide information for the OSD.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								femon.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								femon.c
									
									
									
									
									
								
							@@ -14,8 +14,8 @@
 | 
			
		||||
#include "femonservice.h"
 | 
			
		||||
#include "femontools.h"
 | 
			
		||||
 | 
			
		||||
#if defined(APIVERSNUM) && APIVERSNUM < 10719
 | 
			
		||||
#error "VDR-1.7.19 API version or greater is required!"
 | 
			
		||||
#if defined(APIVERSNUM) && APIVERSNUM < 10722
 | 
			
		||||
#error "VDR-1.7.22 API version or greater is required!"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static const char VERSION[]       = "1.7.11";
 | 
			
		||||
 
 | 
			
		||||
@@ -851,7 +851,7 @@ eOSState cFemonOsd::ProcessKey(eKeys Key)
 | 
			
		||||
{
 | 
			
		||||
  eOSState state = cOsdObject::ProcessKey(Key);
 | 
			
		||||
  if (state == osUnknown) {
 | 
			
		||||
     switch (Key) {
 | 
			
		||||
     switch (int(Key)) {
 | 
			
		||||
       case k0:
 | 
			
		||||
            if ((m_Number == 0) && (m_OldNumber != 0)) {
 | 
			
		||||
               m_Number = m_OldNumber;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										39
									
								
								femontools.c
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								femontools.c
									
									
									
									
									
								
							@@ -544,45 +544,6 @@ cString getBitrateKbits(double value)
 | 
			
		||||
 | 
			
		||||
// --- cFemonBitStream -------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
int cFemonBitStream::GetBit(void)
 | 
			
		||||
{
 | 
			
		||||
  if (index >= length)
 | 
			
		||||
     return 1;
 | 
			
		||||
  int r = (data[index >> 3] >> (7 - (index & 7))) & 1;
 | 
			
		||||
  ++index;
 | 
			
		||||
  return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t cFemonBitStream::GetBits(int n)
 | 
			
		||||
{
 | 
			
		||||
  uint32_t r = 0;
 | 
			
		||||
  while (n--)
 | 
			
		||||
        r |= GetBit() << n;
 | 
			
		||||
  return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cFemonBitStream::ByteAlign(void)
 | 
			
		||||
{
 | 
			
		||||
  int n = index % 8;
 | 
			
		||||
  if (n > 0)
 | 
			
		||||
     SkipBits(8 - n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void cFemonBitStream::WordAlign(void)
 | 
			
		||||
{
 | 
			
		||||
  int n = index % 16;
 | 
			
		||||
  if (n > 0)
 | 
			
		||||
     SkipBits(16 - n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cFemonBitStream::SetLength(int Length)
 | 
			
		||||
{
 | 
			
		||||
  if (Length > length)
 | 
			
		||||
     return false;
 | 
			
		||||
  length = Length;
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t cFemonBitStream::GetUeGolomb()
 | 
			
		||||
{
 | 
			
		||||
  int n = 0;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								femontools.h
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								femontools.h
									
									
									
									
									
								
							@@ -71,27 +71,9 @@ cString getVideoBitrate(double value, double stream);
 | 
			
		||||
cString getBitrateMbits(double value);
 | 
			
		||||
cString getBitrateKbits(double value);
 | 
			
		||||
 | 
			
		||||
class cFemonBitStream {
 | 
			
		||||
private:
 | 
			
		||||
  const uint8_t *data;
 | 
			
		||||
  int length; // in bits
 | 
			
		||||
  int index; // in bits
 | 
			
		||||
class cFemonBitStream : public cBitStream {
 | 
			
		||||
public:
 | 
			
		||||
  cFemonBitStream(const uint8_t *Data, int Length) : data(Data), length(Length), index(0) {}
 | 
			
		||||
  ~cFemonBitStream() {}
 | 
			
		||||
  int GetBit(void);
 | 
			
		||||
  uint32_t GetBits(int n);
 | 
			
		||||
  void ByteAlign(void);
 | 
			
		||||
  void WordAlign(void);
 | 
			
		||||
  bool SetLength(int Length);
 | 
			
		||||
  void SkipBits(int n) { index += n; }
 | 
			
		||||
  void SkipBit(void) { SkipBits(1); }
 | 
			
		||||
  bool IsEOF(void) const { return index >= length; }
 | 
			
		||||
  void Reset(void) { index = 0; }
 | 
			
		||||
  int Length(void) const { return length; }
 | 
			
		||||
  int Index(void) const { return (IsEOF() ? length : index); }
 | 
			
		||||
  const uint8_t *GetData(void) const { return (IsEOF() ? NULL : data + (index / 8)); }
 | 
			
		||||
 | 
			
		||||
  cFemonBitStream(const uint8_t *Data, const int Length) : cBitStream(Data, Length) {}
 | 
			
		||||
  uint32_t       GetUeGolomb();
 | 
			
		||||
  int32_t        GetSeGolomb();
 | 
			
		||||
  void           SkipGolomb();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user