X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fseek.c;h=9be8db97845bc7617316f0da9c0b1014e83905fa;hb=7ccb847f0f1f28199fa254847b91b6e50fb92832;hp=26b622f035aeeb35371508de9f475905b9fb0eee;hpb=cc947f04cc16033d651fda5aab91e4a3c4b6bd4d;p=ffmpeg diff --git a/libavformat/seek.c b/libavformat/seek.c index 26b622f035a..9be8db97845 100644 --- a/libavformat/seek.c +++ b/libavformat/seek.c @@ -3,24 +3,27 @@ * * Copyright (c) 2009 Ivan Schreter * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * Libav is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * FFmpeg is distributed in the hope that it will be useful, + * Libav is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "seek.h" +#include "libavutil/mathematics.h" #include "libavutil/mem.h" #include "internal.h" @@ -313,7 +316,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s, step = s->pb->buffer_size; curpos = FFMAX(pos - step / 2, 0); for (;;) { - url_fseek(s->pb, curpos, SEEK_SET); + avio_seek(s->pb, curpos, SEEK_SET); search_hi_lo_keyframes(s, ts, time_base, flags, @@ -385,7 +388,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s, } } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); av_free(sync); return pos; } @@ -405,16 +408,16 @@ AVParserState *ff_store_parser_state(AVFormatContext *s) return NULL; } - state->fpos = url_ftell(s->pb); + state->fpos = avio_tell(s->pb); // copy context structures - state->cur_st = s->cur_st; state->packet_buffer = s->packet_buffer; + state->parse_queue = s->parse_queue; state->raw_packet_buffer = s->raw_packet_buffer; state->raw_packet_buffer_remaining_size = s->raw_packet_buffer_remaining_size; - s->cur_st = NULL; s->packet_buffer = NULL; + s->parse_queue = NULL; s->raw_packet_buffer = NULL; s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; @@ -427,20 +430,12 @@ AVParserState *ff_store_parser_state(AVFormatContext *s) ss->parser = st->parser; ss->last_IP_pts = st->last_IP_pts; ss->cur_dts = st->cur_dts; - ss->reference_dts = st->reference_dts; - ss->cur_ptr = st->cur_ptr; - ss->cur_len = st->cur_len; ss->probe_packets = st->probe_packets; - ss->cur_pkt = st->cur_pkt; st->parser = NULL; st->last_IP_pts = AV_NOPTS_VALUE; st->cur_dts = AV_NOPTS_VALUE; - st->reference_dts = AV_NOPTS_VALUE; - st->cur_ptr = NULL; - st->cur_len = 0; st->probe_packets = MAX_PROBE_PACKETS; - av_init_packet(&st->cur_pkt); } return state; @@ -456,11 +451,11 @@ void ff_restore_parser_state(AVFormatContext *s, AVParserState *state) if (!state) return; - url_fseek(s->pb, state->fpos, SEEK_SET); + avio_seek(s->pb, state->fpos, SEEK_SET); // copy context structures - s->cur_st = state->cur_st; s->packet_buffer = state->packet_buffer; + s->parse_queue = state->parse_queue; s->raw_packet_buffer = state->raw_packet_buffer; s->raw_packet_buffer_remaining_size = state->raw_packet_buffer_remaining_size; @@ -472,11 +467,7 @@ void ff_restore_parser_state(AVFormatContext *s, AVParserState *state) st->parser = ss->parser; st->last_IP_pts = ss->last_IP_pts; st->cur_dts = ss->cur_dts; - st->reference_dts = ss->reference_dts; - st->cur_ptr = ss->cur_ptr; - st->cur_len = ss->cur_len; st->probe_packets = ss->probe_packets; - st->cur_pkt = ss->cur_pkt; } av_free(state->stream_states); @@ -506,13 +497,12 @@ void ff_free_parser_state(AVFormatContext *s, AVParserState *state) ss = &state->stream_states[i]; if (ss->parser) av_parser_close(ss->parser); - av_free_packet(&ss->cur_pkt); } free_packet_list(state->packet_buffer); + free_packet_list(state->parse_queue); free_packet_list(state->raw_packet_buffer); av_free(state->stream_states); av_free(state); } -