mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
armbox: modification GetVideoSystem
This commit is contained in:
@@ -112,6 +112,29 @@ static const char *VMPEG_framerate[] = {
|
|||||||
"/proc/stb/vmpeg/1/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_MPEG2 0
|
||||||
#define VIDEO_STREAMTYPE_MPEG4_H264 1
|
#define VIDEO_STREAMTYPE_MPEG4_H264 1
|
||||||
@@ -291,72 +314,34 @@ int cVideo::setBlank(int)
|
|||||||
return Stop(1);
|
return Stop(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cVideo::GetVideoSystem()
|
int cVideo::GetVideoSystem(void)
|
||||||
{
|
{
|
||||||
lt_debug("%s\n", __func__);
|
|
||||||
char current[32];
|
char current[32];
|
||||||
static const char *modes[] = {
|
proc_get("/proc/stb/video/videomode", current, 32);
|
||||||
"pal", // VIDEO_STD_NTSC
|
for (int i = 0; vid_modes[i]; i++)
|
||||||
"pal", // VIDEO_STD_SECAM
|
{
|
||||||
"pal", // VIDEO_STD_PAL
|
if (strcmp(current, vid_modes[i]) == 0)
|
||||||
"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);
|
|
||||||
return i;
|
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)
|
int cVideo::SetVideoSystem(int video_system, bool remember)
|
||||||
{
|
{
|
||||||
lt_debug("%s(%d, %d)\n", __func__, video_system, remember);
|
lt_debug("%s(%d, %d)\n", __func__, video_system, remember);
|
||||||
char current[32];
|
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)
|
if (video_system > VIDEO_STD_MAX)
|
||||||
{
|
{
|
||||||
@@ -364,12 +349,12 @@ int cVideo::SetVideoSystem(int video_system, bool remember)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int ret = proc_get("/proc/stb/video/videomode", current, 32);
|
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);
|
lt_info("%s: video_system %d (%s) already set, skipping\n", __func__, video_system, current);
|
||||||
return 0;
|
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;
|
bool stopped = false;
|
||||||
if (playstate == VIDEO_PLAYING)
|
if (playstate == VIDEO_PLAYING)
|
||||||
{
|
{
|
||||||
@@ -377,7 +362,7 @@ int cVideo::SetVideoSystem(int video_system, bool remember)
|
|||||||
Stop();
|
Stop();
|
||||||
stopped = true;
|
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)
|
if (stopped)
|
||||||
Start();
|
Start();
|
||||||
|
|
||||||
|
@@ -5,6 +5,11 @@
|
|||||||
#include "../common/cs_types.h"
|
#include "../common/cs_types.h"
|
||||||
#include "dmx_lib.h"
|
#include "dmx_lib.h"
|
||||||
|
|
||||||
|
typedef struct cs_vs_format_t
|
||||||
|
{
|
||||||
|
char format[16];
|
||||||
|
} cs_vs_format_struct_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ANALOG_SD_RGB_CINCH = 0x00,
|
ANALOG_SD_RGB_CINCH = 0x00,
|
||||||
ANALOG_SD_YPRPB_CINCH,
|
ANALOG_SD_YPRPB_CINCH,
|
||||||
@@ -195,7 +200,9 @@ class cVideo
|
|||||||
bool Pause(void);
|
bool Pause(void);
|
||||||
|
|
||||||
/* get video system infos */
|
/* 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 */
|
/* set video_system */
|
||||||
int SetVideoSystem(int video_system, bool remember = true);
|
int SetVideoSystem(int video_system, bool remember = true);
|
||||||
|
Reference in New Issue
Block a user