libgeneric: some manual code nicenings

Origin commit data
------------------
Branch: master
Commit: 0d8aaf19ab
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-11-07 (Sun, 07 Nov 2021)

Origin message was:
------------------
- libgeneric: 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:
vanhofen
2021-11-07 00:57:01 +01:00
parent 94e1c9da6f
commit ae20eb0654
14 changed files with 317 additions and 441 deletions

View File

@@ -160,8 +160,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int le)
hal_debug("%s ch %d srate %d bits %d le %d adevice %p\n", __func__, ch, srate, bits, le, adevice);; hal_debug("%s ch %d srate %d bits %d le %d adevice %p\n", __func__, ch, srate, bits, le, adevice);;
int driver; int driver;
int byte_format = le ? AO_FMT_LITTLE : AO_FMT_BIG; int byte_format = le ? AO_FMT_LITTLE : AO_FMT_BIG;
if (sformat.bits != bits || sformat.channels != ch || sformat.rate != srate || if (sformat.bits != bits || sformat.channels != ch || sformat.rate != srate || sformat.byte_format != byte_format || adevice == NULL)
sformat.byte_format != byte_format || adevice == NULL)
{ {
driver = ao_default_driver_id(); driver = ao_default_driver_id();
sformat.bits = bits; sformat.bits = bits;
@@ -173,10 +172,8 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int le)
ao_close(adevice); ao_close(adevice);
adevice = ao_open_live(driver, &sformat, NULL); adevice = ao_open_live(driver, &sformat, NULL);
ao_info *ai = ao_driver_info(driver); ao_info *ai = ao_driver_info(driver);
hal_info("%s: changed params ch %d srate %d bits %d le %d adevice %p\n", hal_info("%s: changed params ch %d srate %d bits %d le %d adevice %p\n", __func__, ch, srate, bits, le, adevice);;
__func__, ch, srate, bits, le, adevice);; hal_info("libao driver: %d name '%s' short '%s' author '%s'\n", driver, ai->name, ai->short_name, ai->author);
hal_info("libao driver: %d name '%s' short '%s' author '%s'\n",
driver, ai->name, ai->short_name, ai->author);
} }
return 0; return 0;
}; };
@@ -280,13 +277,11 @@ void cAudio::getAudioInfo(int &type, int &layer, int &freq, int &bitrate, int &m
mode = 7; // "L/C/R/SL/SR" mode = 7; // "L/C/R/SL/SR"
break; break;
default: default:
hal_info("%s: unknown ch_layout 0x%" PRIx64 "\n", hal_info("%s: unknown ch_layout 0x%" PRIx64 "\n", __func__, c->channel_layout);
__func__, c->channel_layout);
} }
} }
} }
hal_debug("%s t: %d l: %d f: %d b: %d m: %d codec_id: %x\n", hal_debug("%s t: %d l: %d f: %d b: %d m: %d codec_id: %x\n", __func__, type, layer, freq, bitrate, mode, c ? c->codec_id : -1);
__func__, type, layer, freq, bitrate, mode, c ? c->codec_id : -1);
}; };
void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int /*iq_level*/) void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int /*iq_level*/)
@@ -453,8 +448,7 @@ void cAudio::run()
o_ch = p->channels; /* 2 */ o_ch = p->channels; /* 2 */
o_sr = p->sample_rate; /* 48000 */ o_sr = p->sample_rate; /* 48000 */
o_layout = p->channel_layout; /* AV_CH_LAYOUT_STEREO */ o_layout = p->channel_layout; /* AV_CH_LAYOUT_STEREO */
if (sformat.channels != o_ch || sformat.rate != o_sr || if (sformat.channels != o_ch || sformat.rate != o_sr || sformat.byte_format != AO_FMT_NATIVE || sformat.bits != 16 || adevice == NULL)
sformat.byte_format != AO_FMT_NATIVE || sformat.bits != 16 || adevice == NULL)
{ {
driver = ao_default_driver_id(); driver = ao_default_driver_id();
sformat.bits = 16; sformat.bits = 16;
@@ -466,11 +460,9 @@ void cAudio::run()
ao_close(adevice); ao_close(adevice);
adevice = ao_open_live(driver, &sformat, NULL); adevice = ao_open_live(driver, &sformat, NULL);
ai = ao_driver_info(driver); ai = ao_driver_info(driver);
hal_info("%s: changed params ch %d srate %d bits %d adevice %p\n", hal_info("%s: changed params ch %d srate %d bits %d adevice %p\n", __func__, o_ch, o_sr, 16, adevice);
__func__, o_ch, o_sr, 16, adevice);
if (ai) if (ai)
hal_info("libao driver: %d name '%s' short '%s' author '%s'\n", hal_info("libao driver: %d name '%s' short '%s' author '%s'\n", driver, ai->name, ai->short_name, ai->author);
driver, ai->name, ai->short_name, ai->author);
} }
#if 0 #if 0
hal_info(" driver options:"); hal_info(" driver options:");
@@ -479,8 +471,7 @@ void cAudio::run()
fprintf(stderr, "\n"); fprintf(stderr, "\n");
#endif #endif
av_get_sample_fmt_string(tmp, sizeof(tmp), c->sample_fmt); av_get_sample_fmt_string(tmp, sizeof(tmp), c->sample_fmt);
hal_info("decoding %s, sample_fmt %d (%s) sample_rate %d channels %d\n", hal_info("decoding %s, sample_fmt %d (%s) sample_rate %d channels %d\n", avcodec_get_name(p->codec_id), c->sample_fmt, tmp, p->sample_rate, p->channels);
avcodec_get_name(p->codec_id), c->sample_fmt, tmp, p->sample_rate, p->channels);
swr = swr_alloc_set_opts(swr, swr = swr_alloc_set_opts(swr,
o_layout, AV_SAMPLE_FMT_S16, o_sr, /* output */ o_layout, AV_SAMPLE_FMT_S16, o_sr, /* output */
p->channel_layout, c->sample_fmt, p->sample_rate, /* input */ p->channel_layout, c->sample_fmt, p->sample_rate, /* input */
@@ -526,8 +517,7 @@ void cAudio::run()
{ {
hal_info("obuf_sz: %d old: %d\n", obuf_sz, obuf_sz_max); hal_info("obuf_sz: %d old: %d\n", obuf_sz, obuf_sz_max);
av_free(obuf); av_free(obuf);
if (av_samples_alloc(&obuf, &out_linesize, o_ch, if (av_samples_alloc(&obuf, &out_linesize, o_ch, frame->nb_samples, AV_SAMPLE_FMT_S16, 1) < 0)
frame->nb_samples, AV_SAMPLE_FMT_S16, 1) < 0)
{ {
hal_info("av_samples_alloc failed\n"); hal_info("av_samples_alloc failed\n");
av_packet_unref(&avpkt); av_packet_unref(&avpkt);
@@ -535,8 +525,7 @@ void cAudio::run()
} }
obuf_sz_max = obuf_sz; obuf_sz_max = obuf_sz;
} }
obuf_sz = swr_convert(swr, &obuf, obuf_sz, obuf_sz = swr_convert(swr, &obuf, obuf_sz, (const uint8_t **)frame->extended_data, frame->nb_samples);
(const uint8_t **)frame->extended_data, frame->nb_samples);
#if (LIBAVUTIL_VERSION_MAJOR < 54) #if (LIBAVUTIL_VERSION_MAJOR < 54)
curr_pts = av_frame_get_best_effort_timestamp(frame); curr_pts = av_frame_get_best_effort_timestamp(frame);
#else #else

View File

@@ -42,6 +42,7 @@ typedef enum
class cAudio : public OpenThreads::Thread class cAudio : public OpenThreads::Thread
{ {
friend class cPlayback; friend class cPlayback;
private: private:
int fd; int fd;
bool Muted; bool Muted;
@@ -69,51 +70,27 @@ class cAudio : public OpenThreads::Thread
/* construct & destruct */ /* construct & destruct */
cAudio(void *, void *, void *); cAudio(void *, void *, void *);
~cAudio(void); ~cAudio(void);
int64_t getPts() int64_t getPts() { return curr_pts; }
{
return curr_pts;
}
void *GetHandle() void *GetHandle() { return NULL; };
{
return NULL;
};
void setAVInput(int /*val*/) void setAVInput(int /*val*/) { return; };
{
return;
};
/* shut up */ /* shut up */
int mute(bool remember = true) int mute(bool remember = true) { return do_mute(true, remember); };
{ int unmute(bool remember = true) { return do_mute(false, remember); };
return do_mute(true, remember);
};
int unmute(bool remember = true)
{
return do_mute(false, remember);
};
/* volume, min = 0, max = 255 */ /* volume, min = 0, max = 255 */
int setVolume(unsigned int left, unsigned int right); int setVolume(unsigned int left, unsigned int right);
int getVolume(void) int getVolume(void) { return volume; }
{ bool getMuteStatus(void) { return Muted; };
return volume;
}
bool getMuteStatus(void)
{
return Muted;
};
/* start and stop audio */ /* start and stop audio */
int Start(void); int Start(void);
int Stop(void); int Stop(void);
bool Pause(bool Pcm = true); bool Pause(bool Pcm = true);
void SetStreamType(int bypass); void SetStreamType(int bypass);
int GetStreamType(void) int GetStreamType(void) { return StreamType; }
{
return StreamType;
}
void SetSyncMode(AVSYNC_TYPE Mode); void SetSyncMode(AVSYNC_TYPE Mode);
/* select channels */ /* select channels */

View File

@@ -353,8 +353,7 @@ void GLFbPC::render()
// *mX = *mY * mOA.num / mOA.den; // *mX = *mY * mOA.num / mOA.den;
clutter_actor_set_size(stage, *mX, *mY); clutter_actor_set_size(stage, *mX, *mY);
} }
hal_info("%s: reinit mX:%d mY:%d xoff:%d yoff:%d fs %d\n", hal_info("%s: reinit mX:%d mY:%d xoff:%d yoff:%d fs %d\n", __func__, *mX, *mY, xoff, yoff, mFullscreen);
__func__, *mX, *mY, xoff, yoff, mFullscreen);
} }
mReInitLock.unlock(); mReInitLock.unlock();

