Mercurial > mplayer.hg
annotate libvo/vo_md5sum.c @ 37087:e476a46c6a2b
Remove two duplicated named asm constraints.
This fixes compilation of libmpcodecs/vf_fspp.c with gcc and
INLINE_ASM_DIRECT_SYMBOL_REFS disabled.
author | cehoyos |
---|---|
date | Sat, 03 May 2014 06:25:05 +0000 |
parents | 8bbed8b34783 |
children |
rev | line source |
---|---|
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
1 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
2 |
26739
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
3 /* |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
4 * md5sum video output driver |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
5 * |
28307
2391228b7ff0
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
26739
diff
changeset
|
6 * Copyright (C) 2004, 2005, 2006 Ivo van Poorten |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
7 * |
26739
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
8 * This file is part of MPlayer. |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
9 * |
26739
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
10 * MPlayer is free software; you can redistribute it and/or modify |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
13 * (at your option) any later version. |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
14 * |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
15 * MPlayer is distributed in the hope that it will be useful, |
25175 | 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
26739
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
20 * You should have received a copy of the GNU General Public License along |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
21 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
2a34d9fa52ab
Use standard license headers with standard formatting.
diego
parents:
26069
diff
changeset
|
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
23 */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
24 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
25 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
26 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
27 /* Global Includes */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
28 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
29 #include <stdio.h> |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
30 #include <stdlib.h> |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
31 #include <string.h> |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
32 #include <errno.h> |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
33 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
34 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
35 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
36 /* Local Includes */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
37 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
38 #include "config.h" |
14508
3673ad04ebfb
Replaced suboption parser by call to suboption helper.
ivo
parents:
13395
diff
changeset
|
39 #include "subopt-helper.h" |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
40 #include "mp_msg.h" |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
41 #include "video_out.h" |
36517 | 42 #define NO_DRAW_FRAME |
43 #define NO_DRAW_SLICE | |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
44 #include "video_out_internal.h" |
30516 | 45 #include "mp_core.h" /* for exit_player() */ |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
46 #include "help_mp.h" |
18882
21f45afa0f87
use libavutil's md5 implementation instead of local imported copy
ivo
parents:
16171
diff
changeset
|
47 #include "libavutil/md5.h" |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
48 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
49 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
50 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
51 /* Info */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
52 |
25216 | 53 static const vo_info_t info= |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
54 { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
55 "md5sum of each frame", |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
56 "md5sum", |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
57 "Ivo van Poorten (ivop@euronet.nl)", |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
58 "" |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
59 }; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
60 |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
61 const LIBVO_EXTERN (md5sum) |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
62 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
63 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
64 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
65 /* Global Variables */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
66 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
67 char *md5sum_outfile = NULL; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
68 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
69 FILE *md5sum_fd; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
70 int framenum = 0; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
71 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
72 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
73 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
74 /** \brief An error occured while writing to a file. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
75 * |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
76 * The program failed to write data to a file. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
77 * It displays a message and exits the player. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
78 * |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
79 * \return nothing It does not return. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
80 */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
81 |
18950 | 82 static void md5sum_write_error(void) { |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
83 mp_msg(MSGT_VO, MSGL_ERR, MSGTR_ErrorWritingFile, info.short_name); |
30516 | 84 exit_player(EXIT_ERROR); |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
85 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
86 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
87 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
88 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
89 /** \brief Pre-initialisation. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
90 * |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
91 * This function is called before initialising the video output driver. It |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
92 * parses all suboptions and sets variables accordingly. If an error occurs |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
93 * (like an option being out of range, not having any value or an unknown |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
94 * option is stumbled upon) the player will exit. It also sets default |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
95 * values if necessary. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
96 * |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
97 * \param arg A string containing all the suboptions passed to the video |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
98 * output driver. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
99 * |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
100 * \return 0 All went well. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
101 */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
102 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
103 static int preinit(const char *arg) |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
104 { |
28828
56eee6ffba9b
Make data related to suboption parsing const in libvo
reimar
parents:
28307
diff
changeset
|
105 const opt_t subopts[] = { |
28922
9dd905e52639
Remove obsolete extra elements from opt_t struct initialization.
diego
parents:
28828
diff
changeset
|
106 {"outfile", OPT_ARG_MSTRZ, &md5sum_outfile, NULL}, |
9dd905e52639
Remove obsolete extra elements from opt_t struct initialization.
diego
parents:
28828
diff
changeset
|
107 {NULL, 0, NULL, NULL} |
14508
3673ad04ebfb
Replaced suboption parser by call to suboption helper.
ivo
parents:
13395
diff
changeset
|
108 }; |
3673ad04ebfb
Replaced suboption parser by call to suboption helper.
ivo
parents:
13395
diff
changeset
|
109 |
31287
168e89b341b1
Reduce verbosity about suboption parsing in vo drivers.
diego
parents:
31151
diff
changeset
|
110 mp_msg(MSGT_VO, MSGL_V, "%s: %s\n", info.short_name, |
168e89b341b1
Reduce verbosity about suboption parsing in vo drivers.
diego
parents:
31151
diff
changeset
|
111 "Parsing suboptions."); |
14508
3673ad04ebfb
Replaced suboption parser by call to suboption helper.
ivo
parents:
13395
diff
changeset
|
112 |
14538
00c3c4111017
New suboption type: malloc'ed, zero terminated string
reimar
parents:
14508
diff
changeset
|
113 md5sum_outfile = strdup("md5sums"); |
14508
3673ad04ebfb
Replaced suboption parser by call to suboption helper.
ivo
parents:
13395
diff
changeset
|
114 if (subopt_parse(arg, subopts) != 0) { |
3673ad04ebfb
Replaced suboption parser by call to suboption helper.
ivo
parents:
13395
diff
changeset
|
115 return -1; |
3673ad04ebfb
Replaced suboption parser by call to suboption helper.
ivo
parents:
13395
diff
changeset
|
116 } |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
117 |
14508
3673ad04ebfb
Replaced suboption parser by call to suboption helper.
ivo
parents:
13395
diff
changeset
|
118 mp_msg(MSGT_VO, MSGL_V, "%s: outfile --> %s\n", info.short_name, |
3673ad04ebfb
Replaced suboption parser by call to suboption helper.
ivo
parents:
13395
diff
changeset
|
119 md5sum_outfile); |
3673ad04ebfb
Replaced suboption parser by call to suboption helper.
ivo
parents:
13395
diff
changeset
|
120 |
31287
168e89b341b1
Reduce verbosity about suboption parsing in vo drivers.
diego
parents:
31151
diff
changeset
|
121 mp_msg(MSGT_VO, MSGL_V, "%s: %s\n", info.short_name, |
168e89b341b1
Reduce verbosity about suboption parsing in vo drivers.
diego
parents:
31151
diff
changeset
|
122 "Suboptions parsed OK."); |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
123 return 0; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
124 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
125 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
126 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
127 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
128 /** \brief Configure the video output driver. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
129 * |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
130 * This functions configures the video output driver. It opens the output |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
131 * file to which this driver will write all the MD5 sums. If something |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
132 * goes wrong, the player will exit. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
133 * |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
134 * \return 0 All went well. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
135 */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
136 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
137 static int config(uint32_t width, uint32_t height, uint32_t d_width, |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14850
diff
changeset
|
138 uint32_t d_height, uint32_t flags, char *title, |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
139 uint32_t format) |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
140 { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
141 if (vo_config_count > 0 ) { /* Already configured */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
142 return 0; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
143 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
144 |
34225 | 145 if (strcmp(md5sum_outfile, "-") == 0) |
146 md5sum_fd = stdout; | |
147 else | |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
148 if ( (md5sum_fd = fopen(md5sum_outfile, "w") ) == NULL ) { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
149 mp_msg(MSGT_VO, MSGL_ERR, "\n%s: %s\n", info.short_name, |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
150 MSGTR_VO_CantCreateFile); |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
151 mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
152 info.short_name, MSGTR_VO_GenericError, strerror(errno) ); |
30516 | 153 exit_player(EXIT_ERROR); |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
154 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
155 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
156 return 0; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
157 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
158 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
159 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
160 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
161 /** \brief Write MD5 sum to output file. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
162 * |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
163 * This function writes an ASCII representation of a 16-byte hexadecimal |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
164 * MD5 sum to our output file. The file descriptor is a global variable. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
165 * |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
166 * \param md5sum Sixteen bytes that represent an MD5 sum. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
167 * |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
168 * \return None The player will exit if a write error occurs. |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
169 */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
170 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
171 static void md5sum_output_sum(unsigned char *md5sum) { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
172 int i; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
173 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
174 for(i=0; i<16; i++) { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
175 if ( fprintf(md5sum_fd, "%02x", md5sum[i]) < 0 ) md5sum_write_error(); |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
176 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
177 if ( fprintf(md5sum_fd, " frame%08d\n", framenum) < 0 ) |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
178 md5sum_write_error(); |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
179 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
180 framenum++; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
181 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
182 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
183 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
184 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
185 static uint32_t draw_image(mp_image_t *mpi) |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
186 { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
187 unsigned char md5sum[16]; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
188 uint32_t w = mpi->w; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
189 uint32_t h = mpi->h; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
190 uint8_t *rgbimage = mpi->planes[0]; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
191 uint8_t *planeY = mpi->planes[0]; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
192 uint8_t *planeU = mpi->planes[1]; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
193 uint8_t *planeV = mpi->planes[2]; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
194 uint32_t strideY = mpi->stride[0]; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
195 uint32_t strideU = mpi->stride[1]; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
196 uint32_t strideV = mpi->stride[2]; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
197 |
18882
21f45afa0f87
use libavutil's md5 implementation instead of local imported copy
ivo
parents:
16171
diff
changeset
|
198 uint8_t md5_context_memory[av_md5_size]; |
21f45afa0f87
use libavutil's md5 implementation instead of local imported copy
ivo
parents:
16171
diff
changeset
|
199 struct AVMD5 *md5_context = (struct AVMD5*) md5_context_memory; |
14850 | 200 unsigned int i; |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
201 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
202 if (mpi->flags & MP_IMGFLAG_PLANAR) { /* Planar */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
203 if (mpi->flags & MP_IMGFLAG_YUV) { /* Planar YUV */ |
18882
21f45afa0f87
use libavutil's md5 implementation instead of local imported copy
ivo
parents:
16171
diff
changeset
|
204 av_md5_init(md5_context); |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
205 for (i=0; i<h; i++) { |
18882
21f45afa0f87
use libavutil's md5 implementation instead of local imported copy
ivo
parents:
16171
diff
changeset
|
206 av_md5_update(md5_context, planeY + i * strideY, w); |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
207 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
208 w = w / 2; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
209 h = h / 2; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
210 for (i=0; i<h; i++) { |
18882
21f45afa0f87
use libavutil's md5 implementation instead of local imported copy
ivo
parents:
16171
diff
changeset
|
211 av_md5_update(md5_context, planeU + i * strideU, w); |
31151
944efc839c41
Change -vo md5sum to not interleave U and V lines when calculating
reimar
parents:
30633
diff
changeset
|
212 } |
944efc839c41
Change -vo md5sum to not interleave U and V lines when calculating
reimar
parents:
30633
diff
changeset
|
213 for (i=0; i<h; i++) { |
18882
21f45afa0f87
use libavutil's md5 implementation instead of local imported copy
ivo
parents:
16171
diff
changeset
|
214 av_md5_update(md5_context, planeV + i * strideV, w); |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
215 } |
18882
21f45afa0f87
use libavutil's md5 implementation instead of local imported copy
ivo
parents:
16171
diff
changeset
|
216 av_md5_final(md5_context, md5sum); |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
217 md5sum_output_sum(md5sum); |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
218 return VO_TRUE; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
219 } else { /* Planar RGB */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
220 return VO_FALSE; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
221 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
222 } else { /* Packed */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
223 if (mpi->flags & MP_IMGFLAG_YUV) { /* Packed YUV */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28922
diff
changeset
|
224 |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
225 return VO_FALSE; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
226 } else { /* Packed RGB */ |
18882
21f45afa0f87
use libavutil's md5 implementation instead of local imported copy
ivo
parents:
16171
diff
changeset
|
227 av_md5_sum(md5sum, rgbimage, mpi->w * (mpi->bpp >> 3) * mpi->h); |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
228 md5sum_output_sum(md5sum); |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
229 return VO_TRUE; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
230 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
231 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
232 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
233 return VO_FALSE; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
234 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
235 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
236 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
237 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
238 static int query_format(uint32_t format) |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
239 { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
240 switch (format) { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
241 case IMGFMT_RGB24: |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
242 case IMGFMT_YV12: |
36586 | 243 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VOCAP_NOSLICES; |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
244 default: |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
245 return 0; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
246 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
247 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
248 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
249 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
250 |
33305
ddb45e9443ec
Remove the variable arguments from the libvo control() functions.
iive
parents:
32699
diff
changeset
|
251 static int control(uint32_t request, void *data) |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
252 { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
253 switch (request) { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
254 case VOCTRL_QUERY_FORMAT: |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
255 return query_format(*((uint32_t*)data)); |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
256 case VOCTRL_DRAW_IMAGE: |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
257 return draw_image(data); |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
258 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
259 return VO_NOTIMPL; |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
260 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
261 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
262 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
263 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
264 static void uninit(void) |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
265 { |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
31287
diff
changeset
|
266 free(md5sum_outfile); |
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
31287
diff
changeset
|
267 md5sum_outfile = NULL; |
34225 | 268 if (md5sum_fd && md5sum_fd != stdout) fclose(md5sum_fd); |
13395
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
269 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
270 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
271 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
272 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
273 static void check_events(void) |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
274 { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
275 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
276 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
277 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
278 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
279 static void draw_osd(void) |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
280 { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
281 } |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
282 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
283 /* ------------------------------------------------------------------------- */ |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
284 |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
285 static void flip_page (void) |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
286 { |
07708ec98d87
New MD5 sum video output driver. For every frame, it calculates the MD5 sum
ivo
parents:
diff
changeset
|
287 } |