mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
armbox: modification GetVideoSystem
This commit is contained in:
@@ -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<sizeof(modes)/sizeof(*modes); i++) {
|
||||
if (strcmp(current, modes[i]) == 0)
|
||||
{
|
||||
lt_info("%s: video_system (%s) \n", __func__, current);
|
||||
proc_get("/proc/stb/video/videomode", current, 32);
|
||||
for (int i = 0; vid_modes[i]; i++)
|
||||
{
|
||||
if (strcmp(current, vid_modes[i]) == 0)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
lt_info("%s: could not find '%s' mode, returning VIDEO_STD_720P50\n", __func__, current);
|
||||
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::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();
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user