View File

@@ -113,8 +113,8 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe
hal_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); hal_info("%s %s: %m\n", __FUNCTION__, devname[devnum]);
return false; return false;
} }
hal_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, hal_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n",
num, DMX_T[pes_type], pes_type, uBufferSize, fd); __func__, num, DMX_T[pes_type], pes_type, uBufferSize, fd);
if (dmx_type == DMX_VIDEO_CHANNEL) if (dmx_type == DMX_VIDEO_CHANNEL)
uBufferSize = 0x100000; /* 1MB */ uBufferSize = 0x100000; /* 1MB */
@@ -359,8 +359,8 @@ bool cDemux::sectionFilter(unsigned short _pid, const unsigned char *const filte
if (timeout == 0 && negmask == NULL) if (timeout == 0 && negmask == NULL)
s_flt.timeout = to; 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, hal_debug("%s #%d pid:0x%04hx fd:%d type:%s len:%d to:%d flags:%x flt[0]:%02x\n",
pid, fd, DMX_T[dmx_type], len, s_flt.timeout, s_flt.flags, s_flt.filter.filter[0]); __func__, num, pid, fd, DMX_T[dmx_type], len, s_flt.timeout, s_flt.flags, s_flt.filter.filter[0]);
if (debuglevel == 2) if (debuglevel == 2)
{ {

View File

@@ -394,8 +394,7 @@ void GLFbPC::render()
} }
else else
*mX = *mY * mOA.num / mOA.den; *mX = *mY * mOA.num / mOA.den;
hal_info("%s: reinit mX:%d mY:%d xoff:%d yoff:%d fs %d\n", hal_info("%s: reinit mX:%d mY:%d xoff:%d yoff:%d fs %d\n", __func__, *mX, *mY, xoff, yoff, mFullscreen);
__func__, *mX, *mY, xoff, yoff, mFullscreen);
glViewport(xoff, yoff, *mX, *mY); glViewport(xoff, yoff, *mX, *mY);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();

