annotate libvo/vo_md5.c @ 13073:d2eb0ab395bc

ffsonic
author alex
date Sat, 21 Aug 2004 19:22:11 +0000
parents e5fa67e8907e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 * video_out_pgm.c, pgm interface
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 * Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * Hacked into mpeg2dec by
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 * 15 & 16 bpp support added by Franck Sicard <Franck.Sicard@solsoft.fr>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * Xv image suuport by Gerd Knorr <kraxel@goldbach.in-berlin.de>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 "MD5 sum",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 "md5",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 "walken",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 extern vo_functions_t video_out_pgm;
491
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
36 extern char vo_pgm_filename[24];
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 static void flip_page (void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 {
491
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
56 char buf2[100];
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
57 FILE * f;
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
58 int i;
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
59
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
60 video_out_pgm.flip_page();
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
61
1095
c1daff266657 possible buffer overflow place fixed
al3x
parents: 491
diff changeset
62 snprintf (buf2, 100, "md5sum %s", vo_pgm_filename);
491
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
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
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
69 i = fread (buf2, 1, sizeof(buf2), f);
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
70 pclose (f);
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
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
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
73 remove (vo_pgm_filename);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 //static uint32_t draw_slice(uint8_t * src[], uint32_t slice_num)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 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
78 {
491
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
79 return video_out_pgm.draw_slice(image,stride,w,h,x,y);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81
491
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
82 //extern uint32_t output_pgm_frame (char * fname, uint8_t * src[]);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 static uint32_t draw_frame(uint8_t * src[])
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 static uint32_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 query_format(uint32_t format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
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
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 uninit(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 {
491
2313c6ea006f YV12 is working again
arpi_esp
parents: 31
diff changeset
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
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
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 15
diff changeset
114 static void check_events(void)
1fc618eba830 added check_events() interface
arpi_esp
parents: 15
diff changeset
115 {
1fc618eba830 added check_events() interface
arpi_esp
parents: 15
diff changeset
116 }
1fc618eba830 added check_events() interface
arpi_esp
parents: 15
diff changeset
117
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1501
diff changeset
118 static uint32_t preinit(const char *arg)
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1501
diff changeset
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
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1501
diff changeset
123 }
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 15
diff changeset
124
4596
c35d7ce151b3 10000hl to Holm... control MUST BE static...
arpi
parents: 4592
diff changeset
125 static uint32_t control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1501
diff changeset
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
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1501
diff changeset
132 }