annotate libmpcodecs/vf_dvbscale.c @ 36295:0bd0297b073a

Handle special argument -1 to switch_ratio as intended. Reset to the original aspect ratio that would have been used for the very first rescaling rather than to the display size ratio. This will now handle anamorphic videos correctly as well.
author ib
date Thu, 01 Aug 2013 21:18:14 +0000
parents a972c1a4a012
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30421
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
1 /*
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
2 * This file is part of MPlayer.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
3 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
5 * it under the terms of the GNU General Public License as published by
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
7 * (at your option) any later version.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
8 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
12 * GNU General Public License for more details.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
13 *
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
14 * You should have received a copy of the GNU General Public License along
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
17 */
bbb6ebec87a0 Add missing license headers to all files in the libmpcodecs directory.
diego
parents: 29263
diff changeset
18
6002
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
19 #include <stdio.h>
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
20 #include <stdlib.h>
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
21 #include <string.h>
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
22 #include <inttypes.h>
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
23
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 9593
diff changeset
24 #include "config.h"
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 9593
diff changeset
25 #include "mp_msg.h"
6002
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
26
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
27 #include "img_format.h"
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
28 #include "mp_image.h"
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
29 #include "vf.h"
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
30
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
31 struct vf_priv_s {
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
32 int aspect;
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
33 };
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
34
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
35 //===========================================================================//
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
36
30642
a972c1a4a012 cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents: 30638
diff changeset
37 static int config(struct vf_instance *vf,
6002
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
38 int width, int height, int d_width, int d_height,
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
39 unsigned int flags, unsigned int outfmt){
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
40
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
41 int scaled_y=vf->priv->aspect*d_height/d_width;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 25221
diff changeset
42
6002
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
43 d_width=width; // do X-scaling by hardware
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
44 d_height=scaled_y;
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
45
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
46 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
47 }
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
48
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30421
diff changeset
49 static int vf_open(vf_instance_t *vf, char *args){
6002
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
50 vf->config=config;
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
51 vf->default_caps=0;
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
52 vf->priv=malloc(sizeof(struct vf_priv_s));
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
53 vf->priv->aspect=768;
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
54 if(args) vf->priv->aspect=atoi(args);
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
55 return 1;
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
56 }
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
57
25221
00fff9a3b735 Make all vf_info_t structs const
reimar
parents: 17012
diff changeset
58 const vf_info_t vf_info_dvbscale = {
6002
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
59 "calc Y scaling for DVB card",
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
60 "dvbscale",
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
61 "A'rpi",
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
62 "",
30638
a7b908875c14 Rename open() vf initialization function to vf_open().
diego
parents: 30421
diff changeset
63 vf_open,
9593
e9a2af584986 Add the new -vf option wich is the same as vop in reverse order.
albeu
parents: 6002
diff changeset
64 NULL
6002
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
65 };
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
66
ba14193cc935 dvbscale - setup scaling for the DVB card
arpi
parents:
diff changeset
67 //===========================================================================//