View File

@@ -81,18 +81,12 @@ class cPlayback
int GetSubtitlePid(void); int GetSubtitlePid(void);
bool SetPosition(int position, bool absolute = false); bool SetPosition(int position, bool absolute = false);
void FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string *language); void FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string *language);
void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language) void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language) { FindAllPids((int *) apids, (unsigned int *) ac3flags, (unsigned int *) numpida, language); };
{
FindAllPids((int *) apids, (unsigned int *) ac3flags, (unsigned int *) numpida, language);
};
void FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language); void FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language);
void FindAllTeletextsubtitlePids(int *pids, unsigned int *numpidt, std::string *tlanguage, int *mags, int *pages); void FindAllTeletextsubtitlePids(int *pids, unsigned int *numpidt, std::string *tlanguage, int *mags, int *pages);
void RequestAbort(void); void RequestAbort(void);
void FindAllSubs(int *pids, unsigned int *supported, unsigned int *numpida, std::string *language); void FindAllSubs(int *pids, unsigned int *supported, unsigned int *numpida, std::string *language);
void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language) void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language) { FindAllSubs((int *) pids, (unsigned int *) supported, (unsigned int *) numpida, language); };
{
FindAllSubs((int *) pids, (unsigned int *) supported, (unsigned int *) numpida, language);
};
bool SelectSubtitles(int pid, std::string charset = ""); bool SelectSubtitles(int pid, std::string charset = "");
void GetTitles(std::vector<int> &playlists, std::vector<std::string> &titles, int &current); void GetTitles(std::vector<int> &playlists, std::vector<std::string> &titles, int &current);
void SetTitle(int title); void SetTitle(int title);

