mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-27 07:22:44 +02:00
spark: cVideo::getPictureInfo/getAspectRatio
simplify both function by using proc_{get,put}
Origin commit data
------------------
Branch: master
Commit: 994a0f52bf
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-02-12 (Sun, 12 Feb 2012)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -277,28 +277,11 @@ int cVideo::setAspectRatio(int aspect, int mode)
|
|||||||
|
|
||||||
int cVideo::getAspectRatio(void)
|
int cVideo::getAspectRatio(void)
|
||||||
{
|
{
|
||||||
unsigned char buffer[2];
|
int ratio = 0; /* proc: 0 = 4:3, 1 = 16:9 */
|
||||||
int n, f;
|
ratio = proc_get_hex("/proc/stb/vmpeg/0/aspect");
|
||||||
int ratio = 0; // 0 = 4:3, 1 = 16:9
|
if (ratio >= 0)
|
||||||
f = open("/proc/stb/vmpeg/0/aspect", O_RDONLY);
|
return ratio * 2 + 1; /* return: 1 = 4:3, 3 = 16:9 */
|
||||||
n = read(f, buffer, 2);
|
|
||||||
close(f);
|
|
||||||
if (n > 0)
|
|
||||||
ratio = atoi((const char*) buffer);
|
|
||||||
return ratio;
|
return ratio;
|
||||||
#if 0
|
|
||||||
switch (v.pel_aspect_ratio)
|
|
||||||
{
|
|
||||||
case VID_DISPSIZE_4x3:
|
|
||||||
return 1;
|
|
||||||
case VID_DISPSIZE_16x9:
|
|
||||||
return 3;
|
|
||||||
case VID_DISPSIZE_221x100:
|
|
||||||
return 4;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int cVideo::setCroppingMode(int /*vidDispMode_t format*/)
|
int cVideo::setCroppingMode(int /*vidDispMode_t format*/)
|
||||||
@@ -682,35 +665,10 @@ void cVideo::Pig(int x, int y, int w, int h, int /*osd_w*/, int /*osd_h*/)
|
|||||||
|
|
||||||
void cVideo::getPictureInfo(int &width, int &height, int &rate)
|
void cVideo::getPictureInfo(int &width, int &height, int &rate)
|
||||||
{
|
{
|
||||||
char buffer[10];
|
rate = proc_get_hex("/proc/stb/vmpeg/0/framerate");
|
||||||
int n, f;
|
rate /= 1000;
|
||||||
|
width = proc_get_hex("/proc/stb/vmpeg/0/xres");
|
||||||
rate = 0;
|
height = proc_get_hex("/proc/stb/vmpeg/0/yres");
|
||||||
width = 0;
|
|
||||||
height = 0;
|
|
||||||
|
|
||||||
f = open("/proc/stb/vmpeg/0/framerate", O_RDONLY);
|
|
||||||
n = read(f, buffer, 10);
|
|
||||||
close(f);
|
|
||||||
|
|
||||||
if (n > 0) {
|
|
||||||
sscanf(buffer, "%X", &rate);
|
|
||||||
rate = rate/1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
f = open("/proc/stb/vmpeg/0/xres", O_RDONLY);
|
|
||||||
n = read(f, buffer, 10);
|
|
||||||
close(f);
|
|
||||||
|
|
||||||
if (n > 0)
|
|
||||||
sscanf(buffer, "%X", &width);
|
|
||||||
|
|
||||||
f = open("/proc/stb/vmpeg/0/yres", O_RDONLY);
|
|
||||||
n = read(f, buffer, 10);
|
|
||||||
close(f);
|
|
||||||
|
|
||||||
if (n > 0)
|
|
||||||
sscanf(buffer, "%X", &height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cVideo::SetSyncMode(AVSYNC_TYPE Mode)
|
void cVideo::SetSyncMode(AVSYNC_TYPE Mode)
|
||||||
|
Reference in New Issue
Block a user