1 /*
2 * Copyright (c) 2012 Stefano Sabatini
3 * Copyright (c) 2014 Clément Bœsch
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23
27
32
36
38 {
41 fprintf(stderr,
"Error while sending a packet to the decoder: %s\n",
av_err2str(
ret));
43 }
44
48 break;
50 fprintf(stderr,
"Error while receiving a frame from the decoder: %s\n",
av_err2str(
ret));
52 }
53
57
60 if (sd) {
62 for (
i = 0;
i < sd->
size /
sizeof(*mvs);
i++) {
64 printf(
"%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64
"\n",
67 mv->dst_x,
mv->dst_y,
mv->flags);
68 }
69 }
71 }
72 }
73
74 return 0;
75 }
76
78 {
84
87 fprintf(stderr, "Could not find %s stream in input file '%s'\n",
90 } else {
93
96 fprintf(stderr, "Failed to allocate codec\n");
98 }
99
102 fprintf(stderr, "Failed to copy codec parameters to codec context\n");
104 }
105
106 /* Init the video decoder */
111 fprintf(stderr, "Failed to open %s codec\n",
114 }
115
119 }
120
121 return 0;
122 }
123
124 int main(
int argc,
char **argv)
125 {
128
129 if (argc != 2) {
130 fprintf(stderr, "Usage: %s <video>\n", argv[0]);
131 exit(1);
132 }
134
136 fprintf(stderr,
"Could not open source file %s\n",
src_filename);
137 exit(1);
138 }
139
141 fprintf(stderr, "Could not find stream information\n");
142 exit(1);
143 }
144
146
148
150 fprintf(stderr, "Could not find video stream in the input, aborting\n");
152 goto end;
153 }
154
157 fprintf(stderr, "Could not allocate frame\n");
159 goto end;
160 }
161
164 fprintf(stderr, "Could not allocate AVPacket\n");
166 goto end;
167 }
168
169 printf(
"framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,flags\n");
170
171 /* read frames from the file */
177 break;
178 }
179
180 /* flush cached frames */
182
183 end:
189 }