View File

@@ -188,7 +188,8 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data)
{ {
case GST_STATE_CHANGE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
{ {
} break; }
break;
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
{ {
GstIterator *children; GstIterator *children;
@@ -212,10 +213,12 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data)
break; break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
{ {
} break; }
break;
case GST_STATE_CHANGE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
{ {
} break; }
break;
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
{ {
if (audioSink) if (audioSink)
@@ -232,7 +235,8 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data)
break; break;
case GST_STATE_CHANGE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
{ {
} break; }
break;
} }
break; break;
} }
@@ -279,8 +283,7 @@ cPlayback::cPlayback(int num)
nano_str = ""; nano_str = "";
hal_info("%s:%s - This program is linked against GStreamer %d.%d.%d %s\n", hal_info("%s:%s - This program is linked against GStreamer %d.%d.%d %s\n",
FILENAME, __FUNCTION__, FILENAME, __FUNCTION__, major, minor, micro, nano_str);
major, minor, micro, nano_str);
mAudioStream = 0; mAudioStream = 0;
mSpeed = 0; mSpeed = 0;

View File

@@ -357,7 +357,8 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data)
{ {
case GST_STATE_CHANGE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
{ {
} break; }
break;
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
{ {
GstIterator *children; GstIterator *children;
@@ -396,10 +397,12 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data)
break; break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
{ {
} break; }
break;
case GST_STATE_CHANGE_PLAYING_TO_PAUSED: case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
{ {
} break; }
break;
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
{ {
if (audioSink) if (audioSink)
@@ -416,7 +419,8 @@ GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data)
break; break;
case GST_STATE_CHANGE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
{ {
} break; }
break;
} }
break; break;
} }
@@ -453,8 +457,7 @@ cPlayback::cPlayback(int num)
nano_str = ""; nano_str = "";
hal_info("%s:%s - This program is linked against GStreamer %d.%d.%d %s\n", hal_info("%s:%s - This program is linked against GStreamer %d.%d.%d %s\n",
FILENAME, __FUNCTION__, FILENAME, __FUNCTION__, major, minor, micro, nano_str);
major, minor, micro, nano_str);
mAudioStream = 0; mAudioStream = 0;
mSpeed = 0; mSpeed = 0;

View File

