summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 03:00:14 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 03:00:14 +0200
commit240550bbb94653907faa6e0bb1c5ac3d279cc252 (patch)
tree1cd5346e52515dbeff187d040d79b92fae96caa9 /libvo
parent9895f2360fd5e8c48f21117d6934254317891cde (diff)
parentfbb74e16a38d6a5af31a7fb369195988f7414766 (diff)
downloadmpv-240550bbb94653907faa6e0bb1c5ac3d279cc252.tar.bz2
mpv-240550bbb94653907faa6e0bb1c5ac3d279cc252.tar.xz
Merge svn changes up to r30848
Diffstat (limited to 'libvo')
-rw-r--r--libvo/geometry.c93
-rw-r--r--libvo/vo_fbdev.c16
-rw-r--r--libvo/vo_mpegpes.c21
3 files changed, 52 insertions, 78 deletions
diff --git a/libvo/geometry.c b/libvo/geometry.c
index 056a05facb..39ff209b7b 100644
--- a/libvo/geometry.c
+++ b/libvo/geometry.c
@@ -30,76 +30,77 @@ char *vo_geometry;
int geometry_wh_changed;
int geometry_xy_changed;
-#define RESET_GEOMETRY width = height = xoff = yoff = xper = yper = INT_MIN;
-
// xpos,ypos: position of the left upper corner
// widw,widh: width and height of the window
// scrw,scrh: width and height of the current screen
int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh)
{
- int width, height, xoff, yoff, xper, yper;
-
- RESET_GEOMETRY
-
if(vo_geometry != NULL) {
- if(sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) != 4 )
- {
- RESET_GEOMETRY
- if(sscanf(vo_geometry, "%ix%i", &width, &height) != 2)
- {
- RESET_GEOMETRY
- if(sscanf(vo_geometry, "+%i+%i", &xoff, &yoff) != 2)
- {
- char percent[2];
- RESET_GEOMETRY
- if(sscanf(vo_geometry, "%i%%:%i%1[%]", &xper, &yper, percent) != 3)
- {
- RESET_GEOMETRY
- if(sscanf(vo_geometry, "%i:%i%1[%]", &xoff, &yper, percent) != 3)
- {
- RESET_GEOMETRY
- if(sscanf(vo_geometry, "%i%%:%i", &xper, &yoff) != 2)
- {
- RESET_GEOMETRY
- if(sscanf(vo_geometry, "%i:%i", &xoff, &yoff) != 2)
- {
- RESET_GEOMETRY
- if(sscanf(vo_geometry, "%i%1[%]", &xper, percent) != 2)
- {
+ char xsign[2], ysign[2];
+ int width, height, xoff, yoff, xper, yper;
+ int i;
+ int ok = 0;
+ for (i = 0; !ok && i < 8; i++) {
+ width = height = xoff = yoff = xper = yper = INT_MIN;
+ strcpy(xsign, "+");
+ strcpy(ysign, "+");
+ switch (i) {
+ case 0:
+ ok = sscanf(vo_geometry, "%ix%i%1[+-]%i%1[+-]%i", &width, &height, xsign, &xoff, ysign, &yoff) == 6;
+ break;
+ case 1:
+ ok = sscanf(vo_geometry, "%ix%i", &width, &height) == 2;
+ break;
+ case 2:
+ ok = sscanf(vo_geometry, "%1[+-]%i%1[+-]%i", xsign, &xoff, ysign, &yoff) == 4;
+ break;
+ case 3:
+ ok = sscanf(vo_geometry, "%i%%:%i%%", &xper, &yper) == 2;
+ break;
+ case 4:
+ ok = sscanf(vo_geometry, "%i:%i%%", &xoff, &yper) == 2;
+ break;
+ case 5:
+ ok = sscanf(vo_geometry, "%i%%:%i", &xper, &yoff) == 2;
+ break;
+ case 6:
+ ok = sscanf(vo_geometry, "%i:%i", &xoff, &yoff) == 2;
+ break;
+ case 7:
+ ok = sscanf(vo_geometry, "%i%%", &xper) == 1;
+ break;
+ }
+ }
+ if (!ok) {
mp_msg(MSGT_VO, MSGL_ERR,
- "-geometry must be in [WxH][+X+Y] | [X[%%]:[Y[%%]]] format, incorrect (%s)\n", vo_geometry);
+ "-geometry must be in [WxH][[+-]X[+-]Y] | [X[%%]:[Y[%%]]] format, incorrect (%s)\n", vo_geometry);
return 0;
}
- }
- }
- }
- }
- }
- }
- }
+
+ mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i,"
+ " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh);
mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i,"
- "height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n",
- width, height, xoff, yoff, xper, yper);
+ "height: %i, xoff: %s%i, yoff: %s%i, xper: %i, yper: %i\n",
+ width, height, xsign, xoff, ysign, yoff, xper, yper);
+ if (width > 0 && widw) *widw = width;
+ if (height > 0 && widh) *widh = height;
+
+ if(xoff != INT_MIN && xsign[0] == '-') xoff = scrw - *widw - xoff;
+ if(yoff != INT_MIN && ysign[0] == '-') yoff = scrh - *widh - yoff;
if(xper >= 0 && xper <= 100) xoff = (scrw - *widw) * ((float)xper / 100.0);
if(yper >= 0 && yper <= 100) yoff = (scrh - *widh) * ((float)yper / 100.0);
mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i,"
"height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n",
width, height, xoff, yoff, xper, yper);
- mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i,"
- " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh);
if (xoff != INT_MIN && xpos) *xpos = xoff;
if (yoff != INT_MIN && ypos) *ypos = yoff;
- if (width > 0 && widw) *widw = width;
- if (height > 0 && widh) *widh = height;
geometry_wh_changed = width > 0 || height > 0;
geometry_xy_changed = xoff != INT_MIN || yoff != INT_MIN;
}
return 1;
}
-
-#undef RESET_GEOMETRY
diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c
index 96a173938c..df3f21299c 100644
--- a/libvo/vo_fbdev.c
+++ b/libvo/vo_fbdev.c
@@ -554,9 +554,6 @@ char *fb_mode_name = NULL;
static fb_mode_t *fb_mode = NULL;
-/* vt related variables */
-static FILE *vt_fp = NULL;
-
/* vo_fbdev related variables */
static int fb_dev_fd;
static int fb_tty_fd = -1;
@@ -736,9 +733,11 @@ static void vt_set_textarea(int u, int l)
int lrow = l / 16;
mp_msg(MSGT_VO, MSGL_DBG2, "vt_set_textarea(%d,%d): %d,%d\n", u, l, urow, lrow);
- if (vt_fp) {
- fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0);
- fflush(vt_fp);
+ if (fb_tty_fd >= 0) {
+ char modestring[100];
+ snprintf(modestring, sizeof(modestring), "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0);
+ write(fb_tty_fd, modestring, strlen(modestring));
+ fsync(fb_tty_fd);
}
}
@@ -973,9 +972,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
if (fs || vm)
memset(frame_buffer, '\0', fb_line_len * fb_yres);
}
- if (!(vt_fp = fopen("/dev/tty", "w"))) {
- mp_msg(MSGT_VO, MSGL_ERR, "can't fopen /dev/tty: %s\n", strerror(errno));
- }
vt_set_textarea(last_row, fb_yres);
@@ -1056,8 +1052,6 @@ static void uninit(void)
mp_msg(MSGT_VO, MSGL_WARN, "Can't restore text mode: %s\n", strerror(errno));
}
vt_set_textarea(0, fb_orig_vinfo.yres);
- if (vt_fp)
- fclose(vt_fp);
close(fb_tty_fd);
close(fb_dev_fd);
if (frame_buffer)
diff --git a/libvo/vo_mpegpes.c b/libvo/vo_mpegpes.c
index b96b0af639..f7b2a5b0b7 100644
--- a/libvo/vo_mpegpes.c
+++ b/libvo/vo_mpegpes.c
@@ -38,20 +38,6 @@
#include "mp_msg.h"
#ifdef CONFIG_DVB
-#ifndef CONFIG_DVB_HEAD
-#include <poll.h>
-
-#include <sys/ioctl.h>
-#include <stdio.h>
-#include <time.h>
-
-#include <ost/dmx.h>
-#include <ost/frontend.h>
-#include <ost/sec.h>
-#include <ost/video.h>
-#include <ost/audio.h>
-
-#else
#define true 1
#define false 0
#include <poll.h>
@@ -65,7 +51,6 @@
#include <linux/dvb/video.h>
#include <linux/dvb/audio.h>
#endif
-#endif
#include "config.h"
#include "video_out.h"
@@ -141,15 +126,9 @@ static int preinit(const char *arg){
mp_msg(MSGT_VO,MSGL_INFO, "Couldn't find a usable dvb video device, exiting\n");
return -1;
}
-#ifndef CONFIG_DVB_HEAD
- mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/ost/video+audio\n");
- sprintf(vo_file, "/dev/ost/video");
- sprintf(ao_file, "/dev/ost/audio");
-#else
mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/dvb/adapter%d/video0+audio0\n", card);
sprintf(vo_file, "/dev/dvb/adapter%d/video0", card);
sprintf(ao_file, "/dev/dvb/adapter%d/audio0", card);
-#endif
if((vo_mpegpes_fd = open(vo_file,O_RDWR)) < 0){
perror("DVB VIDEO DEVICE: ");
return -1;