ShowPicture: return boolean expression

This commit is contained in:
GetAway
2019-01-12 11:48:14 +01:00
parent da0d4290a3
commit 3ff02b06f2
11 changed files with 50 additions and 31 deletions

View File

@@ -1,3 +1,7 @@
2018-01-12 GetAway1 <get-away@t-online.de>
ShowPicture: return boolean expression
2017-11-02 Thilo Graf <dbt@novatux.de>
version 0.2.0-generic-pc

View File

@@ -351,13 +351,14 @@ void cVideo::SetVideoMode(analog_mode_t mode)
proc_put("/proc/stb/avs/0/colorformat", m, strlen(m));
}
void cVideo::ShowPicture(const char * fname)
bool cVideo::ShowPicture(const char * fname)
{
vdec->ShowPicture(fname);
return vdec->ShowPicture(fname);
}
void VDec::ShowPicture(const char * fname)
bool VDec::ShowPicture(const char * fname)
{
bool ret = false;
lt_debug("%s(%s)\n", __func__, fname);
char destname[512];
char cmd[512];
@@ -369,18 +370,18 @@ void VDec::ShowPicture(const char * fname)
{
/* does not work and the driver does not seem to like it */
lt_info("%s: video_standby == true\n", __func__);
return;
return ret;
}
if (fd < 0)
{
lt_info("%s: decoder not opened?\n", __func__);
return;
lt_info("%s: decoder not opened\n", __func__);
return ret;
}
strcpy(destname, "/var/cache");
if (stat(fname, &st2))
{
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return;
return ret;
}
mkdir(destname, 0755);
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
@@ -430,10 +431,11 @@ void VDec::ShowPicture(const char * fname)
read(mfd, iframe, st.st_size);
show_iframe(fd, iframe, st.st_size);
free(iframe);
ret = true;
out:
close(mfd);
pthread_mutex_unlock(&stillp_mutex);
return;
return ret;
}
void cVideo::StopPicture()

View File

@@ -46,7 +46,7 @@ public:
int setBlank(int blank);
int SetStreamType(VIDEO_FORMAT type);
void SetSyncMode(AVSYNC_TYPE mode);
void ShowPicture(const char * fname);
bool ShowPicture(const char * fname);
void Standby(unsigned int bOn);
void Pig(int x, int y, int w, int h, int osd_w, int osd_h);

View File

@@ -282,16 +282,17 @@ void cVideo::SetVideoMode(analog_mode_t)
{
}
void cVideo::ShowPicture(const char *fname)
bool cVideo::ShowPicture(const char *fname)
{
vdec->ShowPicture(fname);
return vdec->ShowPicture(fname);
}
void VDec::ShowPicture(const char *fname)
bool VDec::ShowPicture(const char *fname)
{
bool ret = false;
lt_info("%s(%s)\n", __func__, fname);
if (access(fname, R_OK))
return;
return ret;
still_m.lock();
stillpicture = true;
buf_num = 0;
@@ -312,7 +313,7 @@ void VDec::ShowPicture(const char *fname)
if (avformat_open_input(&avfc, fname, NULL, NULL) < 0) {
lt_info("%s: Could not open file %s\n", __func__, fname);
return;
return ret;
}
if (avformat_find_stream_info(avfc, NULL) < 0) {
@@ -385,6 +386,7 @@ void VDec::ShowPicture(const char *fname)
buf_num--;
}
buf_m.unlock();
ret = true;
}
}
av_packet_unref(&avpkt);
@@ -396,6 +398,7 @@ void VDec::ShowPicture(const char *fname)
out_close:
avformat_close_input(&avfc);
lt_debug("%s(%s) end\n", __func__, fname);
return ret;
}
void cVideo::StopPicture()

View File

@@ -80,7 +80,7 @@ class VDec : public OpenThreads::Thread
int Stop(bool blank = true);
int SetStreamType(VIDEO_FORMAT type);
void ShowPicture(const char * fname);
bool ShowPicture(const char * fname);
void Pig(int x, int y, int w, int h);
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);