@@ -19,6 +19,7 @@ class cPlayback
int mAudioStream; int mAudioStream;
int mSubtitleStream; int mSubtitleStream;
int mTeletextStream; int mTeletextStream;
public: public:
cPlayback(int); cPlayback(int);
bool Open(playmode_t PlayMode); bool Open(playmode_t PlayMode);
@@ -28,15 +29,9 @@ class cPlayback
bool SetAPid(int pid, bool ac3); bool SetAPid(int pid, bool ac3);
bool SetSubtitlePid(int pid); bool SetSubtitlePid(int pid);
bool SetTeletextPid(int pid); bool SetTeletextPid(int pid);
int GetAPid(void) int GetAPid(void) { return mAudioStream; }
{
return mAudioStream;
}
int GetVPid(void); int GetVPid(void);
int GetSubtitlePid(void) int GetSubtitlePid(void) { return mSubtitleStream; }
{
return mSubtitleStream;
}
int GetTeletextPid(void); int GetTeletextPid(void);
void SuspendSubtitle(bool); void SuspendSubtitle(bool);
int GetFirstTeletextPid(void); int GetFirstTeletextPid(void);
@@ -46,23 +41,14 @@ class cPlayback
void GetPts(uint64_t &pts); void GetPts(uint64_t &pts);
bool SetPosition(int position, bool absolute = false); bool SetPosition(int position, bool absolute = false);
void FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string *language); void FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string *language);
void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language) void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language) { FindAllPids((int *) apids, (unsigned int *) ac3flags, (unsigned int *) numpida, language); };
{
FindAllPids((int *) apids, (unsigned int *) ac3flags, (unsigned int *) numpida, language);
};
void FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language); void FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language);
void FindAllTeletextsubtitlePids(int *pids, unsigned int *numpidt, std::string *tlanguage, int *mags, int *pages); void FindAllTeletextsubtitlePids(int *pids, unsigned int *numpidt, std::string *tlanguage, int *mags, int *pages);
void RequestAbort(void); void RequestAbort(void);
bool IsPlaying(void) bool IsPlaying(void) { return false; }
{
return false;
}
uint64_t GetReadCount(void); uint64_t GetReadCount(void);
void FindAllSubs(int *pids, unsigned int *supported, unsigned int *numpida, std::string *language); void FindAllSubs(int *pids, unsigned int *supported, unsigned int *numpida, std::string *language);
void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language) void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language) { FindAllSubs((int *) pids, (unsigned int *) supported, (unsigned int *) numpida, language); };
{
FindAllSubs((int *) pids, (unsigned int *) supported, (unsigned int *) numpida, language);
};
bool SelectSubtitles(int pid, std::string charset = ""); bool SelectSubtitles(int pid, std::string charset = "");
void GetTitles(std::vector<int> &playlists, std::vector<std::string> &titles, int &current); void GetTitles(std::vector<int> &playlists, std::vector<std::string> &titles, int &current);
void SetTitle(int title); void SetTitle(int title);
@@ -70,10 +56,7 @@ class cPlayback
void GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values); void GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values);
// //
~cPlayback(); ~cPlayback();
AVFormatContext *GetAVFormatContext() AVFormatContext *GetAVFormatContext() { return NULL; }
{
return NULL;
}
void ReleaseAVFormatContext() {} void ReleaseAVFormatContext() {}
}; };

View File

@@ -650,14 +650,11 @@ void cVideo::run(void)
SWFramebuffer *f = &buffers[buf_in]; SWFramebuffer *f = &buffers[buf_in];
if (f->size() < need) if (f->size() < need)
f->resize(need); f->resize(need);
av_image_fill_arrays(rgbframe->data, rgbframe->linesize, &(*f)[0], VDEC_PIXFMT, av_image_fill_arrays(rgbframe->data, rgbframe->linesize, &(*f)[0], VDEC_PIXFMT, c->width, c->height, 1);
c->width, c->height, 1); sws_scale(convert, frame->data, frame->linesize, 0, c->height, rgbframe->data, rgbframe->linesize);
sws_scale(convert, frame->data, frame->linesize, 0, c->height,
rgbframe->data, rgbframe->linesize);
if (dec_w != c->width || dec_h != c->height) if (dec_w != c->width || dec_h != c->height)
{ {
hal_info("%s: pic changed %dx%d -> %dx%d\n", __func__, hal_info("%s: pic changed %dx%d -> %dx%d\n", __func__, dec_w, dec_h, c->width, c->height);
dec_w, dec_h, c->width, c->height);
dec_w = c->width; dec_w = c->width;
dec_h = c->height; dec_h = c->height;
w_h_changed = true; w_h_changed = true;
@@ -697,13 +694,14 @@ void cVideo::run(void)
dec_r = c->time_base.den / (c->time_base.num * c->ticks_per_frame); dec_r = c->time_base.den / (c->time_base.num * c->ticks_per_frame);
buf_m.unlock(); buf_m.unlock();
} }
hal_debug("%s: time_base: %d/%d, ticks: %d rate: %d pts 0x%" PRIx64 "\n", __func__, hal_debug("%s: time_base: %d/%d, ticks: %d rate: %d pts 0x%" PRIx64 "\n",
c->time_base.num, c->time_base.den, c->ticks_per_frame, dec_r, __func__, c->time_base.num, c->time_base.den, c->ticks_per_frame, dec_r,
#if (LIBAVUTIL_VERSION_MAJOR < 54) #if (LIBAVUTIL_VERSION_MAJOR < 54)
av_frame_get_best_effort_timestamp(frame)); av_frame_get_best_effort_timestamp(frame)
#else #else
frame->best_effort_timestamp); frame->best_effort_timestamp
#endif #endif
);
} }
else else
hal_debug("%s: got_frame: %d stillpicture: %d\n", __func__, got_frame, stillpicture); hal_debug("%s: got_frame: %d stillpicture: %d\n", __func__, got_frame, stillpicture);

