trunk/src/lib/util/aviio.c
r23815 | r23816 | |
1269 | 1269 | if (avierr != AVIERR_NONE) |
1270 | 1270 | goto error; |
1271 | 1271 | |
1272 | | /* find the avih chunk */ |
1273 | | avierr = find_first_chunk(file, CHUNKTYPE_AVIH, &hdrl, &avih); |
| 1272 | /* find the avih chunk */ |
| 1273 | avierr = find_first_chunk(file, CHUNKTYPE_AVIH, &hdrl, &avih); |
| 1274 | if (avierr != AVIERR_NONE) |
| 1275 | goto error; |
| 1276 | |
| 1277 | /* parse the avih chunk */ |
| 1278 | avierr = parse_avih_chunk(file, &avih); |
| 1279 | if (avierr != AVIERR_NONE) |
| 1280 | goto error; |
| 1281 | |
| 1282 | /* loop over strl LIST chunks */ |
| 1283 | strindex = 0; |
| 1284 | for (avierr = find_first_list(file, LISTTYPE_STRL, &hdrl, &strl); avierr == AVIERR_NONE; avierr = find_next_list(file, LISTTYPE_STRL, &hdrl, &strl)) |
| 1285 | { |
| 1286 | /* if we have too many, it's a bad file */ |
| 1287 | if (strindex >= file->streams) |
| 1288 | goto error; |
| 1289 | |
| 1290 | /* find the strh chunk */ |
| 1291 | avierr = find_first_chunk(file, CHUNKTYPE_STRH, &strl, &strh); |
1274 | 1292 | if (avierr != AVIERR_NONE) |
1275 | 1293 | goto error; |
1276 | 1294 | |
1277 | | /* parse the avih chunk */ |
1278 | | avierr = parse_avih_chunk(file, &avih); |
| 1295 | /* parse the data */ |
| 1296 | avierr = parse_strh_chunk(file, &file->stream[strindex], &strh); |
1279 | 1297 | if (avierr != AVIERR_NONE) |
1280 | 1298 | goto error; |
1281 | 1299 | |
1282 | | /* loop over strl LIST chunks */ |
1283 | | strindex = 0; |
1284 | | for (avierr = find_first_list(file, LISTTYPE_STRL, &hdrl, &strl); avierr == AVIERR_NONE; avierr = find_next_list(file, LISTTYPE_STRL, &hdrl, &strl)) |
1285 | | { |
1286 | | /* if we have too many, it's a bad file */ |
1287 | | if (strindex >= file->streams) |
1288 | | goto error; |
| 1300 | /* find the strf chunk */ |
| 1301 | avierr = find_first_chunk(file, CHUNKTYPE_STRF, &strl, &strf); |
| 1302 | if (avierr != AVIERR_NONE) |
| 1303 | goto error; |
1289 | 1304 | |
1290 | | /* find the strh chunk */ |
1291 | | avierr = find_first_chunk(file, CHUNKTYPE_STRH, &strl, &strh); |
1292 | | if (avierr != AVIERR_NONE) |
1293 | | goto error; |
| 1305 | /* parse the data */ |
| 1306 | avierr = parse_strf_chunk(file, &file->stream[strindex], &strf); |
| 1307 | if (avierr != AVIERR_NONE) |
| 1308 | goto error; |
1294 | 1309 | |
1295 | | /* parse the data */ |
1296 | | avierr = parse_strh_chunk(file, &file->stream[strindex], &strh); |
1297 | | if (avierr != AVIERR_NONE) |
1298 | | goto error; |
| 1310 | /* find the indx chunk, if present */ |
| 1311 | avierr = find_first_chunk(file, CHUNKTYPE_INDX, &strl, &indx); |
| 1312 | if (avierr == AVIERR_NONE) |
| 1313 | avierr = parse_indx_chunk(file, &file->stream[strindex], &indx); |
1299 | 1314 | |
1300 | | /* find the strf chunk */ |
1301 | | avierr = find_first_chunk(file, CHUNKTYPE_STRF, &strl, &strf); |
1302 | | if (avierr != AVIERR_NONE) |
1303 | | goto error; |
| 1315 | /* next stream */ |
| 1316 | strindex++; |
| 1317 | } |
1304 | 1318 | |
1305 | | /* parse the data */ |
1306 | | avierr = parse_strf_chunk(file, &file->stream[strindex], &strf); |
1307 | | if (avierr != AVIERR_NONE) |
1308 | | goto error; |
| 1319 | /* normalize the error after parsing the stream headers */ |
| 1320 | if (avierr == AVIERR_END) |
| 1321 | avierr = AVIERR_NONE; |
| 1322 | if (avierr != AVIERR_NONE) |
| 1323 | goto error; |
1309 | 1324 | |
1310 | | /* find the indx chunk, if present */ |
1311 | | avierr = find_first_chunk(file, CHUNKTYPE_INDX, &strl, &indx); |
1312 | | if (avierr == AVIERR_NONE) |
1313 | | avierr = parse_indx_chunk(file, &file->stream[strindex], &indx); |
1314 | | |
1315 | | /* next stream */ |
1316 | | strindex++; |
1317 | | } |
1318 | | |
1319 | | /* normalize the error after parsing the stream headers */ |
1320 | | if (avierr == AVIERR_END) |
1321 | | avierr = AVIERR_NONE; |
1322 | | if (avierr != AVIERR_NONE) |
1323 | | goto error; |
1324 | | |
1325 | 1325 | /* find the base of the movi data */ |
1326 | 1326 | avierr = find_first_list(file, LISTTYPE_MOVI, &riff, &movi); |
1327 | 1327 | if (avierr != AVIERR_NONE) |