Mercurial > mplayer.hg
annotate libvo/vo_jpeg.c @ 10576:e4cdc9ca94c5
Changed all printf into mp_msg
Removed extern int verbose
Removed some unneeded includes
Removed swscale, because this should be done by vf layer instead
Removed weird video_out_png definition
There is no more flip, zoom, or geometry support, so I removed those.
Slices, stride support for all supported CSP.
Replaced draw_frame with a stub.
Removed: do { ... } while (0)
Removed unused dstFourcc.
Added DR support
Removed USE_CONVERT2FB, since we have real DR now
Simplified some color depth checks
author | joey |
---|---|
date | Tue, 12 Aug 2003 06:57:19 +0000 |
parents | 98791b90215a |
children | db49cdedb88d |
rev | line source |
---|---|
5648 | 1 /* |
2 * vo_jpeg.c, JPEG Renderer for Mplayer | |
3 * | |
5649 | 4 * Copyright 2002 by Pontscho (pontscho@makacs.poliod.hu) |
9989
98791b90215a
Spring cleanup: supporting only RGB24 as input (native jpeg lib supports only that, maybe we could later add nativ YCbCr (YUV) support, but not swscale ones)
alex
parents:
9019
diff
changeset
|
5 * 25/04/2003: Spring cleanup -- alex |
5648 | 6 * |
7 */ | |
8 | |
9 #include <stdio.h> | |
10 #include <stdlib.h> | |
11 #include <string.h> | |
12 #include <errno.h> | |
13 | |
14 #include <jpeglib.h> | |
15 | |
16 #include "config.h" | |
17 #include "video_out.h" | |
18 #include "video_out_internal.h" | |
19 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7487
diff
changeset
|
20 static vo_info_t info= |
5648 | 21 { |
22 "JPEG file", | |
23 "jpeg", | |
24 "Zoltan Ponekker (pontscho@makacs.poliod.hu)", | |
25 "" | |
26 }; | |
27 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7487
diff
changeset
|
28 LIBVO_EXTERN (jpeg) |
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7487
diff
changeset
|
29 |
5648 | 30 static int image_width; |
31 static int image_height; | |
32 | |
33 int jpeg_baseline = 1; | |
34 int jpeg_progressive_mode = 0; | |
35 int jpeg_optimize = 100; | |
36 int jpeg_smooth = 0; | |
37 int jpeg_quality = 75; | |
5659 | 38 char * jpeg_outdir = "."; |
5648 | 39 |
40 static int framenum=0; | |
41 | |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
6751
diff
changeset
|
42 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) |
5648 | 43 { |
44 image_height=height; | |
45 image_width=width; | |
46 | |
47 return 0; | |
48 } | |
49 | |
50 static uint32_t jpeg_write( uint8_t * name,uint8_t * buffer ) | |
51 { | |
52 FILE * o; | |
53 struct jpeg_compress_struct cinfo; | |
54 struct jpeg_error_mgr jerr; | |
55 JSAMPROW row_pointer[1]; | |
56 int row_stride; | |
57 | |
58 if ( !buffer ) return 1; | |
59 if ( (o=fopen( name,"wb" )) == NULL ) return 1; | |
60 | |
61 cinfo.err=jpeg_std_error(&jerr); | |
62 jpeg_create_compress(&cinfo); | |
63 jpeg_stdio_dest( &cinfo,o ); | |
64 | |
65 cinfo.image_width=image_width; | |
66 cinfo.image_height=image_height; | |
9989
98791b90215a
Spring cleanup: supporting only RGB24 as input (native jpeg lib supports only that, maybe we could later add nativ YCbCr (YUV) support, but not swscale ones)
alex
parents:
9019
diff
changeset
|
67 cinfo.input_components=3; |
5648 | 68 cinfo.in_color_space=JCS_RGB; |
8267 | 69 |
70 jpeg_set_defaults( &cinfo ); | |
71 jpeg_set_quality( &cinfo,jpeg_quality,jpeg_baseline ); | |
5648 | 72 cinfo.optimize_coding=jpeg_optimize; |
73 cinfo.smoothing_factor=jpeg_smooth; | |
8267 | 74 |
5648 | 75 if ( jpeg_progressive_mode ) jpeg_simple_progression( &cinfo ); |
76 jpeg_start_compress( &cinfo,TRUE ); | |
77 | |
9989
98791b90215a
Spring cleanup: supporting only RGB24 as input (native jpeg lib supports only that, maybe we could later add nativ YCbCr (YUV) support, but not swscale ones)
alex
parents:
9019
diff
changeset
|
78 row_stride = image_width * 3; |
5648 | 79 while ( cinfo.next_scanline < cinfo.image_height ) |
80 { | |
81 row_pointer[0]=&buffer[ cinfo.next_scanline * row_stride ]; | |
82 (void)jpeg_write_scanlines( &cinfo,row_pointer,1 ); | |
83 } | |
84 | |
85 jpeg_finish_compress( &cinfo ); | |
86 fclose( o ); | |
87 jpeg_destroy_compress( &cinfo ); | |
88 | |
89 return 0; | |
90 } | |
91 | |
92 static uint32_t draw_frame(uint8_t * src[]) | |
93 { | |
94 char buf[256]; | |
6751 | 95 uint8_t *dst= src[0]; |
5648 | 96 |
97 snprintf (buf, 256, "%s/%08d.jpg", jpeg_outdir, ++framenum); | |
98 | |
9989
98791b90215a
Spring cleanup: supporting only RGB24 as input (native jpeg lib supports only that, maybe we could later add nativ YCbCr (YUV) support, but not swscale ones)
alex
parents:
9019
diff
changeset
|
99 return jpeg_write( buf,src[0] ); |
5648 | 100 } |
101 | |
102 static void draw_osd(void) | |
103 { | |
104 } | |
105 | |
106 static void flip_page (void) | |
107 { | |
108 } | |
109 | |
110 static uint32_t draw_slice( uint8_t *src[],int stride[],int w,int h,int x,int y ) | |
111 { | |
112 return 0; | |
113 } | |
114 | |
115 static uint32_t query_format(uint32_t format) | |
116 { | |
9989
98791b90215a
Spring cleanup: supporting only RGB24 as input (native jpeg lib supports only that, maybe we could later add nativ YCbCr (YUV) support, but not swscale ones)
alex
parents:
9019
diff
changeset
|
117 if (format == IMGFMT_RGB24) |
98791b90215a
Spring cleanup: supporting only RGB24 as input (native jpeg lib supports only that, maybe we could later add nativ YCbCr (YUV) support, but not swscale ones)
alex
parents:
9019
diff
changeset
|
118 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW; |
98791b90215a
Spring cleanup: supporting only RGB24 as input (native jpeg lib supports only that, maybe we could later add nativ YCbCr (YUV) support, but not swscale ones)
alex
parents:
9019
diff
changeset
|
119 |
98791b90215a
Spring cleanup: supporting only RGB24 as input (native jpeg lib supports only that, maybe we could later add nativ YCbCr (YUV) support, but not swscale ones)
alex
parents:
9019
diff
changeset
|
120 return 0; |
5648 | 121 } |
122 | |
123 static void uninit(void) | |
124 { | |
125 } | |
126 | |
127 static void check_events(void) | |
128 { | |
129 } | |
130 | |
131 static uint32_t preinit(const char *arg) | |
132 { | |
133 return 0; | |
134 } | |
135 | |
136 static uint32_t control(uint32_t request, void *data, ...) | |
137 { | |
138 switch (request) | |
139 { | |
140 case VOCTRL_QUERY_FORMAT: | |
141 return query_format(*((uint32_t*)data)); | |
142 } | |
143 return VO_NOTIMPL; | |
144 } |