comparison utils.c @ 2830:d7b2ac8d796d libavformat

Simplify av_close_input_file similarly to av_open_input_file previously
author reimar
date Mon, 17 Dec 2007 19:12:43 +0000
parents 51790e849ad3
children 8ac5fe1c5549
comparison
equal deleted inserted replaced
2829:51790e849ad3 2830:d7b2ac8d796d
2039 return AVERROR(ENOSYS); 2039 return AVERROR(ENOSYS);
2040 } 2040 }
2041 2041
2042 void av_close_input_file(AVFormatContext *s) 2042 void av_close_input_file(AVFormatContext *s)
2043 { 2043 {
2044 int i, must_open_file; 2044 int i;
2045 AVStream *st; 2045 AVStream *st;
2046 2046
2047 /* free previous packet */ 2047 /* free previous packet */
2048 if (s->cur_st && s->cur_st->parser) 2048 if (s->cur_st && s->cur_st->parser)
2049 av_free_packet(&s->cur_pkt); 2049 av_free_packet(&s->cur_pkt);
2066 av_freep(&s->programs[i]->name); 2066 av_freep(&s->programs[i]->name);
2067 av_freep(&s->programs[i]->stream_index); 2067 av_freep(&s->programs[i]->stream_index);
2068 av_freep(&s->programs[i]); 2068 av_freep(&s->programs[i]);
2069 } 2069 }
2070 flush_packet_queue(s); 2070 flush_packet_queue(s);
2071 must_open_file = 1; 2071 if (!(s->iformat->flags & AVFMT_NOFILE))
2072 if (s->iformat->flags & AVFMT_NOFILE) {
2073 must_open_file = 0;
2074 }
2075 if (must_open_file) {
2076 url_fclose(s->pb); 2072 url_fclose(s->pb);
2077 }
2078 av_freep(&s->priv_data); 2073 av_freep(&s->priv_data);
2079 av_free(s); 2074 av_free(s);
2080 } 2075 }
2081 2076
2082 AVStream *av_new_stream(AVFormatContext *s, int id) 2077 AVStream *av_new_stream(AVFormatContext *s, int id)