annotate libvo/vo_png.c @ 27029:e8c49e69f46f

Add parentheses to expression to avoid the warning: libvo/x11_common.c: In function 'xss_suspend': libvo/x11_common.c:1618: warning: suggest parentheses around && within ||
author diego
date Sun, 15 Jun 2008 11:11:39 +0000
parents 0d255d03016f
children 9badbf52f33c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
1 /*
12857
db49cdedb88d embarassing typo
diego
parents: 8148
diff changeset
2 * vo_png.c, Portable Network Graphics Renderer for MPlayer
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
3 *
530
670d47b4ce10 changed copyroght message to correct stuff :)
atmosfear
parents: 527
diff changeset
4 * Copyright 2001 by Felix Buenemann <atmosfear@users.sourceforge.net>
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
5 *
530
670d47b4ce10 changed copyroght message to correct stuff :)
atmosfear
parents: 527
diff changeset
6 * Uses libpng (which uses zlib), so see according licenses.
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
7 *
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
8 */
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
9
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
10 #include <stdio.h>
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
11 #include <stdlib.h>
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
12 #include <string.h>
612
77e0094f0cce some warnings killed
szabii
parents: 530
diff changeset
13 #include <errno.h>
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
14
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
15 #include <png.h>
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
16
26203
0d255d03016f #include config.h before all other headers.
diego
parents: 25220
diff changeset
17 #include "config.h"
17932
3fe3b2b3a6ce Convert all if(verbose>X) to mp_msg_test calls.
diego
parents: 16171
diff changeset
18 #include "mp_msg.h"
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
19 #include "mp_msg.h"
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
20 #include "help_mp.h"
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
21 #include "video_out.h"
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
22 #include "video_out_internal.h"
14451
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
23 #include "subopt-helper.h"
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
24
25216
3aee342be929 Make vo info structs const
reimar
parents: 24671
diff changeset
25 static const vo_info_t info =
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
26 {
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
27 "PNG file",
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
28 "png",
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
29 "Felix Buenemann <atmosfear@users.sourceforge.net>",
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
30 ""
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
31 };
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
32
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
33 const LIBVO_EXTERN (png)
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7926
diff changeset
34
24669
ec55ecbbd702 Make a local-only variable static in vo_png
reimar
parents: 18950
diff changeset
35 static int z_compression = Z_NO_COMPRESSION;
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
36 static int framenum = 0;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
37
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
38 struct pngdata {
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
39 FILE * fp;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
40 png_structp png_ptr;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
41 png_infop info_ptr;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
42 enum {OK,ERROR} status;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
43 };
3950
e92653caf5d7 osd support, zlib range fix. by Kim Minh Kaplan <kmkaplan@selfoffice.com>
arpi
parents: 2732
diff changeset
44
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
45 static int
15212
05aa13cdf92f replace VO and VF numeric flags with #defined identifiers
henry
parents: 14451
diff changeset
46 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
47 {
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
48
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
49 if(z_compression == 0) {
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
50 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_PNG_Warning1);
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
51 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_PNG_Warning2);
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
52 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_PNG_Warning3);
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
53 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
54
24671
fbcd9dcb0daf Get rid of mp_msg_test in vo_png, only reason to use it is performance and
reimar
parents: 24670
diff changeset
55 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Compression level %i\n", z_compression);
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
56
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
57 return 0;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
58 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
59
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
60
18950
a943bc3f26c8 Make some functions static.
uau
parents: 18234
diff changeset
61 static struct pngdata create_png (char * fname, int image_width, int image_height, int swapped)
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
62 {
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
63 struct pngdata png;
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
64
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
65 /*png_structp png_ptr = png_create_write_struct
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
66 (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
67 user_error_fn, user_warning_fn);*/
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
68 //png_byte *row_pointers[image_height];
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
69 png.png_ptr = png_create_write_struct
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
70 (PNG_LIBPNG_VER_STRING, NULL,
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
71 NULL, NULL);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
72 png.info_ptr = png_create_info_struct(png.png_ptr);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
73
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
74 if (!png.png_ptr) {
24671
fbcd9dcb0daf Get rid of mp_msg_test in vo_png, only reason to use it is performance and
reimar
parents: 24670
diff changeset
75 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Failed to init png pointer\n");
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
76 png.status = ERROR;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
77 return png;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
78 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
79
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
80 if (!png.info_ptr) {
24671
fbcd9dcb0daf Get rid of mp_msg_test in vo_png, only reason to use it is performance and
reimar
parents: 24670
diff changeset
81 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Failed to init png infopointer\n");
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
82 png_destroy_write_struct(&png.png_ptr,
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
83 (png_infopp)NULL);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
84 png.status = ERROR;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
85 return png;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
86 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
87
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
88 if (setjmp(png.png_ptr->jmpbuf)) {
24671
fbcd9dcb0daf Get rid of mp_msg_test in vo_png, only reason to use it is performance and
reimar
parents: 24670
diff changeset
89 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Internal error!\n");
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
90 png_destroy_write_struct(&png.png_ptr, &png.info_ptr);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
91 fclose(png.fp);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
92 png.status = ERROR;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
93 return png;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
94 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
95
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
96 png.fp = fopen (fname, "wb");
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
97 if (png.fp == NULL) {
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
98 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_PNG_ErrorOpeningForWriting, strerror(errno));
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
99 png.status = ERROR;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
100 return png;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
101 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
102
24671
fbcd9dcb0daf Get rid of mp_msg_test in vo_png, only reason to use it is performance and
reimar
parents: 24670
diff changeset
103 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Init IO\n");
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
104 png_init_io(png.png_ptr, png.fp);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
105
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
106 /* set the zlib compression level */
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
107 png_set_compression_level(png.png_ptr, z_compression);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
108
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
109
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
110 /*png_set_IHDR(png_ptr, info_ptr, width, height,
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
111 bit_depth, color_type, interlace_type,
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
112 compression_type, filter_type)*/
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
113 png_set_IHDR(png.png_ptr, png.info_ptr, image_width, image_height,
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
114 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
115 PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
116
24671
fbcd9dcb0daf Get rid of mp_msg_test in vo_png, only reason to use it is performance and
reimar
parents: 24670
diff changeset
117 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Write Info\n");
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
118 png_write_info(png.png_ptr, png.info_ptr);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
119
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
120 if(swapped) {
24671
fbcd9dcb0daf Get rid of mp_msg_test in vo_png, only reason to use it is performance and
reimar
parents: 24670
diff changeset
121 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Set BGR Conversion\n");
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
122 png_set_bgr(png.png_ptr);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
123 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
124
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
125 png.status = OK;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
126 return png;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
127 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
128
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
129 static uint8_t destroy_png(struct pngdata png) {
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
130
24671
fbcd9dcb0daf Get rid of mp_msg_test in vo_png, only reason to use it is performance and
reimar
parents: 24670
diff changeset
131 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Write End\n");
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
132 png_write_end(png.png_ptr, png.info_ptr);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
133
24671
fbcd9dcb0daf Get rid of mp_msg_test in vo_png, only reason to use it is performance and
reimar
parents: 24670
diff changeset
134 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Destroy Write Struct\n");
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
135 png_destroy_write_struct(&png.png_ptr, &png.info_ptr);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
136
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
137 fclose (png.fp);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
138
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
139 return 0;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
140 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
141
7693
3f218f3172f3 draw_image()
arpi
parents: 7472
diff changeset
142 static uint32_t draw_image(mp_image_t* mpi){
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
143 char buf[100];
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
144 int k;
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
145 struct pngdata png;
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
146 png_byte *row_pointers[mpi->h];
7693
3f218f3172f3 draw_image()
arpi
parents: 7472
diff changeset
147
3f218f3172f3 draw_image()
arpi
parents: 7472
diff changeset
148 // if -dr or -slices then do nothing:
3f218f3172f3 draw_image()
arpi
parents: 7472
diff changeset
149 if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE;
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
150
1078
874ba7049c1a sprintf possible buffer overflow fixes
al3x
parents: 612
diff changeset
151 snprintf (buf, 100, "%08d.png", ++framenum);
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
152
24670
a2599160737c Use IMGFMT_IS_BGR instead of mpi->flags&MP_IMGFLAG_SWAPPED, this is easier
reimar
parents: 24669
diff changeset
153 png = create_png(buf, mpi->w, mpi->h, IMGFMT_IS_BGR(mpi->imgfmt));
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
154
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
155 if(png.status){
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
156 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_PNG_ErrorInCreatePng);
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
157 return 1;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
158 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
159
24671
fbcd9dcb0daf Get rid of mp_msg_test in vo_png, only reason to use it is performance and
reimar
parents: 24670
diff changeset
160 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Creating Row Pointers\n");
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
161 for ( k = 0; k < mpi->h; k++ )
7693
3f218f3172f3 draw_image()
arpi
parents: 7472
diff changeset
162 row_pointers[k] = mpi->planes[0]+mpi->stride[0]*k;
3f218f3172f3 draw_image()
arpi
parents: 7472
diff changeset
163
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
164 //png_write_flush(png.png_ptr);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
165 //png_set_flush(png.png_ptr, nrows);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
166
17932
3fe3b2b3a6ce Convert all if(verbose>X) to mp_msg_test calls.
diego
parents: 16171
diff changeset
167 if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17932
diff changeset
168 mp_msg(MSGT_VO,MSGL_DBG2, "PNG Writing Image Data\n"); }
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
169 png_write_image(png.png_ptr, row_pointers);
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
170
7693
3f218f3172f3 draw_image()
arpi
parents: 7472
diff changeset
171 destroy_png(png);
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
172
7693
3f218f3172f3 draw_image()
arpi
parents: 7472
diff changeset
173 return VO_TRUE;
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
174 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
175
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
176 static void draw_osd(void){}
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1078
diff changeset
177
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
178 static void flip_page (void){}
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
179
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
180 static int draw_frame(uint8_t * src[])
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
181 {
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
182 return -1;
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
183 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
184
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
185 static int draw_slice( uint8_t *src[],int stride[],int w,int h,int x,int y )
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
186 {
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
187 return -1;
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
188 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
189
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
190 static int
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
191 query_format(uint32_t format)
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
192 {
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
193 switch(format){
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
194 case IMGFMT_RGB|24:
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
195 case IMGFMT_BGR|24:
7694
b64f14fdadfb also set VFCAP_ACCEPT_STRIDE when draw_image() is implemented
arpi
parents: 7693
diff changeset
196 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_ACCEPT_STRIDE;
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
197 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
198 return 0;
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
199 }
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
200
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
201 static void uninit(void){}
527
a38decaa04ec png video out renderer initial release
atmosfear
parents:
diff changeset
202
7926
7d2542838d24 - removed YV12 support (builtin yv12->rgb conversion)
arpi
parents: 7694
diff changeset
203 static void check_events(void){}
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
204
14451
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
205 static int int_zero_to_nine(int *sh)
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
206 {
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
207 if ( (*sh < 0) || (*sh > 9) )
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
208 return 0;
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
209 return 1;
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
210 }
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
211
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
212 static opt_t subopts[] = {
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
213 {"z", OPT_ARG_INT, &z_compression, (opt_test_f)int_zero_to_nine},
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
214 {NULL}
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
215 };
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
216
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
217 static int preinit(const char *arg)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
218 {
14451
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
219 z_compression = 0;
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
220 if (subopt_parse(arg, subopts) != 0) {
4a6f25e88dbb Implementation of vo_png suboption parser with subopt-helper and removal
ivo
parents: 12857
diff changeset
221 return -1;
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
222 }
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
223 return 0;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
224 }
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
225
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 15212
diff changeset
226 static int control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
227 {
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
228 switch (request) {
7693
3f218f3172f3 draw_image()
arpi
parents: 7472
diff changeset
229 case VOCTRL_DRAW_IMAGE:
3f218f3172f3 draw_image()
arpi
parents: 7472
diff changeset
230 return draw_image(data);
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
231 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
232 return query_format(*((uint32_t*)data));
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
233 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
234 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4060
diff changeset
235 }