View File

@@ -189,7 +189,7 @@ class cVideo
bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; };
void SetCECAutoView(bool) { return; };
void SetCECAutoStandby(bool) { return; };
void ShowPicture(const char * fname);
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);

View File

@@ -394,13 +394,14 @@ void cVideo::SetVideoMode(analog_mode_t mode)
proc_put("/proc/stb/avs/0/colorformat", m, strlen(m));
}
void cVideo::ShowPicture(const char * fname)
bool cVideo::ShowPicture(const char * fname)
{
vdec->ShowPicture(fname);
return vdec->ShowPicture(fname);
}
void VDec::ShowPicture(const char * fname)
bool VDec::ShowPicture(const char * fname)
{
bool ret = false;
lt_debug("%s(%s)\n", __func__, fname);
char destname[512];
char cmd[512];
@@ -411,13 +412,19 @@ void VDec::ShowPicture(const char * fname)
{
/* does not work and the driver does not seem to like it */
lt_info("%s: video_standby == true\n", __func__);
return;
return ret;
}
if (fd == -1)
{
lt_info("%s: decoder not opened\n", __func__);
return ret;
}
strcpy(destname, "/var/cache");
if (stat(fname, &st2))
{
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return;
return ret;
}
mkdir(destname, 0755);
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
@@ -470,10 +477,11 @@ void VDec::ShowPicture(const char * fname)
video_still_picture sp = { iframe, st.st_size };
fop(ioctl, VIDEO_STILLPICTURE, &sp);
free(iframe);
ret = true;
}
out:
close(mfd);
return;
return ret;
}
void cVideo::StopPicture()

View File

@@ -46,7 +46,7 @@ public:
int Stop(bool blank = true);
int SetStreamType(VIDEO_FORMAT type);
void SetSyncMode(AVSYNC_TYPE mode);
void ShowPicture(const char * fname);
bool ShowPicture(const char * fname);
void Standby(unsigned int bOn);
/* used internally by dmx */

View File

@@ -75,7 +75,7 @@ public:
/* set video_system */
int SetVideoSystem(int video_system, bool remember = true);
void ShowPicture(const char * fname);
bool ShowPicture(const char * fname);
void StopPicture();
void Standby(unsigned int bOn);
void Pig(int x, int y, int w, int h);

View File

@@ -469,13 +469,14 @@ void VDec::SetVideoMode(analog_mode_t mode)
fop(ioctl, MPEG_VID_SET_OUTFMT, outputformat);
}
void cVideo::ShowPicture(const char * fname)
bool cVideo::ShowPicture(const char * fname)
{
_vdec->ShowPicture(fname);
return _vdec->ShowPicture(fname);
}
void VDec::ShowPicture(const char * fname)
bool VDec::ShowPicture(const char * fname)
{
bool ret = false;
lt_debug("%s(%s)\n", __FUNCTION__, fname);
char destname[512];
char cmd[512];
@@ -487,7 +488,7 @@ void VDec::ShowPicture(const char * fname)
if (stat(fname, &st2))
{
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
return;
return ret;
}
mkdir(destname, 0755);
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
@@ -542,13 +543,14 @@ void VDec::ShowPicture(const char * fname)
/* writing twice seems to be more reliable */
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
ret = true;
}
free(data);
}
close(mfd);
out:
pthread_mutex_unlock(&stillp_mutex);
return;
return ret;
#if 0
/* DirectFB based picviewer: works, but is slow and the infobar
draws in the same plane */

View File

@@ -129,11 +129,11 @@ void cVideo::SetVideoMode(analog_mode_t)
{
}
void cVideo::ShowPicture(const char *fname)
bool cVideo::ShowPicture(const char *fname)
{
lt_info("%s(%s)\n", __func__, fname);
if (access(fname, R_OK))
return;
return true;
}
void cVideo::StopPicture()