annotate libvo/vo_pgm.c @ 408:b61c5c4484f8

- applied overlay patch by Jens H
author atmosfear
date Sat, 14 Apr 2001 17:55:20 +0000
parents 1fc618eba830
children 2313c6ea006f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 #define DISP
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 * video_out_pgm.c, pgm interface
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * Hacked into mpeg2dec by
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 * Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * 15 & 16 bpp support added by Franck Sicard <Franck.Sicard@solsoft.fr>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 * Xv image suuport by Gerd Knorr <kraxel@goldbach.in-berlin.de>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 LIBVO_EXTERN (pgm)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 static vo_info_t vo_info =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 "PGM file",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 "pgm",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 "walken",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 static int image_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 static int image_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 static char header[1024];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 static int framenum = -2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 static uint32_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 image_height = height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 image_width = width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 sprintf (header, "P5\n\n%d %d\n255\n", width, height*3/2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 static const vo_info_t*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 get_info(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 return &vo_info;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 static void flip_page (void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 //static uint32_t draw_slice(uint8_t * src[], uint32_t slice_num)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 uint32_t output_pgm_frame (char * fname, uint8_t * src[])
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 FILE * f;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 f = fopen (fname, "wb");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 if (f == NULL) return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 fwrite (header, strlen (header), 1, f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 fwrite (src[0], image_width, image_height, f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 for (i = 0; i < image_height/2; i++) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 fwrite (src[1]+i*image_width/2, image_width/2, 1, f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 fwrite (src[2]+i*image_width/2, image_width/2, 1, f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 fclose (f);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 static uint32_t draw_frame(uint8_t * src[])
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 char buf[100];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 if (++framenum < 0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 sprintf (buf, "%d.pgm", framenum);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 return output_pgm_frame (buf, src);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 static uint32_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 query_format(uint32_t format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 {
15
2184c8945d42 query libvo for YV12 too
arpi_esp
parents: 1
diff changeset
100 // switch(format){
2184c8945d42 query libvo for YV12 too
arpi_esp
parents: 1
diff changeset
101 // case IMGFMT_YV12:
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 // case IMGFMT_RGB|24:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 // case IMGFMT_BGR|24:
15
2184c8945d42 query libvo for YV12 too
arpi_esp
parents: 1
diff changeset
104 // return 1;
2184c8945d42 query libvo for YV12 too
arpi_esp
parents: 1
diff changeset
105 // }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 uninit(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 15
diff changeset
115 static void check_events(void)
1fc618eba830 added check_events() interface
arpi_esp
parents: 15
diff changeset
116 {
1fc618eba830 added check_events() interface
arpi_esp
parents: 15
diff changeset
117 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 15
diff changeset
119
1fc618eba830 added check_events() interface
arpi_esp
parents: 15
diff changeset
120