mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
libraspi: some manual code nicenings
Origin commit data
------------------
Branch: master
Commit: 4e5af3aef5
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-11-07 (Sun, 07 Nov 2021)
Origin message was:
------------------
- libraspi: some manual code nicenings
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -118,8 +118,7 @@ void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &m
|
||||
freq = 0;
|
||||
bitrate = 0; /* not used, but easy to get :-) */
|
||||
mode = 0; /* default: stereo */
|
||||
hal_debug("%s t: %d l: %d f: %d b: %d m: %d\n",
|
||||
__func__, type, layer, freq, bitrate, mode);
|
||||
hal_debug("%s t: %d l: %d f: %d b: %d m: %d\n", __func__, type, layer, freq, bitrate, mode);
|
||||
};
|
||||
|
||||
void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int /*iq_level*/)
|
||||
|
@@ -41,6 +41,7 @@ typedef enum
|
||||
class cAudio
|
||||
{
|
||||
friend class cPlayback;
|
||||
|
||||
private:
|
||||
int fd;
|
||||
bool Muted;
|
||||
@@ -67,35 +68,17 @@ class cAudio
|
||||
/* construct & destruct */
|
||||
cAudio(void *, void *, void *);
|
||||
~cAudio(void);
|
||||
int64_t getPts()
|
||||
{
|
||||
return curr_pts;
|
||||
}
|
||||
int64_t getPts() { return curr_pts; }
|
||||
|
||||
void *GetHandle()
|
||||
{
|
||||
return NULL;
|
||||
};
|
||||
void *GetHandle() { return NULL; };
|
||||
/* shut up */
|
||||
int mute(bool remember = true)
|
||||
{
|
||||
return do_mute(true, remember);
|
||||
};
|
||||
int unmute(bool remember = true)
|
||||
{
|
||||
return do_mute(false, remember);
|
||||
};
|
||||
int mute(bool remember = true) { return do_mute(true, remember); };
|
||||
int unmute(bool remember = true) { return do_mute(false, remember); };
|
||||
|
||||
/* volume, min = 0, max = 255 */
|
||||
int setVolume(unsigned int left, unsigned int right);
|
||||
int getVolume(void)
|
||||
{
|
||||
return volume;
|
||||
}
|
||||
bool getMuteStatus(void)
|
||||
{
|
||||
return Muted;
|
||||
};
|
||||
int getVolume(void) { return volume; }
|
||||
bool getMuteStatus(void) { return Muted; };
|
||||
|
||||
/* start and stop audio */
|
||||
int Start(void);
|
||||
|
@@ -111,8 +111,8 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe
|
||||
hal_info("%s %s: %m\n", __FUNCTION__, devname[devnum]);
|
||||
return false;
|
||||
}
|
||||
hal_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__,
|
||||
num, DMX_T[pes_type], pes_type, uBufferSize, fd);
|
||||
hal_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n",
|
||||
__func__, num, DMX_T[pes_type], pes_type, uBufferSize, fd);
|
||||
|
||||
if (dmx_type == DMX_VIDEO_CHANNEL)
|
||||
uBufferSize = 0x100000; /* 1MB */
|
||||
@@ -346,8 +346,8 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte
|
||||
if (timeout == 0 && negmask == NULL)
|
||||
s_flt.timeout = to;
|
||||
|
||||
hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n", __func__, num,
|
||||
pid, fd, DMX_T[dmx_type], len, s_flt.timeout, s_flt.flags, s_flt.filter.filter[0]);
|
||||
hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n",
|
||||
__func__, num, pid, fd, DMX_T[dmx_type], len, s_flt.timeout, s_flt.flags, s_flt.filter.filter[0]);
|
||||
|
||||
if (debuglevel == 2)
|
||||
{
|
||||
@@ -355,10 +355,10 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte
|
||||
for (int i = 0; i < DMX_FILTER_SIZE; i++)fprintf(stderr, "%02hhx ", s_flt.filter.filter[i]);
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "mask: ");
|
||||
for (int i = 0; i < DMX_FILTER_SIZE; i++)fprintf(stderr, "%02hhx ", s_flt.filter.mask [i]);
|
||||
for (int i = 0; i < DMX_FILTER_SIZE; i++)fprintf(stderr, "%02hhx ", s_flt.filter.mask[i]);
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "mode: ");
|
||||
for (int i = 0; i < DMX_FILTER_SIZE; i++)fprintf(stderr, "%02hhx ", s_flt.filter.mode [i]);
|
||||
for (int i = 0; i < DMX_FILTER_SIZE; i++)fprintf(stderr, "%02hhx ", s_flt.filter.mode[i]);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,7 @@ class cDemux
|
||||
{
|
||||
friend class cRecord;
|
||||
friend class cPlayback;
|
||||
|
||||
public:
|
||||
bool Open(DMX_CHANNEL_TYPE pes_type, void *x = NULL, int y = 0);
|
||||
void Close(void);
|
||||
@@ -43,19 +44,13 @@ class cDemux
|
||||
void SetSyncMode(AVSYNC_TYPE mode);
|
||||
void *getBuffer();
|
||||
void *getChannel();
|
||||
DMX_CHANNEL_TYPE getChannelType(void)
|
||||
{
|
||||
return dmx_type;
|
||||
};
|
||||
DMX_CHANNEL_TYPE getChannelType(void) { return dmx_type; };
|
||||
bool addPid(unsigned short pid);
|
||||
void getSTC(int64_t *STC);
|
||||
int getUnit(void);
|
||||
static bool SetSource(int unit, int source);
|
||||
static int GetSource(int unit);
|
||||
int getFD(void)
|
||||
{
|
||||
return fd;
|
||||
}; /* needed by cPlayback class */
|
||||
int getFD(void) { return fd; }; /* needed by cPlayback class */
|
||||
cDemux(int num = 0);
|
||||
~cDemux();
|
||||
|
||||
|
@@ -26,15 +26,9 @@ class GLFramebuffer : public OpenThreads::Thread
|
||||
public:
|
||||
GLFramebuffer(int x, int y);
|
||||
~GLFramebuffer();
|
||||
std::vector<unsigned char> *getOSDBuffer()
|
||||
{
|
||||
return &osd_buf; /* pointer to OSD bounce buffer */
|
||||
}
|
||||
std::vector<unsigned char> *getOSDBuffer() { return &osd_buf; } /* pointer to OSD bounce buffer */
|
||||
void blit();
|
||||
fb_var_screeninfo getScreenInfo()
|
||||
{
|
||||
return si;
|
||||
}
|
||||
fb_var_screeninfo getScreenInfo() { return si; }
|
||||
|
||||
private:
|
||||
void *pdata; /* not yet used */
|
||||
|
@@ -18,6 +18,7 @@
|
||||
* for the Raspberry Pi
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
@@ -133,44 +133,21 @@ class cVideo
|
||||
{
|
||||
friend class GLFramebuffer;
|
||||
friend class cDemux;
|
||||
|
||||
private:
|
||||
/* called from GL thread */
|
||||
class SWFramebuffer : public std::vector<unsigned char>
|
||||
{
|
||||
public:
|
||||
SWFramebuffer() : mWidth(0), mHeight(0) {}
|
||||
void width(int w)
|
||||
{
|
||||
mWidth = w;
|
||||
}
|
||||
void height(int h)
|
||||
{
|
||||
mHeight = h;
|
||||
}
|
||||
void pts(uint64_t p)
|
||||
{
|
||||
mPts = p;
|
||||
}
|
||||
void AR(AVRational a)
|
||||
{
|
||||
mAR = a;
|
||||
}
|
||||
int width() const
|
||||
{
|
||||
return mWidth;
|
||||
}
|
||||
int height() const
|
||||
{
|
||||
return mHeight;
|
||||
}
|
||||
int64_t pts() const
|
||||
{
|
||||
return mPts;
|
||||
}
|
||||
AVRational AR() const
|
||||
{
|
||||
return mAR;
|
||||
}
|
||||
void width(int w) { mWidth = w; }
|
||||
void height(int h) { mHeight = h; }
|
||||
void pts(uint64_t p) { mPts = p; }
|
||||
void AR(AVRational a) { mAR = a; }
|
||||
int width() const { return mWidth; }
|
||||
int height() const { return mHeight; }
|
||||
int64_t pts() const { return mPts; }
|
||||
AVRational AR() const { return mAR; }
|
||||
private:
|
||||
int mWidth;
|
||||
int mHeight;
|
||||
@@ -179,19 +156,14 @@ class cVideo
|
||||
};
|
||||
int buf_in, buf_out, buf_num;
|
||||
int64_t GetPTS(void);
|
||||
|
||||
public:
|
||||
/* constructor & destructor */
|
||||
cVideo(int mode, void *, void *, unsigned int unit = 0);
|
||||
~cVideo(void);
|
||||
|
||||
void *GetTVEnc()
|
||||
{
|
||||
return NULL;
|
||||
};
|
||||
void *GetTVEncSD()
|
||||
{
|
||||
return NULL;
|
||||
};
|
||||
void *GetTVEnc() { return NULL; };
|
||||
void *GetTVEncSD() { return NULL; };
|
||||
|
||||
/* aspect ratio */
|
||||
int getAspectRatio(void);
|
||||
@@ -217,58 +189,26 @@ class cVideo
|
||||
int SetVideoSystem(int video_system, bool remember = true);
|
||||
int SetStreamType(VIDEO_FORMAT type);
|
||||
void SetSyncMode(AVSYNC_TYPE mode);
|
||||
bool SetCECMode(VIDEO_HDMI_CEC_MODE)
|
||||
{
|
||||
return true;
|
||||
};
|
||||
void SetCECAutoView(bool)
|
||||
{
|
||||
return;
|
||||
};
|
||||
void SetCECAutoStandby(bool)
|
||||
{
|
||||
return;
|
||||
};
|
||||
bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; };
|
||||
void SetCECAutoView(bool) { return; };
|
||||
void SetCECAutoStandby(bool) { return; };
|
||||
bool ShowPicture(const char *fname);
|
||||
void StopPicture();
|
||||
void Standby(unsigned int bOn);
|
||||
void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600);
|
||||
void SetControl(int, int)
|
||||
{
|
||||
return;
|
||||
};
|
||||
void SetControl(int, int) { return; };
|
||||
void setContrast(int val);
|
||||
void SetVideoMode(analog_mode_t mode);
|
||||
void SetDBDR(int)
|
||||
{
|
||||
return;
|
||||
};
|
||||
void SetAudioHandle(void *)
|
||||
{
|
||||
return;
|
||||
};
|
||||
void SetAutoModes(int [VIDEO_STD_MAX])
|
||||
{
|
||||
return;
|
||||
};
|
||||
int OpenVBI(int)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
int CloseVBI(void)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
int StartVBI(unsigned short)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
int StopVBI(void)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
void SetDBDR(int) { return; };
|
||||
void SetAudioHandle(void *) { return; };
|
||||
void SetAutoModes(int [VIDEO_STD_MAX]) { return; };
|
||||
int OpenVBI(int) { return 0; };
|
||||
int CloseVBI(void) { return 0; };
|
||||
int StartVBI(unsigned short) { return 0; };
|
||||
int StopVBI(void) { return 0; };
|
||||
void SetDemux(cDemux *dmx);
|
||||
bool GetScreenImage(unsigned char *&data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false);
|
||||
|
||||
private:
|
||||
SWFramebuffer buffers[VDEC_MAXBUFS];
|
||||
int dec_w, dec_h;
|
||||
|
@@ -270,8 +270,7 @@ void cRecord::RecordThread()
|
||||
if (toread > readsize)
|
||||
toread = readsize;
|
||||
ssize_t s = dmx->Read(buf + buf_pos, toread, 50);
|
||||
hal_debug("%s: buf_pos %6d s %6d / %6d\n", __func__,
|
||||
buf_pos, (int)s, bufsize - buf_pos);
|
||||
hal_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, buf_pos, (int)s, bufsize - buf_pos);
|
||||
if (s < 0)
|
||||
{
|
||||
if (errno != EAGAIN && (errno != EOVERFLOW || !overflow))
|
||||
|
@@ -38,13 +38,10 @@ class cRecord
|
||||
#define RECORD_WRITER_CHUNKS 16
|
||||
unsigned char *io_buf[RECORD_WRITER_CHUNKS];
|
||||
size_t io_len[RECORD_WRITER_CHUNKS];
|
||||
|
||||
public:
|
||||
cRecord(int num = 0, int bs_dmx = 2048 * 1024, int bs = 4096 * 1024);
|
||||
void setFailureCallback(void (*f)(void *), void *d)
|
||||
{
|
||||
failureCallback = f;
|
||||
failureData = d;
|
||||
}
|
||||
void setFailureCallback(void (*f)(void *), void *d) { failureCallback = f; failureData = d; }
|
||||
~cRecord();
|
||||
|
||||
bool Open();
|
||||
|
Reference in New Issue
Block a user