annotate libvo/aspecttest.c @ 29516:87897065b7d7

Fix aspect_fit to work correctly when borders need to be added on top and bottom, previous code accidentally compared against screen dimensions, resulting in cropping instead of added borders.
author reimar
date Thu, 27 Aug 2009 12:38:22 +0000
parents 0f1b5b68af32
children faecce6b4b99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28446
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
1 /*
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
2 * test app for aspect.[ch] by Atmos
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
3 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
4 * This file is part of MPlayer.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
5 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
7 * it under the terms of the GNU General Public License as published by
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
9 * (at your option) any later version.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
10 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
14 * GNU General Public License for more details.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
15 *
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
16 * You should have received a copy of the GNU General Public License along
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
7681eab10aea Add standard license headers, unify header formatting.
diego
parents: 27506
diff changeset
19 */
6087
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
20
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
21 #include <stdio.h>
25516
dd86735178a6 Add missing #include, fixes the warning:
diego
parents: 6087
diff changeset
22 #include <stdlib.h>
6087
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
23
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
24 #include "aspect.h"
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
25
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
26 /* default zoom state 0 off, 1 on */
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
27 #define DEF_ZOOM 1
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
28
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
29 extern float monitor_aspect;
26583
6559b9364ca3 Add compilation rule for libvo/aspecttest and (hackishly) fix linking.
diego
parents: 25516
diff changeset
30 int vo_fs;
6559b9364ca3 Add compilation rule for libvo/aspecttest and (hackishly) fix linking.
diego
parents: 25516
diff changeset
31 float vo_panscan;
6087
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
32
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
33 int main(int argc, char *argv[]) {
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
34 int w,h,z=DEF_ZOOM;
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
35 //printf("argc: %d\n",argc);
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
36 switch(argc) {
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
37 case 10:
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
38 z = atoi(argv[9]);
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
39 case 9:
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
40 monitor_aspect = (float)atoi(argv[7])/(float)atoi(argv[8]);
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
41 case 7:
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
42 aspect_save_prescale(atoi(argv[5]),atoi(argv[6]));
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
43 printf("prescale size: %sx%s\n",argv[5],argv[6]);
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
44 case 5:
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
45 aspect_save_screenres(atoi(argv[1]),atoi(argv[2]));
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
46 printf("screenres: %sx%s\n",argv[1],argv[2]);
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
47 aspect_save_orig(atoi(argv[3]),atoi(argv[4]));
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
48 printf("original size: %sx%s\n",argv[3],argv[4]);
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
49 w=atoi(argv[3]); h=atoi(argv[4]);
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
50 break;
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
51 default:
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
52 printf("USAGE: %s <screenw> <screenh> <origw> <origh>\n[<prescalew> "
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
53 "<prescaleh>] [<screenaspectw> <screenaspecth>] [<zoom 0/1>]\n",
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
54 argv[0]);
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
55 return 1;
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
56 }
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
57 printf("monitor_aspect: %f\n",monitor_aspect);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28446
diff changeset
58 aspect(&w,&h,z);
6087
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
59 printf("new size: %dx%d\n",w,h);
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
60 return 0;
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
61 }
8be92a9b30a4 Fix a bug in the aspect coden (roudning at wrong point) and allow donwscaling in second pass.
atmos4
parents:
diff changeset
62