mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
ShowPicture: return boolean expression
This commit is contained in:
@@ -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>
|
2017-11-02 Thilo Graf <dbt@novatux.de>
|
||||||
|
|
||||||
version 0.2.0-generic-pc
|
version 0.2.0-generic-pc
|
||||||
|
@@ -351,13 +351,14 @@ void cVideo::SetVideoMode(analog_mode_t mode)
|
|||||||
proc_put("/proc/stb/avs/0/colorformat", m, strlen(m));
|
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);
|
lt_debug("%s(%s)\n", __func__, fname);
|
||||||
char destname[512];
|
char destname[512];
|
||||||
char cmd[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 */
|
/* does not work and the driver does not seem to like it */
|
||||||
lt_info("%s: video_standby == true\n", __func__);
|
lt_info("%s: video_standby == true\n", __func__);
|
||||||
return;
|
return ret;
|
||||||
}
|
}
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
lt_info("%s: decoder not opened?\n", __func__);
|
lt_info("%s: decoder not opened\n", __func__);
|
||||||
return;
|
return ret;
|
||||||
}
|
}
|
||||||
strcpy(destname, "/var/cache");
|
strcpy(destname, "/var/cache");
|
||||||
if (stat(fname, &st2))
|
if (stat(fname, &st2))
|
||||||
{
|
{
|
||||||
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
|
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
|
||||||
return;
|
return ret;
|
||||||
}
|
}
|
||||||
mkdir(destname, 0755);
|
mkdir(destname, 0755);
|
||||||
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
|
/* 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);
|
read(mfd, iframe, st.st_size);
|
||||||
show_iframe(fd, iframe, st.st_size);
|
show_iframe(fd, iframe, st.st_size);
|
||||||
free(iframe);
|
free(iframe);
|
||||||
|
ret = true;
|
||||||
out:
|
out:
|
||||||
close(mfd);
|
close(mfd);
|
||||||
pthread_mutex_unlock(&stillp_mutex);
|
pthread_mutex_unlock(&stillp_mutex);
|
||||||
return;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cVideo::StopPicture()
|
void cVideo::StopPicture()
|
||||||
|
@@ -46,7 +46,7 @@ public:
|
|||||||
int setBlank(int blank);
|
int setBlank(int blank);
|
||||||
int SetStreamType(VIDEO_FORMAT type);
|
int SetStreamType(VIDEO_FORMAT type);
|
||||||
void SetSyncMode(AVSYNC_TYPE mode);
|
void SetSyncMode(AVSYNC_TYPE mode);
|
||||||
void ShowPicture(const char * fname);
|
bool ShowPicture(const char * fname);
|
||||||
void Standby(unsigned int bOn);
|
void Standby(unsigned int bOn);
|
||||||
void Pig(int x, int y, int w, int h, int osd_w, int osd_h);
|
void Pig(int x, int y, int w, int h, int osd_w, int osd_h);
|
||||||
|
|
||||||
|
@@ -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);
|
lt_info("%s(%s)\n", __func__, fname);
|
||||||
if (access(fname, R_OK))
|
if (access(fname, R_OK))
|
||||||
return;
|
return ret;
|
||||||
still_m.lock();
|
still_m.lock();
|
||||||
stillpicture = true;
|
stillpicture = true;
|
||||||
buf_num = 0;
|
buf_num = 0;
|
||||||
@@ -312,7 +313,7 @@ void VDec::ShowPicture(const char *fname)
|
|||||||
|
|
||||||
if (avformat_open_input(&avfc, fname, NULL, NULL) < 0) {
|
if (avformat_open_input(&avfc, fname, NULL, NULL) < 0) {
|
||||||
lt_info("%s: Could not open file %s\n", __func__, fname);
|
lt_info("%s: Could not open file %s\n", __func__, fname);
|
||||||
return;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avformat_find_stream_info(avfc, NULL) < 0) {
|
if (avformat_find_stream_info(avfc, NULL) < 0) {
|
||||||
@@ -385,6 +386,7 @@ void VDec::ShowPicture(const char *fname)
|
|||||||
buf_num--;
|
buf_num--;
|
||||||
}
|
}
|
||||||
buf_m.unlock();
|
buf_m.unlock();
|
||||||
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
av_packet_unref(&avpkt);
|
av_packet_unref(&avpkt);
|
||||||
@@ -396,6 +398,7 @@ void VDec::ShowPicture(const char *fname)
|
|||||||
out_close:
|
out_close:
|
||||||
avformat_close_input(&avfc);
|
avformat_close_input(&avfc);
|
||||||
lt_debug("%s(%s) end\n", __func__, fname);
|
lt_debug("%s(%s) end\n", __func__, fname);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cVideo::StopPicture()
|
void cVideo::StopPicture()
|
||||||
|
@@ -80,7 +80,7 @@ class VDec : public OpenThreads::Thread
|
|||||||
int Stop(bool blank = true);
|
int Stop(bool blank = true);
|
||||||
|
|
||||||
int SetStreamType(VIDEO_FORMAT type);
|
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);
|
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);
|
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);
|
||||||
|
@@ -189,7 +189,7 @@ class cVideo
|
|||||||
bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; };
|
bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; };
|
||||||
void SetCECAutoView(bool) { return; };
|
void SetCECAutoView(bool) { return; };
|
||||||
void SetCECAutoStandby(bool) { return; };
|
void SetCECAutoStandby(bool) { return; };
|
||||||
void ShowPicture(const char * fname);
|
bool ShowPicture(const char * fname);
|
||||||
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);
|
void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600);
|
||||||
|
@@ -394,13 +394,14 @@ void cVideo::SetVideoMode(analog_mode_t mode)
|
|||||||
proc_put("/proc/stb/avs/0/colorformat", m, strlen(m));
|
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);
|
lt_debug("%s(%s)\n", __func__, fname);
|
||||||
char destname[512];
|
char destname[512];
|
||||||
char cmd[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 */
|
/* does not work and the driver does not seem to like it */
|
||||||
lt_info("%s: video_standby == true\n", __func__);
|
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");
|
strcpy(destname, "/var/cache");
|
||||||
if (stat(fname, &st2))
|
if (stat(fname, &st2))
|
||||||
{
|
{
|
||||||
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
|
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
|
||||||
return;
|
return ret;
|
||||||
}
|
}
|
||||||
mkdir(destname, 0755);
|
mkdir(destname, 0755);
|
||||||
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
|
/* 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 };
|
video_still_picture sp = { iframe, st.st_size };
|
||||||
fop(ioctl, VIDEO_STILLPICTURE, &sp);
|
fop(ioctl, VIDEO_STILLPICTURE, &sp);
|
||||||
free(iframe);
|
free(iframe);
|
||||||
|
ret = true;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
close(mfd);
|
close(mfd);
|
||||||
return;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cVideo::StopPicture()
|
void cVideo::StopPicture()
|
||||||
|
@@ -46,7 +46,7 @@ public:
|
|||||||
int Stop(bool blank = true);
|
int Stop(bool blank = true);
|
||||||
int SetStreamType(VIDEO_FORMAT type);
|
int SetStreamType(VIDEO_FORMAT type);
|
||||||
void SetSyncMode(AVSYNC_TYPE mode);
|
void SetSyncMode(AVSYNC_TYPE mode);
|
||||||
void ShowPicture(const char * fname);
|
bool ShowPicture(const char * fname);
|
||||||
void Standby(unsigned int bOn);
|
void Standby(unsigned int bOn);
|
||||||
|
|
||||||
/* used internally by dmx */
|
/* used internally by dmx */
|
||||||
|
@@ -75,7 +75,7 @@ public:
|
|||||||
|
|
||||||
/* set video_system */
|
/* set video_system */
|
||||||
int SetVideoSystem(int video_system, bool remember = true);
|
int SetVideoSystem(int video_system, bool remember = true);
|
||||||
void ShowPicture(const char * fname);
|
bool ShowPicture(const char * fname);
|
||||||
void StopPicture();
|
void StopPicture();
|
||||||
void Standby(unsigned int bOn);
|
void Standby(unsigned int bOn);
|
||||||
void Pig(int x, int y, int w, int h);
|
void Pig(int x, int y, int w, int h);
|
||||||
|
@@ -469,13 +469,14 @@ void VDec::SetVideoMode(analog_mode_t mode)
|
|||||||
fop(ioctl, MPEG_VID_SET_OUTFMT, outputformat);
|
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);
|
lt_debug("%s(%s)\n", __FUNCTION__, fname);
|
||||||
char destname[512];
|
char destname[512];
|
||||||
char cmd[512];
|
char cmd[512];
|
||||||
@@ -487,7 +488,7 @@ void VDec::ShowPicture(const char * fname)
|
|||||||
if (stat(fname, &st2))
|
if (stat(fname, &st2))
|
||||||
{
|
{
|
||||||
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
|
lt_info("%s: could not stat %s (%m)\n", __func__, fname);
|
||||||
return;
|
return ret;
|
||||||
}
|
}
|
||||||
mkdir(destname, 0755);
|
mkdir(destname, 0755);
|
||||||
/* the cache filename is (example for /share/tuxbox/neutrino/icons/radiomode.jpg):
|
/* 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 */
|
/* writing twice seems to be more reliable */
|
||||||
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
|
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
|
||||||
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
|
fop(ioctl, MPEG_VID_STILLP_WRITE, &buf);
|
||||||
|
ret = true;
|
||||||
}
|
}
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
close(mfd);
|
close(mfd);
|
||||||
out:
|
out:
|
||||||
pthread_mutex_unlock(&stillp_mutex);
|
pthread_mutex_unlock(&stillp_mutex);
|
||||||
return;
|
return ret;
|
||||||
#if 0
|
#if 0
|
||||||
/* DirectFB based picviewer: works, but is slow and the infobar
|
/* DirectFB based picviewer: works, but is slow and the infobar
|
||||||
draws in the same plane */
|
draws in the same plane */
|
||||||
|
@@ -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);
|
lt_info("%s(%s)\n", __func__, fname);
|
||||||
if (access(fname, R_OK))
|
if (access(fname, R_OK))
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cVideo::StopPicture()
|
void cVideo::StopPicture()
|
||||||
|
Reference in New Issue
Block a user