From b0f09fd723a1d423546e3d5e68a095a2b390d6ae Mon Sep 17 00:00:00 2001 From: max_10 Date: Sun, 8 Oct 2017 01:08:53 +0200 Subject: [PATCH] armbox: modification GetVideoSystem --- libarmbox/video.cpp | 103 ++++++++++++++++++------------------------ libarmbox/video_lib.h | 9 +++- 2 files changed, 52 insertions(+), 60 deletions(-) diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index 74f07b0..a0412f1 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -112,6 +112,29 @@ 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 + "1080p50", // VIDEO_STD_1080P50 + "1080p60", // VIDEO_STD_1080P60 + "1080p2397", // VIDEO_STD_1080P2397 + "1080p2997", // VIDEO_STD_1080P2997 + "2160p24", // VIDEO_STD_2160P24 + "2160p25", // VIDEO_STD_2160P25 + "2160p30", // VIDEO_STD_2160P30 + "2160p50", // VIDEO_STD_2160P50 + "720p50" // VIDEO_STD_AUTO +}; #define VIDEO_STREAMTYPE_MPEG2 0 #define VIDEO_STREAMTYPE_MPEG4_H264 1 @@ -291,72 +314,34 @@ int cVideo::setBlank(int) return Stop(1); } -int cVideo::GetVideoSystem() +int cVideo::GetVideoSystem(void) { - 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 - "2160p24", //VIDEO_STD_2160P24 - "2160p25", // VIDEO_STD_2160P25 - "2160p30", // VIDEO_STD_2160P30 - "2160p50", // VIDEO_STD_2160P50 - "720p50" // VIDEO_STD_AUTO - }; - - int ret = proc_get("/proc/stb/video/videomode", current, 32); - for (int i=0; i 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::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 - "1080p50", // VIDEO_STD_1080P50 - "1080p60", // VIDEO_STD_1080P60 - "1080p2397", // VIDEO_STD_1080P2397 - "1080p2997", // VIDEO_STD_1080P2997 - "2160p24", //VIDEO_STD_2160P24 - "2160p25", // VIDEO_STD_2160P25 - "2160p30", // VIDEO_STD_2160P30 - "2160p50", // VIDEO_STD_2160P50 - "720p50" // VIDEO_STD_AUTO - }; if (video_system > VIDEO_STD_MAX) { @@ -364,12 +349,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) { @@ -377,7 +362,7 @@ int cVideo::SetVideoSystem(int video_system, bool remember) Stop(); stopped = true; } - 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])); if (stopped) Start(); diff --git a/libarmbox/video_lib.h b/libarmbox/video_lib.h index 3dae3eb..b2e579b 100644 --- a/libarmbox/video_lib.h +++ b/libarmbox/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, @@ -195,7 +200,9 @@ class cVideo bool Pause(void); /* get video system infos */ - int GetVideoSystem(); + int GetVideoSystem(void); + /* when system = -1 then use current video system */ + void GetVideoSystemFormatName(cs_vs_format_t* format, int system); /* set video_system */ int SetVideoSystem(int video_system, bool remember = true);