| OLD | NEW |
| 1 /* | 1 /* |
| 2 * AVI demuxer | 2 * AVI demuxer |
| 3 * Copyright (c) 2001 Fabrice Bellard | 3 * Copyright (c) 2001 Fabrice Bellard |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 int64_t ts, next_ts, ts_min = INT64_MAX; | 752 int64_t ts, next_ts, ts_min = INT64_MAX; |
| 753 AVStream *st, *sub_st = NULL; | 753 AVStream *st, *sub_st = NULL; |
| 754 int i; | 754 int i; |
| 755 | 755 |
| 756 next_ts = av_rescale_q(next_ast->frame_offset, next_st->time_base, | 756 next_ts = av_rescale_q(next_ast->frame_offset, next_st->time_base, |
| 757 AV_TIME_BASE_Q); | 757 AV_TIME_BASE_Q); |
| 758 | 758 |
| 759 for (i=0; i<s->nb_streams; i++) { | 759 for (i=0; i<s->nb_streams; i++) { |
| 760 st = s->streams[i]; | 760 st = s->streams[i]; |
| 761 ast = st->priv_data; | 761 ast = st->priv_data; |
| 762 if (st->discard < AVDISCARD_ALL && ast->sub_pkt.data) { | 762 if (st->discard < AVDISCARD_ALL && ast && ast->sub_pkt.data) { |
| 763 ts = av_rescale_q(ast->sub_pkt.dts, st->time_base, AV_TIME_BASE_Q); | 763 ts = av_rescale_q(ast->sub_pkt.dts, st->time_base, AV_TIME_BASE_Q); |
| 764 if (ts <= next_ts && ts < ts_min) { | 764 if (ts <= next_ts && ts < ts_min) { |
| 765 ts_min = ts; | 765 ts_min = ts; |
| 766 sub_st = st; | 766 sub_st = st; |
| 767 } | 767 } |
| 768 } | 768 } |
| 769 } | 769 } |
| 770 | 770 |
| 771 if (sub_st) { | 771 if (sub_st) { |
| 772 ast = sub_st->priv_data; | 772 ast = sub_st->priv_data; |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 | 1287 |
| 1288 static int avi_read_close(AVFormatContext *s) | 1288 static int avi_read_close(AVFormatContext *s) |
| 1289 { | 1289 { |
| 1290 int i; | 1290 int i; |
| 1291 AVIContext *avi = s->priv_data; | 1291 AVIContext *avi = s->priv_data; |
| 1292 | 1292 |
| 1293 for(i=0;i<s->nb_streams;i++) { | 1293 for(i=0;i<s->nb_streams;i++) { |
| 1294 AVStream *st = s->streams[i]; | 1294 AVStream *st = s->streams[i]; |
| 1295 AVIStream *ast = st->priv_data; | 1295 AVIStream *ast = st->priv_data; |
| 1296 av_free(st->codec->palctrl); | 1296 av_free(st->codec->palctrl); |
| 1297 if (ast->sub_ctx) { | 1297 if (ast) { |
| 1298 av_freep(&ast->sub_ctx->pb); | 1298 if (ast->sub_ctx) { |
| 1299 av_close_input_stream(ast->sub_ctx); | 1299 av_freep(&ast->sub_ctx->pb); |
| 1300 av_close_input_stream(ast->sub_ctx); |
| 1301 } |
| 1302 av_free(ast->sub_buffer); |
| 1303 av_free_packet(&ast->sub_pkt); |
| 1300 } | 1304 } |
| 1301 av_free(ast->sub_buffer); | |
| 1302 av_free_packet(&ast->sub_pkt); | |
| 1303 } | 1305 } |
| 1304 | 1306 |
| 1305 if (avi->dv_demux) | 1307 if (avi->dv_demux) |
| 1306 av_free(avi->dv_demux); | 1308 av_free(avi->dv_demux); |
| 1307 | 1309 |
| 1308 return 0; | 1310 return 0; |
| 1309 } | 1311 } |
| 1310 | 1312 |
| 1311 static int avi_probe(AVProbeData *p) | 1313 static int avi_probe(AVProbeData *p) |
| 1312 { | 1314 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1325 "avi", | 1327 "avi", |
| 1326 NULL_IF_CONFIG_SMALL("AVI format"), | 1328 NULL_IF_CONFIG_SMALL("AVI format"), |
| 1327 sizeof(AVIContext), | 1329 sizeof(AVIContext), |
| 1328 avi_probe, | 1330 avi_probe, |
| 1329 avi_read_header, | 1331 avi_read_header, |
| 1330 avi_read_packet, | 1332 avi_read_packet, |
| 1331 avi_read_close, | 1333 avi_read_close, |
| 1332 avi_read_seek, | 1334 avi_read_seek, |
| 1333 .metadata_conv = ff_avi_metadata_conv, | 1335 .metadata_conv = ff_avi_metadata_conv, |
| 1334 }; | 1336 }; |
| OLD | NEW |