From 8f8ceef47980249e1f782133fd86aefd0a274dc6 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 2 Nov 2013 20:24:56 +0100 Subject: [PATCH 01/15] spark: use proc_tools Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/f798ff9d71be97d415719ec0c0171844c4379729 Author: Stefan Seyfried Date: 2013-11-02 (Sat, 02 Nov 2013) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libspark/audio.cpp | 24 ++++++------------------ libspark/video.cpp | 43 +++---------------------------------------- 2 files changed, 9 insertions(+), 58 deletions(-) diff --git a/libspark/audio.cpp b/libspark/audio.cpp index 7a55814..268377a 100644 --- a/libspark/audio.cpp +++ b/libspark/audio.cpp @@ -7,6 +7,8 @@ #include #include + +#include #include "audio_lib.h" #include "audio_mixer.h" #include "lt_debug.h" @@ -19,19 +21,6 @@ cAudio * audioDecoder = NULL; -static int proc_put(const char *path, const char *value, const int len) -{ - int ret, ret2; - int pfd = open(path, O_WRONLY); - if (pfd < 0) - return pfd; - ret = write(pfd, value, len); - ret2 = close(pfd); - if (ret2 < 0) - return ret2; - return ret; -} - cAudio::cAudio(void *, void *, void *) { fd = -1; @@ -117,7 +106,6 @@ int map_volume(const int volume) return vol; } - int cAudio::setVolume(unsigned int left, unsigned int right) { lt_debug("%s(%d, %d)\n", __func__, left, right); @@ -281,7 +269,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) usable = devmask & stereo; if (usable == 0) { lt_info("%s: devmask: %08x stereo: %08x, no usable dev :-(\n", - __func__, devmask, stereo); + __func__, devmask, stereo); close(mixer_fd); mixer_fd = -1; return 0; /* TODO: should we treat this as error? */ @@ -290,13 +278,13 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) if (__builtin_popcount (usable) != 1) { /* TODO: this code is not yet tested as I have only single-mixer devices... */ lt_info("%s: more than one mixer control: devmask %08x stereo %08x\n" - "%s: querying MIX_NUMBER environment variable...\n", - __func__, devmask, stereo, __func__); + "%s: querying MIX_NUMBER environment variable...\n", + __func__, devmask, stereo, __func__); const char *tmp = getenv("MIX_NUMBER"); if (tmp) mixer_num = atoi(tmp); lt_info("%s: mixer_num is %d -> device %08x\n", - __func__, mixer_num, (mixer_num >= 0) ? (1 << mixer_num) : 0); + __func__, mixer_num, (mixer_num >= 0) ? (1 << mixer_num) : 0); /* no error checking, you'd better know what you are doing... */ } else { mixer_num = 0; diff --git a/libspark/video.cpp b/libspark/video.cpp index cb734c1..a0f0e87 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -38,6 +38,9 @@ #include #include "video_lib.h" #include "lt_debug.h" + +#include + #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_VIDEO, this, args) #define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, NULL, args) @@ -102,46 +105,6 @@ static const char *VMPEG_framerate[] = { #define VIDEO_STREAMTYPE_H265_HEVC 7 #define VIDEO_STREAMTYPE_AVS 16 - -static int proc_put(const char *path, const char *value, const int len) -{ - int ret, ret2; - int pfd = open(path, O_WRONLY); - if (pfd < 0) - return pfd; - ret = write(pfd, value, len); - ret2 = close(pfd); - if (ret2 < 0) - return ret2; - return ret; -} - -static int proc_get(const char *path, char *value, const int len) -{ - int ret, ret2; - int pfd = open(path, O_RDONLY); - if (pfd < 0) - return pfd; - ret = read(pfd, value, len); - value[len-1] = '\0'; /* make sure string is terminated */ - while (ret > 0 && isspace(value[ret-1])) - value[--ret] = '\0'; /* remove trailing whitespace */ - ret2 = close(pfd); - if (ret2 < 0) - return ret2; - return ret; -} - -static unsigned int proc_get_hex(const char *path) -{ - unsigned int n, ret = 0; - char buf[16]; - n = proc_get(path, buf, 16); - if (n > 0) - sscanf(buf, "%x", &ret); - return ret; -} - static int hdmi_out(bool enable) { struct stmfbio_output_configuration out; From 23d82962e5a9095d662efc50c4d76170d73b6b3b Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Fri, 25 Dec 2015 19:08:31 +0100 Subject: [PATCH 02/15] spark/video: implicitly do StopPicture() on CVideo::Start() This seems to be what the coolstream code does. TODO: look out for side effects (in radio mode etc...) Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/e66e7c34e98db7bc6ec1ab9ea60e3a08b6c3bd97 Author: Stefan Seyfried Date: 2015-12-25 (Fri, 25 Dec 2015) ------------------ This commit was generated by Migit --- libspark/video.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libspark/video.cpp b/libspark/video.cpp index a0f0e87..71b2351 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -268,6 +268,12 @@ int cVideo::Start(void * /*PcrChannel*/, unsigned short /*PcrPid*/, unsigned sho if (playstate == VIDEO_FREEZED) /* in theory better, but not in practice :-) */ fop(ioctl, MPEG_VID_CONTINUE); #endif + /* implicitly do StopPicture() on video->Start() */ + if (stillpicture) { + lt_info("%s: stillpicture == true, doing implicit StopPicture()\n", __func__); + stillpicture = false; + Stop(1); + } playstate = VIDEO_PLAYING; fop(ioctl, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX); int res = fop(ioctl, VIDEO_PLAY); From 9fb81c9ac5d20288dfb3ff49b2e23c20a13a203f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 19 Feb 2017 17:54:56 +0100 Subject: [PATCH 03/15] spark/video: add missing O_CLOEXEC to memory fd Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/d1f2e0d2868c3c00da064d09d70598cbe2448b53 Author: Stefan Seyfried Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libspark/video.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libspark/video.cpp b/libspark/video.cpp index 71b2351..a83a351 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -1190,7 +1190,7 @@ bool cVideo::GetScreenImage(unsigned char * &video, int &xres, int &yres, bool g lt_info("%s: primary display pane not found in /proc/bpa2\n", __func__); } - mfd = open("/dev/mem", O_RDWR); + mfd = open("/dev/mem", O_RDWR | O_CLOEXEC); if (mfd < 0) { lt_info("%s: cannot open open /dev/mem (%m)\n", __func__); goto error_cleanup; From d47a08df938744efe2192d97af5944d3f1de97a5 Mon Sep 17 00:00:00 2001 From: max_10 Date: Sat, 7 Oct 2017 17:08:04 +0200 Subject: [PATCH 04/15] Revert "align videomodes" This reverts commit d8dfd55f6b502f39808689a8f2b96a9395d9ccf9. Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/196cbf0021d2ec7bec3220dc7c42eb7dfd8112e0 Author: max_10 Date: 2017-10-07 (Sat, 07 Oct 2017) ------------------ This commit was generated by Migit --- libspark/video_lib.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libspark/video_lib.h b/libspark/video_lib.h index e172cb9..3f8a7c2 100644 --- a/libspark/video_lib.h +++ b/libspark/video_lib.h @@ -101,12 +101,9 @@ typedef enum { VIDEO_STD_1080P30, VIDEO_STD_1080P24, VIDEO_STD_1080P25, - VIDEO_STD_1080P50, - VIDEO_STD_1080P60, - VIDEO_STD_1080P2397, - VIDEO_STD_1080P2997, VIDEO_STD_AUTO, - VIDEO_STD_MAX = VIDEO_STD_AUTO + VIDEO_STD_1080P50, /* SPARK only */ + VIDEO_STD_MAX } VIDEO_STD; /* not used, for dummy functions */ From e5705886b7d26dc04dc06c29f70b1ef0cae55227 Mon Sep 17 00:00:00 2001 From: max_10 Date: Sat, 7 Oct 2017 17:08:29 +0200 Subject: [PATCH 05/15] Revert "align videomodes" This reverts commit 59fc4f222fa613b37c05663cd20726682a3a62f8. Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/1bd610e6e8136f0c91237b7d44718f3f81321a94 Author: max_10 Date: 2017-10-07 (Sat, 07 Oct 2017) ------------------ This commit was generated by Migit --- libspark/video.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libspark/video.cpp b/libspark/video.cpp index a83a351..f1e0dbe 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -337,8 +337,7 @@ int cVideo::GetVideoSystem() "1080p50", // VIDEO_STD_1080P50 "1080p60", // VIDEO_STD_1080P60 "1080p2397", // VIDEO_STD_1080P2397 - "1080p2997", // VIDEO_STD_1080P2997 - "720p50" // VIDEO_STD_AUTO + "1080p2997" // VIDEO_STD_1080P2997 }; int ret = proc_get("/proc/stb/video/videomode", current, 32); @@ -369,11 +368,8 @@ int cVideo::SetVideoSystem(int video_system, bool remember) "1080p30", // VIDEO_STD_1080P30 "1080p24", // VIDEO_STD_1080P24 "1080p25", // VIDEO_STD_1080P25 - "1080p50", // VIDEO_STD_1080P50 - "1080p60", // VIDEO_STD_1080P60 - "1080p2397", // VIDEO_STD_1080P2397 - "1080p2997", // VIDEO_STD_1080P2997 - "720p50" // VIDEO_STD_AUTO + "720p50", // VIDEO_STD_AUTO -> not implemented + "1080p50" // VIDEO_STD_1080P50 -> SPARK only }; if (video_system > VIDEO_STD_MAX) From e47f6dd7dc41c53166ece4f6e56eacbb59402825 Mon Sep 17 00:00:00 2001 From: max_10 Date: Sat, 7 Oct 2017 17:08:50 +0200 Subject: [PATCH 06/15] Revert "implement GetVideoSystem" This reverts commit 6c74b8f4c5c90a2a0b4b6c03f52ebccfc603d40a. Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/ff94afb0c27ea3c00a6a04a84caff305bab98ed6 Author: max_10 Date: 2017-10-07 (Sat, 07 Oct 2017) ------------------ This commit was generated by Migit --- libspark/video.cpp | 34 ---------------------------------- libspark/video_lib.h | 3 --- 2 files changed, 37 deletions(-) diff --git a/libspark/video.cpp b/libspark/video.cpp index f1e0dbe..37ea57d 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -317,40 +317,6 @@ int cVideo::setBlank(int) return Stop(1); } -int cVideo::GetVideoSystem() -{ - lt_debug("%s\n", __func__); - char current[32]; - static const char *modes[] = { - "pal", // VIDEO_STD_NTSC - "pal", // VIDEO_STD_SECAM - "pal", // VIDEO_STD_PAL - "480p", // VIDEO_STD_480P - "576p50", // VIDEO_STD_576P - "720p60", // VIDEO_STD_720P60 - "1080i60", // VIDEO_STD_1080I60 - "720p50", // VIDEO_STD_720P50 - "1080i50", // VIDEO_STD_1080I50 - "1080p30", // VIDEO_STD_1080P30 - "1080p24", // VIDEO_STD_1080P24 - "1080p25", // VIDEO_STD_1080P25 - "1080p50", // VIDEO_STD_1080P50 - "1080p60", // VIDEO_STD_1080P60 - "1080p2397", // VIDEO_STD_1080P2397 - "1080p2997" // VIDEO_STD_1080P2997 - }; - - int ret = proc_get("/proc/stb/video/videomode", current, 32); - for (int i=0; i Date: Sat, 26 Aug 2017 12:56:32 +0200 Subject: [PATCH 07/15] libspark: implement cVideo::GetVideoSystem() Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/86b43b40e4a8a5250e446b444b7420c8e38d6aa6 Author: Stefan Seyfried Date: 2017-08-26 (Sat, 26 Aug 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libspark/video.cpp | 52 +++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/libspark/video.cpp b/libspark/video.cpp index 37ea57d..5692d47 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -95,6 +95,23 @@ static const char *VMPEG_framerate[] = { "/proc/stb/vmpeg/1/framerate" }; +static const char *vid_modes[] = { + "pal", // VIDEO_STD_NTSC + "pal", // VIDEO_STD_SECAM + "pal", // VIDEO_STD_PAL + "480p", // VIDEO_STD_480P + "576p50", // VIDEO_STD_576P + "720p60", // VIDEO_STD_720P60 + "1080i60", // VIDEO_STD_1080I60 + "720p50", // VIDEO_STD_720P50 + "1080i50", // VIDEO_STD_1080I50 + "1080p30", // VIDEO_STD_1080P30 + "1080p24", // VIDEO_STD_1080P24 + "1080p25", // VIDEO_STD_1080P25 + "720p50", // VIDEO_STD_AUTO -> not implemented + "1080p50", // VIDEO_STD_1080P50 -> SPARK only + NULL +}; #define VIDEO_STREAMTYPE_MPEG2 0 #define VIDEO_STREAMTYPE_MPEG4_H264 1 @@ -321,22 +338,6 @@ int cVideo::SetVideoSystem(int video_system, bool remember) { lt_debug("%s(%d, %d)\n", __func__, video_system, remember); char current[32]; - static const char *modes[] = { - "pal", // VIDEO_STD_NTSC - "pal", // VIDEO_STD_SECAM - "pal", // VIDEO_STD_PAL - "480p", // VIDEO_STD_480P - "576p50", // VIDEO_STD_576P - "720p60", // VIDEO_STD_720P60 - "1080i60", // VIDEO_STD_1080I60 - "720p50", // VIDEO_STD_720P50 - "1080i50", // VIDEO_STD_1080I50 - "1080p30", // VIDEO_STD_1080P30 - "1080p24", // VIDEO_STD_1080P24 - "1080p25", // VIDEO_STD_1080P25 - "720p50", // VIDEO_STD_AUTO -> not implemented - "1080p50" // VIDEO_STD_1080P50 -> SPARK only - }; if (video_system > VIDEO_STD_MAX) { @@ -344,12 +345,12 @@ int cVideo::SetVideoSystem(int video_system, bool remember) return -1; } int ret = proc_get("/proc/stb/video/videomode", current, 32); - if (strcmp(current, modes[video_system]) == 0) + if (strcmp(current, vid_modes[video_system]) == 0) { lt_info("%s: video_system %d (%s) already set, skipping\n", __func__, video_system, current); return 0; } - lt_info("%s: old: '%s' new: '%s'\n", __func__, current, modes[video_system]); + lt_info("%s: old: '%s' new: '%s'\n", __func__, current, vid_modes[video_system]); bool stopped = false; if (playstate == VIDEO_PLAYING) { @@ -358,7 +359,7 @@ int cVideo::SetVideoSystem(int video_system, bool remember) stopped = true; } hdmi_out(false); - ret = proc_put("/proc/stb/video/videomode", modes[video_system],strlen(modes[video_system])); + ret = proc_put("/proc/stb/video/videomode", vid_modes[video_system],strlen(vid_modes[video_system])); hdmi_out(true); if (stopped) Start(); @@ -366,6 +367,19 @@ int cVideo::SetVideoSystem(int video_system, bool remember) return ret; } +int cVideo::GetVideoSystem(void) +{ + char current[32]; + proc_get("/proc/stb/video/videomode", current, 32); + for (int i = 2; vid_modes[i]; i++) /* 0,1,2 are all "pal" */ + { + if (strcmp(current, vid_modes[i]) == 0) + return i; + } + lt_info("%s: could not find '%s' mode, returning VIDEO_STD_720P50\n", __func__, current); + return VIDEO_STD_720P50; +} + int cVideo::getPlayState(void) { return playstate; From 8ecc78a26411dba74d8eb212175681ded25e4ac3 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 26 Aug 2017 12:57:40 +0200 Subject: [PATCH 08/15] libspark: implement cVideo::GetVideoSystemFormatName() Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/57f9165852d3543b9989ce61e2dbc1fce2b6e1a6 Author: Stefan Seyfried Date: 2017-08-26 (Sat, 26 Aug 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- include/video_hal.h | 222 +++++++++++++++++++++++++++++++++++++++++++ libspark/video.cpp | 11 +++ libspark/video_lib.h | 14 ++- 3 files changed, 245 insertions(+), 2 deletions(-) diff --git a/include/video_hal.h b/include/video_hal.h index ec63331..9a9ec8f 100644 --- a/include/video_hal.h +++ b/include/video_hal.h @@ -1,3 +1,4 @@ +<<<<<<< HEAD #include #if HAVE_TRIPLEDRAGON #include "../libtriple/video_td.h" @@ -16,6 +17,227 @@ #else #error neither HAVE_TRIPLEDRAGON nor HAVE_SPARK_HARDWARE defined #endif +======= +/* + Copyright 2010-2013 Stefan Seyfried + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + + +#ifndef _VIDEO_LIB_H +#define _VIDEO_LIB_H + +#include +#include + +typedef struct cs_vs_format_t +{ + char format[16]; +} cs_vs_format_struct_t; + +typedef enum { + ANALOG_SD_RGB_CINCH = 0x00, + ANALOG_SD_YPRPB_CINCH, + ANALOG_HD_RGB_CINCH, + ANALOG_HD_YPRPB_CINCH, + ANALOG_SD_RGB_SCART = 0x10, + ANALOG_SD_YPRPB_SCART, + ANALOG_HD_RGB_SCART, + ANALOG_HD_YPRPB_SCART, + ANALOG_SCART_MASK = 0x10 +} analog_mode_t; + + +typedef enum { + VIDEO_FORMAT_MPEG2 = 0, + VIDEO_FORMAT_MPEG4, /* H264 */ + VIDEO_FORMAT_VC1, + VIDEO_FORMAT_JPEG, + VIDEO_FORMAT_GIF, + VIDEO_FORMAT_PNG, + VIDEO_FORMAT_DIVX,/* DIVX 3.11 */ + VIDEO_FORMAT_MPEG4PART2,/* MPEG4 SVH, MPEG4 SP, MPEG4 ASP, DIVX4,5,6 */ + VIDEO_FORMAT_REALVIDEO8, + VIDEO_FORMAT_REALVIDEO9, + VIDEO_FORMAT_ON2_VP6, + VIDEO_FORMAT_ON2_VP8, + VIDEO_FORMAT_SORENSON_SPARK, + VIDEO_FORMAT_H263, + VIDEO_FORMAT_H263_ENCODER, + VIDEO_FORMAT_H264_ENCODER, + VIDEO_FORMAT_MPEG4PART2_ENCODER, + VIDEO_FORMAT_AVS, + VIDEO_FORMAT_VIP656, + VIDEO_FORMAT_UNSUPPORTED +} VIDEO_FORMAT; + +typedef enum { + VIDEO_SD = 0, + VIDEO_HD, + VIDEO_120x60i, + VIDEO_320x240i, + VIDEO_1440x800i, + VIDEO_360x288i +} VIDEO_DEFINITION; + +typedef enum { + VIDEO_FRAME_RATE_23_976 = 0, + VIDEO_FRAME_RATE_24, + VIDEO_FRAME_RATE_25, + VIDEO_FRAME_RATE_29_97, + VIDEO_FRAME_RATE_30, + VIDEO_FRAME_RATE_50, + VIDEO_FRAME_RATE_59_94, + VIDEO_FRAME_RATE_60 +} VIDEO_FRAME_RATE; + +typedef enum { + DISPLAY_AR_1_1, + DISPLAY_AR_4_3, + DISPLAY_AR_14_9, + DISPLAY_AR_16_9, + DISPLAY_AR_20_9, + DISPLAY_AR_RAW, +} DISPLAY_AR; + +typedef enum { + DISPLAY_AR_MODE_PANSCAN = 0, + DISPLAY_AR_MODE_LETTERBOX, + DISPLAY_AR_MODE_NONE, + DISPLAY_AR_MODE_PANSCAN2 +} DISPLAY_AR_MODE; + +typedef enum { + VIDEO_DB_DR_NEITHER = 0, + VIDEO_DB_ON, + VIDEO_DB_DR_BOTH +} VIDEO_DB_DR; + +typedef enum { + VIDEO_PLAY_STILL = 0, + VIDEO_PLAY_CLIP, + VIDEO_PLAY_TRICK, + VIDEO_PLAY_MOTION, + VIDEO_PLAY_MOTION_NO_SYNC +} VIDEO_PLAY_MODE; + +typedef enum { + VIDEO_STD_NTSC, + VIDEO_STD_SECAM, + VIDEO_STD_PAL, + VIDEO_STD_480P, + VIDEO_STD_576P, + VIDEO_STD_720P60, + VIDEO_STD_1080I60, + VIDEO_STD_720P50, + VIDEO_STD_1080I50, + VIDEO_STD_1080P30, + VIDEO_STD_1080P24, + VIDEO_STD_1080P25, + VIDEO_STD_1080P50, + VIDEO_STD_1080P60, + VIDEO_STD_AUTO, + VIDEO_STD_MAX +} VIDEO_STD; + +/* not used, for dummy functions */ +typedef enum { + VIDEO_HDMI_CEC_MODE_OFF = 0, + VIDEO_HDMI_CEC_MODE_TUNER, + VIDEO_HDMI_CEC_MODE_RECORDER +} VIDEO_HDMI_CEC_MODE; + +typedef enum +{ + VIDEO_CONTROL_BRIGHTNESS = 0, + VIDEO_CONTROL_CONTRAST, + VIDEO_CONTROL_SATURATION, + VIDEO_CONTROL_HUE, + VIDEO_CONTROL_SHARPNESS, + VIDEO_CONTROL_MAX = VIDEO_CONTROL_SHARPNESS +} VIDEO_CONTROL; + +class cDemux; +class cPlayback; +class VDec; + +class cVideo +{ + friend class cPlayback; + friend class cDemux; + public: + /* constructor & destructor */ + cVideo(int mode, void *, void *, unsigned int unit = 0); + ~cVideo(void); + + void * GetTVEnc() { return NULL; }; + void * GetTVEncSD() { return NULL; }; + + /* aspect ratio */ + int getAspectRatio(void); + void getPictureInfo(int &width, int &height, int &rate); + int setAspectRatio(int aspect, int mode); + + /* cropping mode */ + int setCroppingMode(void); + + /* get play state */ + int getPlayState(void); + + /* blank on freeze */ + int getBlank(void); + int setBlank(int enable); + + /* change video play state. Parameters are all unused. */ + int Start(void *PcrChannel = NULL, unsigned short PcrPid = 0, unsigned short VideoPid = 0, void *x = NULL); + int Stop(bool blank = true); + bool Pause(void); + + /* get video system infos */ + int GetVideoSystem(void); + /* when system = -1 then use current video system */ + void GetVideoSystemFormatName(cs_vs_format_t* format, int system = -1); + + /* set video_system */ + int SetVideoSystem(int video_system, bool remember = true); + int SetStreamType(VIDEO_FORMAT type); + void SetSyncMode(AVSYNC_TYPE mode); + bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; }; + void SetCECAutoView(bool) { return; }; + void SetCECAutoStandby(bool) { return; }; + void 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); + void SetControl(int, int) { return; }; + void setContrast(int val); + void SetVideoMode(analog_mode_t mode); + void SetDBDR(int) { return; }; + void SetAudioHandle(void *) { return; }; + 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); + bool GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false); + private: + VDec *vdec; + void *pdata; +}; +>>>>>>> 6e3b116... libspark: implement cVideo::GetVideoSystemFormatName() #if STB_HAL_VIDEO_HAS_GETSCREENIMAGE #define SCREENSHOT 1 diff --git a/libspark/video.cpp b/libspark/video.cpp index 5692d47..16f0477 100644 --- a/libspark/video.cpp +++ b/libspark/video.cpp @@ -380,6 +380,17 @@ int cVideo::GetVideoSystem(void) return VIDEO_STD_720P50; } +void cVideo::GetVideoSystemFormatName(cs_vs_format_t *format, int system) +{ + if (system == -1) + system = GetVideoSystem(); + if (system < 0 || system > VIDEO_STD_1080P50) { + lt_info("%s: invalid system %d\n", __func__, system); + strcpy(format->format, "invalid"); + } else + strcpy(format->format, vid_modes[system]); +} + int cVideo::getPlayState(void) { return playstate; diff --git a/libspark/video_lib.h b/libspark/video_lib.h index 139333d..d4bb5f7 100644 --- a/libspark/video_lib.h +++ b/libspark/video_lib.h @@ -5,6 +5,11 @@ #include "../common/cs_types.h" #include "dmx_lib.h" +typedef struct cs_vs_format_t +{ + char format[16]; +} cs_vs_format_struct_t; + typedef enum { ANALOG_SD_RGB_CINCH = 0x00, ANALOG_SD_YPRPB_CINCH, @@ -108,7 +113,7 @@ typedef enum { /* not used, for dummy functions */ typedef enum { - VIDEO_HDMI_CEC_MODE_OFF = 0, + VIDEO_HDMI_CEC_MODE_OFF = 0, VIDEO_HDMI_CEC_MODE_TUNER, VIDEO_HDMI_CEC_MODE_RECORDER } VIDEO_HDMI_CEC_MODE; @@ -126,8 +131,8 @@ typedef enum class cVideo { - friend class cDemux; friend class cPlayback; + friend class cDemux; private: /* video device */ int fd; @@ -182,6 +187,11 @@ class cVideo int Stop(bool blank = true); bool Pause(void); + /* get video system infos */ + int GetVideoSystem(void); + /* when system = -1 then use current video system */ + void GetVideoSystemFormatName(cs_vs_format_t* format, int system = -1); + /* set video_system */ int SetVideoSystem(int video_system, bool remember = true); int SetStreamType(VIDEO_FORMAT type); From 122d1789aca49aa0f6b4b085ed8cc260cc66439b Mon Sep 17 00:00:00 2001 From: max_10 Date: Sat, 7 Oct 2017 17:29:36 +0200 Subject: [PATCH 09/15] acinclude: remove unused boxtypes Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/b26e5ee5869d399776c69ecd97f4c6a865d835ba Author: max_10 Date: 2017-10-07 (Sat, 07 Oct 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- acinclude.m4 | 80 +++++++++------------------------------------------- 1 file changed, 14 insertions(+), 66 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 6931874..6f01800 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -108,25 +108,25 @@ if test "$TARGET" = "cdk"; then fi TUXBOX_APPS_DIRECTORY_ONE(configdir,CONFIGDIR,localstatedir,/var,/tuxbox/config, - [--with-configdir=PATH ],[where to find the config files]) + [--with-configdir=PATH ],[where to find the config files]) TUXBOX_APPS_DIRECTORY_ONE(datadir,DATADIR,datadir,/share,/tuxbox, - [--with-datadir=PATH ],[where to find data]) + [--with-datadir=PATH ],[where to find data]) TUXBOX_APPS_DIRECTORY_ONE(fontdir,FONTDIR,datadir,/share,/fonts, - [--with-fontdir=PATH ],[where to find the fonts]) + [--with-fontdir=PATH ],[where to find the fonts]) TUXBOX_APPS_DIRECTORY_ONE(gamesdir,GAMESDIR,localstatedir,/var,/tuxbox/games, - [--with-gamesdir=PATH ],[where games data is stored]) + [--with-gamesdir=PATH ],[where games data is stored]) TUXBOX_APPS_DIRECTORY_ONE(libdir,LIBDIR,libdir,/lib,/tuxbox, - [--with-libdir=PATH ],[where to find the internal libs]) + [--with-libdir=PATH ],[where to find the internal libs]) TUXBOX_APPS_DIRECTORY_ONE(plugindir,PLUGINDIR,libdir,/lib,/tuxbox/plugins, - [--with-plugindir=PATH ],[where to find the plugins]) + [--with-plugindir=PATH ],[where to find the plugins]) TUXBOX_APPS_DIRECTORY_ONE(themesdir,THEMESDIR,datadir,/share,/tuxbox/neutrino/themes, - [--with-themesdir=PATH ],[where to find the themes (don't change)]) + [--with-themesdir=PATH ],[where to find the themes (don't change)]) ]) dnl automake <= 1.6 needs this specifications @@ -273,9 +273,9 @@ _TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN) AC_DEFUN([TUXBOX_BOXTYPE],[ AC_ARG_WITH(boxtype, - [ --with-boxtype valid values: dbox2,tripledragon,dreambox,ipbox,coolstream,spark,azbox,generic,duckbox,spark7162], + [ --with-boxtype valid values: tripledragon,spark,azbox,generic,duckbox,spark7162], [case "${withval}" in - dbox2|dreambox|ipbox|tripledragon|coolstream|azbox|generic) + tripledragon|azbox|generic) BOXTYPE="$withval" ;; spark|spark7162) @@ -335,25 +335,10 @@ AC_ARG_WITH(boxtype, esac], [BOXTYPE="generic"]) AC_ARG_WITH(boxmodel, - [ --with-boxmodel valid for dreambox: dm500, dm500plus, dm600pvr, dm56x0, dm7000, dm7020, dm7025 - valid for ipbox: ip200, ip250, ip350, ip400 + [ --with-boxmodel valid for generic: raspi valid for duckbox: ufs910, ufs912, ufs913, ufs922, atevio7500, fortis_hdbox, octagon1008, hs7110, hs7810a, hs7119, hs7819, dp7000, cuberevo, cuberevo_mini, cuberevo_mini2, cuberevo_250hd, cuberevo_2000hd, cuberevo_3000hd, ipbox9900, ipbox99, ipbox55, arivalink200, tf7700, hl101 valid for spark: spark, spark7162], [case "${withval}" in - dm500|dm500plus|dm600pvr|dm56x0|dm7000|dm7020|dm7025) - if test "$BOXTYPE" = "dreambox"; then - BOXMODEL="$withval" - else - AC_MSG_ERROR([unknown model $withval for boxtype $BOXTYPE]) - fi - ;; - ip200|ip250|ip350|ip400) - if test "$BOXTYPE" = "ipbox"; then - BOXMODEL="$withval" - else - AC_MSG_ERROR([unknown model $withval for boxtype $BOXTYPE]) - fi - ;; ufs910|ufs912|ufs913|ufs922|atevio7500|fortis_hdbox|octagon1008|hs7110|hs7810a|hs7119|hs7819|dp7000|cuberevo|cuberevo_mini|cuberevo_mini2|cuberevo_250hd|cuberevo_2000hd|cuberevo_3000hd|ipbox9900|ipbox99|ipbox55|arivalink200|tf7700|hl101) if test "$BOXTYPE" = "duckbox"; then BOXMODEL="$withval" @@ -378,35 +363,17 @@ AC_ARG_WITH(boxmodel, *) AC_MSG_ERROR([unsupported value $withval for --with-boxmodel]) ;; - esac], - [if test "$BOXTYPE" = "dreambox" -o "$BOXTYPE" = "ipbox" && test -z "$BOXMODEL"; then - AC_MSG_ERROR([Dreambox/IPBox needs --with-boxmodel]) - fi]) + esac]) AC_SUBST(BOXTYPE) AC_SUBST(BOXMODEL) AM_CONDITIONAL(BOXTYPE_AZBOX, test "$BOXTYPE" = "azbox") -AM_CONDITIONAL(BOXTYPE_DBOX2, test "$BOXTYPE" = "dbox2") AM_CONDITIONAL(BOXTYPE_TRIPLE, test "$BOXTYPE" = "tripledragon") -AM_CONDITIONAL(BOXTYPE_DREAMBOX, test "$BOXTYPE" = "dreambox") -AM_CONDITIONAL(BOXTYPE_IPBOX, test "$BOXTYPE" = "ipbox") -AM_CONDITIONAL(BOXTYPE_COOL, test "$BOXTYPE" = "coolstream") AM_CONDITIONAL(BOXTYPE_SPARK, test "$BOXTYPE" = "spark") AM_CONDITIONAL(BOXTYPE_GENERIC, test "$BOXTYPE" = "generic") AM_CONDITIONAL(BOXTYPE_DUCKBOX, test "$BOXTYPE" = "duckbox") -AM_CONDITIONAL(BOXMODEL_DM500,test "$BOXMODEL" = "dm500") -AM_CONDITIONAL(BOXMODEL_DM500PLUS,test "$BOXMODEL" = "dm500plus") -AM_CONDITIONAL(BOXMODEL_DM600PVR,test "$BOXMODEL" = "dm600pvr") -AM_CONDITIONAL(BOXMODEL_DM56x0,test "$BOXMODEL" = "dm56x0") -AM_CONDITIONAL(BOXMODEL_DM7000,test "$BOXMODEL" = "dm7000" -o "$BOXMODEL" = "dm7020" -o "$BOXMODEL" = "dm7025") - -AM_CONDITIONAL(BOXMODEL_IP200,test "$BOXMODEL" = "ip200") -AM_CONDITIONAL(BOXMODEL_IP250,test "$BOXMODEL" = "ip250") -AM_CONDITIONAL(BOXMODEL_IP350,test "$BOXMODEL" = "ip350") -AM_CONDITIONAL(BOXMODEL_IP400,test "$BOXMODEL" = "ip400") - AM_CONDITIONAL(BOXMODEL_UFS910,test "$BOXMODEL" = "ufs910") AM_CONDITIONAL(BOXMODEL_UFS912,test "$BOXMODEL" = "ufs912") AM_CONDITIONAL(BOXMODEL_UFS913,test "$BOXMODEL" = "ufs913") @@ -421,7 +388,6 @@ AM_CONDITIONAL(BOXMODEL_HS7810A,test "$BOXMODEL" = "hs7810a") AM_CONDITIONAL(BOXMODEL_HS7119,test "$BOXMODEL" = "hs7119") AM_CONDITIONAL(BOXMODEL_HS7819,test "$BOXMODEL" = "hs7819") AM_CONDITIONAL(BOXMODEL_DP7000,test "$BOXMODEL" = "dp7000") - AM_CONDITIONAL(BOXMODEL_CUBEREVO,test "$BOXMODEL" = "cuberevo") AM_CONDITIONAL(BOXMODEL_CUBEREVO_MINI,test "$BOXMODEL" = "cuberevo_mini") AM_CONDITIONAL(BOXMODEL_CUBEREVO_MINI2,test "$BOXMODEL" = "cuberevo_mini2") @@ -437,18 +403,10 @@ AM_CONDITIONAL(BOXMODEL_HL101,test "$BOXMODEL" = "hl101") AM_CONDITIONAL(BOXMODEL_RASPI,test "$BOXMODEL" = "raspi") -if test "$BOXTYPE" = "dbox2"; then - AC_DEFINE(HAVE_DBOX_HARDWARE, 1, [building for a dbox2]) -elif test "$BOXTYPE" = "azbox"; then +if test "$BOXTYPE" = "azbox"; then AC_DEFINE(HAVE_AZBOX_HARDWARE, 1, [building for an azbox]) elif test "$BOXTYPE" = "tripledragon"; then AC_DEFINE(HAVE_TRIPLEDRAGON, 1, [building for a tripledragon]) -elif test "$BOXTYPE" = "dreambox"; then - AC_DEFINE(HAVE_DREAMBOX_HARDWARE, 1, [building for a dreambox]) -elif test "$BOXTYPE" = "ipbox"; then - AC_DEFINE(HAVE_IPBOX_HARDWARE, 1, [building for an ipbox]) -elif test "$BOXTYPE" = "coolstream"; then - AC_DEFINE(HAVE_COOL_HARDWARE, 1, [building for a coolstream]) elif test "$BOXTYPE" = "spark"; then AC_DEFINE(HAVE_SPARK_HARDWARE, 1, [building for a goldenmedia 990 or edision pingulux]) elif test "$BOXTYPE" = "generic"; then @@ -458,16 +416,8 @@ elif test "$BOXTYPE" = "duckbox"; then fi # TODO: do we need more defines? -if test "$BOXMODEL" = "dm500"; then - AC_DEFINE(BOXMODEL_DM500, 1, [dreambox 500]) -elif test "$BOXMODEL" = "ip200"; then - AC_DEFINE(BOXMODEL_IP200, 1, [ipbox 200]) -elif test "$BOXMODEL" = "ip250"; then - AC_DEFINE(BOXMODEL_IP250, 1, [ipbox 250]) -elif test "$BOXMODEL" = "ip350"; then - AC_DEFINE(BOXMODEL_IP350, 1, [ipbox 350]) -elif test "$BOXMODEL" = "ip400"; then - AC_DEFINE(BOXMODEL_IP400, 1, [ipbox 400]) +if test "$BOXMODEL" = "raspi"; then + AC_DEFINE(BOXMODEL_RASPI, 1, [Raspberry pi]) elif test "$BOXMODEL" = "ufs910"; then AC_DEFINE(BOXMODEL_UFS910, 1, [ufs910]) elif test "$BOXMODEL" = "ufs912"; then @@ -520,8 +470,6 @@ elif test "$BOXMODEL" = "tf7700"; then AC_DEFINE(BOXMODEL_TF7700, 1, [tf7700]) elif test "$BOXMODEL" = "hl101"; then AC_DEFINE(BOXMODEL_HL101, 1, [hl101]) -elif test "$BOXMODEL" = "raspi"; then - AC_DEFINE(BOXMODEL_RASPI, 1, [Raspberry pi]) fi ]) From 040dddce9292c70c8a799330d0f75cc51a0911cc Mon Sep 17 00:00:00 2001 From: max_10 Date: Sat, 7 Oct 2017 17:31:46 +0200 Subject: [PATCH 10/15] acinclude: remove unused TUXBOX_APPS_* stuff Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/70863f46d9ea6ab36b25c6324674fb863dde0c65 Author: max_10 Date: 2017-10-07 (Sat, 07 Oct 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- acinclude.m4 | 136 --------------------------------------------------- configure.ac | 5 +- 2 files changed, 3 insertions(+), 138 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 6f01800..18c0835 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -51,10 +51,6 @@ fi AC_CANONICAL_BUILD AC_CANONICAL_HOST -check_path () { - return $(perl -e "if(\"$1\"=~m#^/usr/(local/)?bin#){print \"0\"}else{print \"1\";}") -} - ]) dnl expand nested ${foo}/bar @@ -139,138 +135,6 @@ AC_SUBST(PLUGINDIR) AC_SUBST(THEMESDIR) dnl end workaround -AC_DEFUN([TUXBOX_APPS_ENDIAN],[ -AC_CHECK_HEADERS(endian.h) -AC_C_BIGENDIAN -]) - -AC_DEFUN([TUXBOX_APPS_DVB],[ -AC_ARG_WITH(dvbincludes, - [ --with-dvbincludes=PATH path for dvb includes [[NONE]]], - [DVBINCLUDES="$withval"],[DVBINCLUDES=""]) - -if test "$DVBINCLUDES"; then - CPPFLAGS="$CPPFLAGS -I$DVBINCLUDES" -fi - -if test -z "$DVB_API_VERSION"; then -AC_CHECK_HEADERS(linux/dvb/version.h,[ - AC_LANG_PREPROC_REQUIRE() - AC_REQUIRE([AC_PROG_EGREP]) - AC_LANG_CONFTEST([AC_LANG_SOURCE([[ -#include -version DVB_API_VERSION - ]])]) - DVB_API_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP "^version" | sed "s,version\ ,,"` - rm -f conftest* - - AC_MSG_NOTICE([found dvb version $DVB_API_VERSION]) -]) -fi - -if test "$DVB_API_VERSION"; then - AC_DEFINE(HAVE_DVB,1,[Define to 1 if you have the dvb includes]) - AC_DEFINE_UNQUOTED(HAVE_DVB_API_VERSION,$DVB_API_VERSION,[Define to the version of the dvb api]) -else - AC_MSG_ERROR([can't find dvb headers]) -fi -]) - -AC_DEFUN([_TUXBOX_APPS_LIB_CONFIG],[ -AC_PATH_PROG($1_CONFIG,$2,no) -if test "$$1_CONFIG" != "no"; then - if test "$TARGET" = "cdk" && check_path "$$1_CONFIG"; then - AC_MSG_$3([could not find a suitable version of $2]); - else - if test "$1" = "CURL"; then - $1_CFLAGS=$($$1_CONFIG --cflags) - $1_LIBS=$($$1_CONFIG --libs) - else - if test "$1" = "FREETYPE"; then - $1_CFLAGS=$($$1_CONFIG --cflags) - $1_LIBS=$($$1_CONFIG --libs) - else - $1_CFLAGS=$($$1_CONFIG --prefix=$targetprefix --cflags) - $1_LIBS=$($$1_CONFIG --prefix=$targetprefix --libs) - fi - fi - fi -fi - -AC_SUBST($1_CFLAGS) -AC_SUBST($1_LIBS) -]) - -AC_DEFUN([TUXBOX_APPS_LIB_CONFIG],[ -_TUXBOX_APPS_LIB_CONFIG($1,$2,ERROR) -if test "$$1_CONFIG" = "no"; then - AC_MSG_ERROR([could not find $2]); -fi -]) - -AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_CHECK],[ -_TUXBOX_APPS_LIB_CONFIG($1,$2,WARN) -]) - -AC_DEFUN([TUXBOX_APPS_PKGCONFIG],[ -m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test x"$PKG_CONFIG" = x"" ; then - AC_MSG_ERROR([could not find pkg-config]); -fi -]) - -AC_DEFUN([_TUXBOX_APPS_LIB_PKGCONFIG],[ -AC_REQUIRE([TUXBOX_APPS_PKGCONFIG]) -AC_MSG_CHECKING(for package $2) -if $PKG_CONFIG --exists "$2" ; then - AC_MSG_RESULT(yes) - $1_CFLAGS=$($PKG_CONFIG --cflags "$2") - $1_LIBS=$($PKG_CONFIG --libs "$2") - $1_EXISTS=yes -else - AC_MSG_RESULT(no) -fi - -AC_SUBST($1_CFLAGS) -AC_SUBST($1_LIBS) -]) - -AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG],[ -_TUXBOX_APPS_LIB_PKGCONFIG($1,$2) -if test x"$$1_EXISTS" != xyes; then - AC_MSG_ERROR([could not find package $2]); -fi -]) - -AC_DEFUN([TUXBOX_APPS_LIB_PKGCONFIG_CHECK],[ -_TUXBOX_APPS_LIB_PKGCONFIG($1,$2) -]) - -AC_DEFUN([_TUXBOX_APPS_LIB_SYMBOL],[ -AC_CHECK_LIB($2,$3,HAVE_$1="yes",HAVE_$1="no") -if test "$HAVE_$1" = "yes"; then - $1_LIBS=-l$2 -fi - -AC_SUBST($1_LIBS) -]) - -AC_DEFUN([TUXBOX_APPS_LIB_SYMBOL],[ -_TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,ERROR) -if test "$HAVE_$1" = "no"; then - AC_MSG_ERROR([could not find $2]); -fi -]) - -AC_DEFUN([TUXBOX_APPS_LIB_CONFIG_SYMBOL],[ -_TUXBOX_APPS_LIB_SYMBOL($1,$2,$3,WARN) -]) - AC_DEFUN([TUXBOX_BOXTYPE],[ AC_ARG_WITH(boxtype, [ --with-boxtype valid values: tripledragon,spark,azbox,generic,duckbox,spark7162], diff --git a/configure.ac b/configure.ac index 82df74a..e00d473 100644 --- a/configure.ac +++ b/configure.ac @@ -6,11 +6,11 @@ AC_GNU_SOURCE TUXBOX_APPS TUXBOX_APPS_DIRECTORY -TUXBOX_APPS_PKGCONFIG TUXBOX_BOXTYPE AC_PROG_CC AC_PROG_CXX +PKG_PROG_PKG_CONFIG ## both disabled => libtool still defaults to static ## at least the libtool I tested with ;-) ## --enable-shared => build only shared @@ -21,7 +21,7 @@ AC_SYS_LARGEFILE AC_PROG_LIBTOOL if test x"$BOXTYPE" = x"tripledragon"; then - TUXBOX_APPS_LIB_PKGCONFIG(DIRECTFB, directfb) + PKG_CHECK_MODULES([DIRECTFB], [directfb]) fi AC_ARG_ENABLE(gstreamer_01, @@ -55,6 +55,7 @@ if test x$BOXTYPE = xgeneric -a x$BOXMODEL != xraspi; then PKG_CHECK_MODULES([SWSCALE], [libswscale]) PKG_CHECK_MODULES([SWRESAMPLE], [libswresample]) fi + AC_OUTPUT([ Makefile common/Makefile From ea1186d7611e57b781939faa5517a9324f11893e Mon Sep 17 00:00:00 2001 From: max_10 Date: Sat, 7 Oct 2017 17:49:09 +0200 Subject: [PATCH 11/15] fix cherry-pick Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/394e72444d584d5e11410baed184147d63a6d932 Author: max_10 Date: 2017-10-07 (Sat, 07 Oct 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- include/video_hal.h | 222 -------------------------------------------- 1 file changed, 222 deletions(-) diff --git a/include/video_hal.h b/include/video_hal.h index 9a9ec8f..ec63331 100644 --- a/include/video_hal.h +++ b/include/video_hal.h @@ -1,4 +1,3 @@ -<<<<<<< HEAD #include #if HAVE_TRIPLEDRAGON #include "../libtriple/video_td.h" @@ -17,227 +16,6 @@ #else #error neither HAVE_TRIPLEDRAGON nor HAVE_SPARK_HARDWARE defined #endif -======= -/* - Copyright 2010-2013 Stefan Seyfried - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - - -#ifndef _VIDEO_LIB_H -#define _VIDEO_LIB_H - -#include -#include - -typedef struct cs_vs_format_t -{ - char format[16]; -} cs_vs_format_struct_t; - -typedef enum { - ANALOG_SD_RGB_CINCH = 0x00, - ANALOG_SD_YPRPB_CINCH, - ANALOG_HD_RGB_CINCH, - ANALOG_HD_YPRPB_CINCH, - ANALOG_SD_RGB_SCART = 0x10, - ANALOG_SD_YPRPB_SCART, - ANALOG_HD_RGB_SCART, - ANALOG_HD_YPRPB_SCART, - ANALOG_SCART_MASK = 0x10 -} analog_mode_t; - - -typedef enum { - VIDEO_FORMAT_MPEG2 = 0, - VIDEO_FORMAT_MPEG4, /* H264 */ - VIDEO_FORMAT_VC1, - VIDEO_FORMAT_JPEG, - VIDEO_FORMAT_GIF, - VIDEO_FORMAT_PNG, - VIDEO_FORMAT_DIVX,/* DIVX 3.11 */ - VIDEO_FORMAT_MPEG4PART2,/* MPEG4 SVH, MPEG4 SP, MPEG4 ASP, DIVX4,5,6 */ - VIDEO_FORMAT_REALVIDEO8, - VIDEO_FORMAT_REALVIDEO9, - VIDEO_FORMAT_ON2_VP6, - VIDEO_FORMAT_ON2_VP8, - VIDEO_FORMAT_SORENSON_SPARK, - VIDEO_FORMAT_H263, - VIDEO_FORMAT_H263_ENCODER, - VIDEO_FORMAT_H264_ENCODER, - VIDEO_FORMAT_MPEG4PART2_ENCODER, - VIDEO_FORMAT_AVS, - VIDEO_FORMAT_VIP656, - VIDEO_FORMAT_UNSUPPORTED -} VIDEO_FORMAT; - -typedef enum { - VIDEO_SD = 0, - VIDEO_HD, - VIDEO_120x60i, - VIDEO_320x240i, - VIDEO_1440x800i, - VIDEO_360x288i -} VIDEO_DEFINITION; - -typedef enum { - VIDEO_FRAME_RATE_23_976 = 0, - VIDEO_FRAME_RATE_24, - VIDEO_FRAME_RATE_25, - VIDEO_FRAME_RATE_29_97, - VIDEO_FRAME_RATE_30, - VIDEO_FRAME_RATE_50, - VIDEO_FRAME_RATE_59_94, - VIDEO_FRAME_RATE_60 -} VIDEO_FRAME_RATE; - -typedef enum { - DISPLAY_AR_1_1, - DISPLAY_AR_4_3, - DISPLAY_AR_14_9, - DISPLAY_AR_16_9, - DISPLAY_AR_20_9, - DISPLAY_AR_RAW, -} DISPLAY_AR; - -typedef enum { - DISPLAY_AR_MODE_PANSCAN = 0, - DISPLAY_AR_MODE_LETTERBOX, - DISPLAY_AR_MODE_NONE, - DISPLAY_AR_MODE_PANSCAN2 -} DISPLAY_AR_MODE; - -typedef enum { - VIDEO_DB_DR_NEITHER = 0, - VIDEO_DB_ON, - VIDEO_DB_DR_BOTH -} VIDEO_DB_DR; - -typedef enum { - VIDEO_PLAY_STILL = 0, - VIDEO_PLAY_CLIP, - VIDEO_PLAY_TRICK, - VIDEO_PLAY_MOTION, - VIDEO_PLAY_MOTION_NO_SYNC -} VIDEO_PLAY_MODE; - -typedef enum { - VIDEO_STD_NTSC, - VIDEO_STD_SECAM, - VIDEO_STD_PAL, - VIDEO_STD_480P, - VIDEO_STD_576P, - VIDEO_STD_720P60, - VIDEO_STD_1080I60, - VIDEO_STD_720P50, - VIDEO_STD_1080I50, - VIDEO_STD_1080P30, - VIDEO_STD_1080P24, - VIDEO_STD_1080P25, - VIDEO_STD_1080P50, - VIDEO_STD_1080P60, - VIDEO_STD_AUTO, - VIDEO_STD_MAX -} VIDEO_STD; - -/* not used, for dummy functions */ -typedef enum { - VIDEO_HDMI_CEC_MODE_OFF = 0, - VIDEO_HDMI_CEC_MODE_TUNER, - VIDEO_HDMI_CEC_MODE_RECORDER -} VIDEO_HDMI_CEC_MODE; - -typedef enum -{ - VIDEO_CONTROL_BRIGHTNESS = 0, - VIDEO_CONTROL_CONTRAST, - VIDEO_CONTROL_SATURATION, - VIDEO_CONTROL_HUE, - VIDEO_CONTROL_SHARPNESS, - VIDEO_CONTROL_MAX = VIDEO_CONTROL_SHARPNESS -} VIDEO_CONTROL; - -class cDemux; -class cPlayback; -class VDec; - -class cVideo -{ - friend class cPlayback; - friend class cDemux; - public: - /* constructor & destructor */ - cVideo(int mode, void *, void *, unsigned int unit = 0); - ~cVideo(void); - - void * GetTVEnc() { return NULL; }; - void * GetTVEncSD() { return NULL; }; - - /* aspect ratio */ - int getAspectRatio(void); - void getPictureInfo(int &width, int &height, int &rate); - int setAspectRatio(int aspect, int mode); - - /* cropping mode */ - int setCroppingMode(void); - - /* get play state */ - int getPlayState(void); - - /* blank on freeze */ - int getBlank(void); - int setBlank(int enable); - - /* change video play state. Parameters are all unused. */ - int Start(void *PcrChannel = NULL, unsigned short PcrPid = 0, unsigned short VideoPid = 0, void *x = NULL); - int Stop(bool blank = true); - bool Pause(void); - - /* get video system infos */ - int GetVideoSystem(void); - /* when system = -1 then use current video system */ - void GetVideoSystemFormatName(cs_vs_format_t* format, int system = -1); - - /* set video_system */ - int SetVideoSystem(int video_system, bool remember = true); - int SetStreamType(VIDEO_FORMAT type); - void SetSyncMode(AVSYNC_TYPE mode); - bool SetCECMode(VIDEO_HDMI_CEC_MODE) { return true; }; - void SetCECAutoView(bool) { return; }; - void SetCECAutoStandby(bool) { return; }; - void 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); - void SetControl(int, int) { return; }; - void setContrast(int val); - void SetVideoMode(analog_mode_t mode); - void SetDBDR(int) { return; }; - void SetAudioHandle(void *) { return; }; - 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); - bool GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false); - private: - VDec *vdec; - void *pdata; -}; ->>>>>>> 6e3b116... libspark: implement cVideo::GetVideoSystemFormatName() #if STB_HAL_VIDEO_HAS_GETSCREENIMAGE #define SCREENSHOT 1 From f3391008c32f322f7e5abf26fbe8630a4e786887 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Fri, 20 Feb 2015 09:30:19 +0100 Subject: [PATCH 12/15] spark: fix race condition in cDemux cDemux destructor was racing with Read() which did lead to all sorts of nasty crashes because after poll returned, the dmx object could be gone and its memory replaced with totally different things. Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/c8f8e457f6688358adc926ddce766b7fde2ef569 Author: Stefan Seyfried Date: 2015-02-20 (Fri, 20 Feb 2015) ------------------ This commit was generated by Migit --- libspark/dmx.cpp | 38 ++++++++++++++++++++++++++++++++++---- libspark/dmx_lib.h | 1 + 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/libspark/dmx.cpp b/libspark/dmx.cpp index d3ba4e7..6f8a969 100644 --- a/libspark/dmx.cpp +++ b/libspark/dmx.cpp @@ -66,11 +66,13 @@ #include #include #include +#include +#include #include "dmx_lib.h" #include "lt_debug.h" -/* Ugh... see comment in destructor for details... */ #include "video_lib.h" +/* needed for getSTC... */ extern cVideo *videoDecoder; #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) @@ -119,9 +121,11 @@ static const char *devname[NUM_DEMUXDEV] = { /* did we already DMX_SET_SOURCE on that demux device? */ static bool init[NUM_DEMUXDEV] = { false, false, false }; -/* uuuugly */ -static int dmx_tp_count = 0; -#define MAX_TS_COUNT 1 +typedef struct dmx_pdata { + int last_source; + OpenThreads::Mutex *mutex; +} dmx_pdata; +#define P ((dmx_pdata *)pdata) cDemux::cDemux(int n) { @@ -137,6 +141,11 @@ cDemux::cDemux(int n) last_measure = 0; last_data = 0; last_source = -1; + + pdata = (void *)calloc(1, sizeof(dmx_pdata)); + P->last_source = -1; + P->mutex = new OpenThreads::Mutex; + dmx_type = DMX_INVALID; } cDemux::~cDemux() @@ -155,6 +164,12 @@ cDemux::~cDemux() */ if (dmx_type == DMX_VIDEO_CHANNEL) videoDecoder = NULL; + /* wait until Read() has released the mutex */ + (*P->mutex).lock(); + (*P->mutex).unlock(); + free(P->mutex); + free(pdata); + pdata = NULL; } bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBufferSize) @@ -250,6 +265,7 @@ void cDemux::Close(void) bool cDemux::Start(bool) { + lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { lt_info("%s #%d: not open!\n", __FUNCTION__, num); @@ -261,6 +277,7 @@ bool cDemux::Start(bool) bool cDemux::Stop(void) { + lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { lt_info("%s #%d: not open!\n", __FUNCTION__, num); @@ -282,6 +299,8 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) lt_info("%s #%d: not open!\n", __func__, num); return -1; } + /* avoid race in destructor: ~cDemux needs to wait until Read() returns */ + OpenThreads::ScopedLock m_lock(*P->mutex); int rc; int to = timeout; struct pollfd ufds; @@ -299,6 +318,12 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) { retry: rc = ::poll(&ufds, 1, to); + if (ufds.fd != fd) + { + /* Close() will set fd to -1, this is normal. Everything else is not. */ + lt_info("%s:1 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); + return -1; + } if (!rc) { if (timeout == 0) /* we took the emergency exit */ @@ -336,6 +361,11 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) return 0; } } + if (ufds.fd != fd) /* does this ever happen? and if, is it harmful? */ + { /* read(-1,...) will just return EBADF anyway... */ + lt_info("%s:2 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); + return -1; + } rc = ::read(fd, buff, len); //fprintf(stderr, "fd %d ret: %d\n", fd, rc); diff --git a/libspark/dmx_lib.h b/libspark/dmx_lib.h index af87a02..056cb71 100644 --- a/libspark/dmx_lib.h +++ b/libspark/dmx_lib.h @@ -42,6 +42,7 @@ class cDemux struct dmx_pes_filter_params p_flt; int last_source; bool _open(void); + void *pdata; public: bool Open(DMX_CHANNEL_TYPE pes_type, void * unused = NULL, int bufsize = 0); From 476b0535b7728e954228db21ae06825d65f2d96f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 21 Feb 2015 22:14:47 +0100 Subject: [PATCH 13/15] spark: remove videodecoder hack from dmx destructor Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/72f78ba5b7f50ab8d16395fb8aac0e6a5c1774ec Author: Stefan Seyfried Date: 2015-02-21 (Sat, 21 Feb 2015) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libspark/dmx.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/libspark/dmx.cpp b/libspark/dmx.cpp index 6f8a969..caa4fc9 100644 --- a/libspark/dmx.cpp +++ b/libspark/dmx.cpp @@ -152,18 +152,6 @@ cDemux::~cDemux() { lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); Close(); - /* in zapit.cpp, videoDemux is deleted after videoDecoder - * in the video watchdog, we access videoDecoder - * the thread still runs after videoDecoder has been deleted - * => set videoDecoder to NULL here to make the check in the - * watchdog thread pick this up. - * This is ugly, but it saves me from changing neutrino - * - * if the delete order in neutrino will ever be changed, this - * will blow up badly :-( - */ - if (dmx_type == DMX_VIDEO_CHANNEL) - videoDecoder = NULL; /* wait until Read() has released the mutex */ (*P->mutex).lock(); (*P->mutex).unlock(); From 95fbea163841fab2630103d08fb0f430cdaac344 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 21 Feb 2015 22:25:29 +0100 Subject: [PATCH 14/15] spark: remove dead code from cDemux Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/ceeb9a4f0677a9e76fcd2511dd8785681b535d8b Author: Stefan Seyfried Date: 2015-02-21 (Sat, 21 Feb 2015) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libspark/dmx.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/libspark/dmx.cpp b/libspark/dmx.cpp index caa4fc9..ec81e9a 100644 --- a/libspark/dmx.cpp +++ b/libspark/dmx.cpp @@ -240,15 +240,6 @@ void cDemux::Close(void) fd = -1; if (measure) return; - if (dmx_type == DMX_TP_CHANNEL) - { - dmx_tp_count--; - if (dmx_tp_count < 0) - { - lt_info("%s dmx_tp_count < 0!!\n", __func__); - dmx_tp_count = 0; - } - } } bool cDemux::Start(bool) From 3c22c0436438e61b5e668eaae32a06b1771989d6 Mon Sep 17 00:00:00 2001 From: max_10 Date: Fri, 15 Sep 2017 13:19:21 +0200 Subject: [PATCH 15/15] add video_cs.h header to reduce number of #ifdefs needed Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/6f914f7a45183770ecdc7ffa1a5f5d3ab2e55a7a Author: max_10 Date: 2017-09-15 (Fri, 15 Sep 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- include/video_cs.h | 1 + 1 file changed, 1 insertion(+) create mode 100644 include/video_cs.h diff --git a/include/video_cs.h b/include/video_cs.h new file mode 100644 index 0000000..f1d48d4 --- /dev/null +++ b/include/video_cs.h @@ -0,0 +1 @@ +#include "video_hal.h"