ShowPicture: return boolean expression

Origin commit data
------------------
Branch: master
Commit: 90c3600026
Author: GetAway <get-away@t-online.de>
Date: 2019-03-12 (Tue, 12 Mar 2019)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
GetAway
2019-03-12 21:59:42 +01:00
committed by max_10
parent 143d5769bd
commit 465d0482ea
12 changed files with 54 additions and 29 deletions

View File

@@ -632,18 +632,26 @@ 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)
{
hal_info("%s(%s)\n", __func__, fname);
bool ret = false;
hal_debug("%s(%s)\n", __func__, fname);
if (video_standby)
{
/* does not work and the driver does not seem to like it */
hal_info("%s: video_standby == true\n", __func__);
return;
return ret;
}
/* in movieplayer mode, fd is not opened */
if (fd == -1)
{
hal_info("%s: decoder not opened\n", __func__);
return ret;
}
struct stat st;
if (stat(fname, &st)){
return;
return ret;
}
closeDevice();
openDevice();
@@ -663,8 +671,9 @@ void cVideo::ShowPicture(const char * fname)
usleep(150000);
ioctl(fd, VIDEO_STOP, 0);
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
ret = true;
}
return;
return ret;
}
void cVideo::StopPicture()

View File

@@ -233,7 +233,7 @@ class cVideo
bool SetCECMode(VIDEO_HDMI_CEC_MODE);
void SetCECAutoView(bool);
void SetCECAutoStandby(bool);
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, int startx = 0, int starty = 0, int endx = 1279, int endy = 719);

View File

@@ -321,8 +321,9 @@ 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)
{
bool ret = false;
hal_debug("%s(%s)\n", __func__, fname);
char destname[512];
char cmd[512];
@@ -334,18 +335,18 @@ void cVideo::ShowPicture(const char * fname)
{
/* does not work and the driver does not seem to like it */
hal_info("%s: video_standby == true\n", __func__);
return;
return ret;
}
if (fd < 0)
if (fd == -1)
{
hal_info("%s: decoder not opened?\n", __func__);
return;
hal_info("%s: decoder not opened\n", __func__);
return ret;
}
strcpy(destname, "/var/cache");
if (stat(fname, &st2))
{
hal_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):
@@ -395,10 +396,11 @@ void cVideo::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

@@ -175,7 +175,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

@@ -235,8 +235,9 @@ void cVideo::SetVideoMode(analog_mode_t)
{
}
void cVideo::ShowPicture(const char *fname)
bool cVideo::ShowPicture(const char *fname)
{
bool ret = false;
hal_info("%s(%s)\n", __func__, fname);
if (access(fname, R_OK))
return;
@@ -260,7 +261,7 @@ void cVideo::ShowPicture(const char *fname)
if (avformat_open_input(&avfc, fname, NULL, NULL) < 0) {
hal_info("%s: Could not open file %s\n", __func__, fname);
return;
return ret;
}
if (avformat_find_stream_info(avfc, NULL) < 0) {
@@ -333,6 +334,7 @@ void cVideo::ShowPicture(const char *fname)
buf_num--;
}
buf_m.unlock();
ret = true;
}
}
av_packet_unref(&avpkt);
@@ -344,6 +346,7 @@ void cVideo::ShowPicture(const char *fname)
out_close:
avformat_close_input(&avfc);
hal_debug("%s(%s) end\n", __func__, fname);
return ret;
}
void cVideo::StopPicture()

View File

@@ -180,7 +180,7 @@ class cVideo : public OpenThreads::Thread
bool Pause(void);
int SetStreamType(VIDEO_FORMAT type);
void ShowPicture(const char * fname);
bool ShowPicture(const char * fname);
void SetSyncMode(AVSYNC_TYPE mode);
bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; };

View File

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

View File

@@ -180,7 +180,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

@@ -564,8 +564,9 @@ void cVideo::SetVideoMode(analog_mode_t mode)
proc_put("/proc/stb/avs/0/colorformat", m, strlen(m));
}
void cVideo::ShowPicture(const char * fname, const char *_destname)
bool cVideo::ShowPicture(const char * fname, const char *_destname)
{
bool ret = false;
hal_debug("%s(%s)\n", __func__, fname);
//static const unsigned char pes_header[] = { 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x80, 0x00, 0x00 };
static const unsigned char pes_header[] = {0x0, 0x0, 0x1, 0xe0, 0x00, 0x00, 0x80, 0x80, 0x5, 0x21, 0x0, 0x1, 0x0, 0x1};
@@ -578,8 +579,15 @@ void cVideo::ShowPicture(const char * fname, const char *_destname)
{
/* does not work and the driver does not seem to like it */
hal_info("%s: video_standby == true\n", __func__);
return;
return ret;
}
if (fd == -1)
{
/* in movieplayer mode, fd is not opened */
hal_info("%s: decoder not opened\n", __func__);
return ret;
}
const char *lastDot = strrchr(fname, '.');
if (lastDot && !strcasecmp(lastDot + 1, "m2v"))
strncpy(destname, fname, sizeof(destname));
@@ -591,7 +599,7 @@ void cVideo::ShowPicture(const char * fname, const char *_destname)
if (stat(fname, &st2))
{
hal_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):
@@ -657,10 +665,11 @@ void cVideo::ShowPicture(const char * fname, const char *_destname)
write(fd, iframe, 8192);
ioctl(fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
free(iframe);
ret = true;
}
out:
close(mfd);
return;
return ret;
}
void cVideo::StopPicture()

View File

@@ -199,7 +199,7 @@ class cVideo
bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; };
void SetCECAutoView(bool) { return; };
void SetCECAutoStandby(bool) { return; };
void ShowPicture(const char * fname, const char *_destname = NULL);
bool ShowPicture(const char * fname, const char *_destname = NULL);
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, int startx = 0, int starty = 0, int endx = 1279, int endy = 719);

View File

@@ -389,8 +389,9 @@ void cVideo::SetVideoMode(analog_mode_t mode)
fop(ioctl, MPEG_VID_SET_OUTFMT, outputformat);
}
void cVideo::ShowPicture(const char * fname)
bool cVideo::ShowPicture(const char * fname)
{
bool ret = false;
hal_debug("%s(%s)\n", __FUNCTION__, fname);
char destname[512];
char cmd[512];
@@ -402,7 +403,7 @@ void cVideo::ShowPicture(const char * fname)
if (stat(fname, &st2))
{
hal_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):
@@ -451,13 +452,14 @@ void cVideo::ShowPicture(const char * fname)
buf.ulStartAdrOff = (int)data;
Stop(false);
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

@@ -172,7 +172,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);