diff --git a/common/ca_ci.cpp b/common/ca_ci.cpp index 471cac0..c46e028 100644 --- a/common/ca_ci.cpp +++ b/common/ca_ci.cpp @@ -878,6 +878,10 @@ bool cCA::SendCAPMT(u64 tpid, u8 source, u8 camask, const unsigned char * cabuf, (*It)->SID[0] = SID; (*It)->ci_use_count = 1; (*It)->TP = TP; +#if HAVE_ARM_HARDWARE + if(!checkLiveSlot && mode && (*It)->source != source) + setInputSource((eDVBCISlot*)(*It), false); +#endif (*It)->source = source; (*It)->pmtlen = calen; for (i = 0; i < calen; i++) diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index 3e3f7ca..0cf60bb 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -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() @@ -918,7 +927,7 @@ void cVideo::SetControl(int control, int value) case VIDEO_CONTROL_ZAPPING_MODE: zapping_mode = value; const char *mode_zapping[] = { "hold", "mute" }; - proc_put("/proc/stb/video/zapping_mode", mode_zapping[zapping_mode], strlen(mode_zapping[zapping_mode])); + proc_put("/proc/stb/video/zapmode", mode_zapping[zapping_mode], strlen(mode_zapping[zapping_mode])); break; } if (p) { diff --git a/libarmbox/video_lib.h b/libarmbox/video_lib.h index eea898f..eda5251 100644 --- a/libarmbox/video_lib.h +++ b/libarmbox/video_lib.h @@ -237,7 +237,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); diff --git a/libazbox/video.cpp b/libazbox/video.cpp index 0e6656d..99b249e 100644 --- a/libazbox/video.cpp +++ b/libazbox/video.cpp @@ -160,7 +160,7 @@ int cVideo::setAspectRatio(int aspect, int mode) int n; int mo = (mode < 0||mode > 3) ? 4 : mode; - hal_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[(mo]); + hal_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[(mo)]); if (aspect > 3 || aspect == 0) hal_info("%s: invalid aspect: %d\n", __func__, aspect); @@ -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() diff --git a/libazbox/video_lib.h b/libazbox/video_lib.h index b6050f5..a17b863 100644 --- a/libazbox/video_lib.h +++ b/libazbox/video_lib.h @@ -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); diff --git a/libgeneric-pc/video.cpp b/libgeneric-pc/video.cpp index 102ea7b..5e167ce 100644 --- a/libgeneric-pc/video.cpp +++ b/libgeneric-pc/video.cpp @@ -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() diff --git a/libgeneric-pc/video_lib.h b/libgeneric-pc/video_lib.h index 8201f7c..de6c012 100644 --- a/libgeneric-pc/video_lib.h +++ b/libgeneric-pc/video_lib.h @@ -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; }; diff --git a/libraspi/video.cpp b/libraspi/video.cpp index 7aa8f4c..0cda7dd 100644 --- a/libraspi/video.cpp +++ b/libraspi/video.cpp @@ -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() diff --git a/libraspi/video_lib.h b/libraspi/video_lib.h index e70c343..cc23a06 100644 --- a/libraspi/video_lib.h +++ b/libraspi/video_lib.h @@ -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); diff --git a/libspark/video.cpp b/libspark/video.cpp index a7b56f2..dc9e443 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -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() diff --git a/libspark/video_lib.h b/libspark/video_lib.h index 278b88e..d77415c 100644 --- a/libspark/video_lib.h +++ b/libspark/video_lib.h @@ -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); diff --git a/libtriple/video_td.cpp b/libtriple/video_td.cpp index 33f1fc4..72e7e79 100644 --- a/libtriple/video_td.cpp +++ b/libtriple/video_td.cpp @@ -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 */ diff --git a/libtriple/video_td.h b/libtriple/video_td.h index b9b7921..4c0e032 100644 --- a/libtriple/video_td.h +++ b/libtriple/video_td.h @@ -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);