OLD | NEW |
1 /* | 1 /* |
2 * Ogg bitstream support | 2 * Ogg bitstream support |
3 * Luca Barbato <lu_zero@gentoo.org> | 3 * Luca Barbato <lu_zero@gentoo.org> |
4 * Based on tcvp implementation | 4 * Based on tcvp implementation |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 Copyright (C) 2005 Michael Ahlberg, Måns Rullgård | 8 Copyright (C) 2005 Michael Ahlberg, Måns Rullgård |
9 | 9 |
10 Permission is hereby granted, free of charge, to any person | 10 Permission is hereby granted, free of charge, to any person |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 | 622 |
623 return psize; | 623 return psize; |
624 } | 624 } |
625 | 625 |
626 static int ogg_read_close(AVFormatContext *s) | 626 static int ogg_read_close(AVFormatContext *s) |
627 { | 627 { |
628 struct ogg *ogg = s->priv_data; | 628 struct ogg *ogg = s->priv_data; |
629 int i; | 629 int i; |
630 | 630 |
631 for (i = 0; i < ogg->nstreams; i++){ | 631 for (i = 0; i < ogg->nstreams; i++){ |
632 av_free (ogg->streams[i].buf); | 632 struct ogg_stream os = ogg->streams[i]; |
633 av_free (ogg->streams[i].private); | 633 struct oggvorbis_private *priv = os.private; |
| 634 if (priv && priv->packet && os.buf) { |
| 635 int pkt_type = os.buf[os.pstart]; |
| 636 if (pkt_type & 1 && pkt_type <= 5) |
| 637 av_freep (&priv->packet[pkt_type >> 1]); |
| 638 } |
| 639 av_free (os.buf); |
| 640 av_free (os.private); |
634 } | 641 } |
635 av_free (ogg->streams); | 642 av_free (ogg->streams); |
636 return 0; | 643 return 0; |
637 } | 644 } |
638 | 645 |
639 static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index, | 646 static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index, |
640 int64_t *pos_arg, int64_t pos_limit) | 647 int64_t *pos_arg, int64_t pos_limit) |
641 { | 648 { |
642 struct ogg *ogg = s->priv_data; | 649 struct ogg *ogg = s->priv_data; |
643 AVIOContext *bc = s->pb; | 650 AVIOContext *bc = s->pb; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 .priv_data_size = sizeof(struct ogg), | 743 .priv_data_size = sizeof(struct ogg), |
737 .read_probe = ogg_probe, | 744 .read_probe = ogg_probe, |
738 .read_header = ogg_read_header, | 745 .read_header = ogg_read_header, |
739 .read_packet = ogg_read_packet, | 746 .read_packet = ogg_read_packet, |
740 .read_close = ogg_read_close, | 747 .read_close = ogg_read_close, |
741 .read_seek = ogg_read_seek, | 748 .read_seek = ogg_read_seek, |
742 .read_timestamp = ogg_read_timestamp, | 749 .read_timestamp = ogg_read_timestamp, |
743 .extensions = "ogg", | 750 .extensions = "ogg", |
744 .flags = AVFMT_GENERIC_INDEX, | 751 .flags = AVFMT_GENERIC_INDEX, |
745 }; | 752 }; |
OLD | NEW |