Mercurial > mplayer.hg
annotate libvo/vo_md5.c @ 12979:6f18105c058a
Better protection against double definition of MPEGLAYER3WAVEFORMAT
author | wight |
---|---|
date | Mon, 09 Aug 2004 15:53:10 +0000 |
parents | e5fa67e8907e |
children |
rev | line source |
---|---|
1 | 1 /* |
2 * video_out_pgm.c, pgm interface | |
3 * | |
4 * | |
5 * Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. | |
6 * | |
7 * Hacked into mpeg2dec by | |
8 * | |
9 * Aaron Holtzman <aholtzma@ess.engr.uvic.ca> | |
10 * | |
11 * 15 & 16 bpp support added by Franck Sicard <Franck.Sicard@solsoft.fr> | |
12 * | |
13 * Xv image suuport by Gerd Knorr <kraxel@goldbach.in-berlin.de> | |
14 */ | |
15 | |
16 #include <stdio.h> | |
17 #include <stdlib.h> | |
18 #include <string.h> | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4596
diff
changeset
|
19 #include <errno.h> |
1 | 20 |
21 #include "config.h" | |
22 #include "video_out.h" | |
23 #include "video_out_internal.h" | |
24 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7124
diff
changeset
|
25 static vo_info_t info = |
1 | 26 { |
27 "MD5 sum", | |
28 "md5", | |
29 "walken", | |
30 "" | |
31 }; | |
32 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7124
diff
changeset
|
33 LIBVO_EXTERN (md5) |
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7124
diff
changeset
|
34 |
1 | 35 extern vo_functions_t video_out_pgm; |
491 | 36 extern char vo_pgm_filename[24]; |
1 | 37 |
12840
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
38 static FILE * md5_file = NULL; |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
39 static char * md5_filename = NULL; |
1 | 40 |
41 static uint32_t | |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
4737
diff
changeset
|
42 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) |
1 | 43 { |
12840
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
44 md5_file = fopen (md5_filename?md5_filename:"md5", "w"); |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
45 if (!md5_file) |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
46 return -1; |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
4737
diff
changeset
|
47 return video_out_pgm.config (width, height, d_width,d_height,fullscreen, title, format); |
1 | 48 } |
49 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1095
diff
changeset
|
50 static void draw_osd(void) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1095
diff
changeset
|
51 { |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1095
diff
changeset
|
52 } |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1095
diff
changeset
|
53 |
1 | 54 static void flip_page (void) |
55 { | |
491 | 56 char buf2[100]; |
57 FILE * f; | |
58 int i; | |
59 | |
60 video_out_pgm.flip_page(); | |
61 | |
1095 | 62 snprintf (buf2, 100, "md5sum %s", vo_pgm_filename); |
491 | 63 f = popen (buf2, "r"); |
12840
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
64 if (!f) { |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
65 snprintf (buf2, 100, "md5 %s", vo_pgm_filename); |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
66 f = popen(buf2, "r"); |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
67 } |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
68 if (f) { |
491 | 69 i = fread (buf2, 1, sizeof(buf2), f); |
70 pclose (f); | |
71 fwrite (buf2, 1, i, md5_file); | |
12840
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
72 } |
491 | 73 remove (vo_pgm_filename); |
1 | 74 } |
75 | |
76 //static uint32_t draw_slice(uint8_t * src[], uint32_t slice_num) | |
77 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
78 { | |
491 | 79 return video_out_pgm.draw_slice(image,stride,w,h,x,y); |
1 | 80 } |
81 | |
491 | 82 //extern uint32_t output_pgm_frame (char * fname, uint8_t * src[]); |
1 | 83 |
84 static uint32_t draw_frame(uint8_t * src[]) | |
85 { | |
86 return 0; | |
87 } | |
88 | |
89 static uint32_t | |
90 query_format(uint32_t format) | |
91 { | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4448
diff
changeset
|
92 return video_out_pgm.control(VOCTRL_QUERY_FORMAT, &format); |
1 | 93 } |
94 | |
95 | |
96 static void | |
97 uninit(void) | |
98 { | |
491 | 99 video_out_pgm.uninit(); |
12840
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
100 if (md5_file) |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
101 { |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
102 fflush(md5_file); |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
103 fclose(md5_file); |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
104 md5_file = NULL; |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
105 } |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
106 if (md5_filename) |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
107 { |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
108 free(md5_filename); |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
109 md5_filename = NULL; |
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
110 } |
1 | 111 } |
112 | |
113 | |
31 | 114 static void check_events(void) |
115 { | |
116 } | |
117 | |
4352 | 118 static uint32_t preinit(const char *arg) |
119 { | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4596
diff
changeset
|
120 if(arg) |
12840
e5fa67e8907e
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
alex
parents:
8148
diff
changeset
|
121 md5_filename = strdup(arg); |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4596
diff
changeset
|
122 return 0; |
4352 | 123 } |
31 | 124 |
4596 | 125 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 126 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4448
diff
changeset
|
127 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4448
diff
changeset
|
128 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4448
diff
changeset
|
129 return query_format(*((uint32_t*)data)); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4448
diff
changeset
|
130 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4448
diff
changeset
|
131 return VO_NOTIMPL; |
4352 | 132 } |