View File

@@ -149,44 +149,21 @@ class cVideo : public OpenThreads::Thread
{ {
friend class GLFbPC; friend class GLFbPC;
friend class cDemux; friend class cDemux;
private: private:
/* called from GL thread */ /* called from GL thread */
class SWFramebuffer : public std::vector<unsigned char> class SWFramebuffer : public std::vector<unsigned char>
{ {
public: public:
SWFramebuffer() : mWidth(0), mHeight(0) {} SWFramebuffer() : mWidth(0), mHeight(0) {}
void width(int w) void width(int w) { mWidth = w; }
{ void height(int h) { mHeight = h; }
mWidth = w; void pts(uint64_t p) { mPts = p; }
} void AR(AVRational a) { mAR = a; }
void height(int h) int width() const { return mWidth; }
{ int height() const { return mHeight; }
mHeight = h; int64_t pts() const { return mPts; }
} AVRational AR() const { return mAR; }
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: private:
int mWidth; int mWidth;
int mHeight; int mHeight;
@@ -195,23 +172,15 @@ class cVideo : public OpenThreads::Thread
}; };
int buf_in, buf_out, buf_num; int buf_in, buf_out, buf_num;
int64_t GetPTS(void); int64_t GetPTS(void);
public: public:
/* constructor & destructor */ /* constructor & destructor */
cVideo(int mode, void *, void *, unsigned int unit = 0); cVideo(int mode, void *, void *, unsigned int unit = 0);
~cVideo(void); ~cVideo(void);
void *GetTVEnc() void *GetTVEnc() { return NULL; };
{ void *GetTVEncSD() { return NULL; };
return NULL; void setAVInput(int /*val*/) { return; };
};
void *GetTVEncSD()
{
return NULL;
};
void setAVInput(int /*val*/)
{
return;
};
/* aspect ratio */ /* aspect ratio */
int getAspectRatio(void); int getAspectRatio(void);
@@ -241,66 +210,28 @@ class cVideo : public OpenThreads::Thread
bool ShowPicture(const char *fname); bool ShowPicture(const char *fname);
void SetSyncMode(AVSYNC_TYPE mode); void SetSyncMode(AVSYNC_TYPE mode);
bool SetCECMode(VIDEO_HDMI_CEC_MODE) bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; };
{ void SetCECAutoView(bool) { return; };
return true; void SetCECAutoStandby(bool) { return; };
}; int GetAudioDestination() { return 0; };
void SetCECAutoView(bool) void SetAudioDestination(int /*audio_dest*/) { return; };
{
return;
};
void SetCECAutoStandby(bool)
{
return;
};
int GetAudioDestination()
{
return 0;
};
void SetAudioDestination(int /*audio_dest*/)
{
return;
};
void StopPicture(); void StopPicture();
void Standby(unsigned int bOn); void Standby(unsigned int bOn);
void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600, int startx = 0, int starty = 0, int endx = 1279, int endy = 719); void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600, int startx = 0, int starty = 0, int endx = 1279, int endy = 719);
void SetControl(int, int) void SetControl(int, int) { return; };
{
return;
};
void setContrast(int val); void setContrast(int val);
void SetVideoMode(analog_mode_t mode); void SetVideoMode(analog_mode_t mode);
void SetDBDR(int) void SetDBDR(int) { return; };
{ void SetAudioHandle(void *) { return; };
return; void SetAutoModes(int [VIDEO_STD_MAX]) { return; };
}; int OpenVBI(int) { return 0; };
void SetAudioHandle(void *) int CloseVBI(void) { return 0; };
{ int StartVBI(unsigned short) { return 0; };
return; int StopVBI(void) { return 0; };
};
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); 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); bool GetScreenImage(unsigned char *&data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false);
SWFramebuffer *getDecBuf(void); SWFramebuffer *getDecBuf(void);
private: private:
void run(); void run();
SWFramebuffer buffers[VDEC_MAXBUFS]; SWFramebuffer buffers[VDEC_MAXBUFS];