summaryrefslogtreecommitdiff
path: root/libavformat/oggparsespeex.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-21 01:27:28 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-21 02:01:26 +0200
commitdd8ffc1925156720fa0acfc9242c358cee8031e9 (patch)
tree7f2908a4cce60e352e43c5cb27a77d870890ab10 /libavformat/oggparsespeex.c
parent44a2bb75a72672177c3837512a2e1ea6f1143d66 (diff)
parent65d3176aaf8f876e0769f200abe95cac42151c89 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (47 commits) lavc: hide private symbols. lavc: deprecate img_get_alpha_info(). lavc: use avpriv_ prefix for ff_toupper4. lavc: use avpriv_ prefix for ff_copy_bits and align_put_bits. lavc: use avpriv_ prefix for ff_ac3_parse_header. lavc: use avpriv_ prefix for ff_frame_rate_tab. lavc: rename ff_find_start_code to avpriv_mpv_find_start_code lavc: use avpriv_ prefix for ff_split_xiph_headers. lavc: use avpriv_ prefix for ff_dirac_parse_sequence_header. lavc: use avpriv_ prefix for some dv symbols used in lavf. lavc: use avpriv_ prefix for some flac symbols used in lavf. lavc: use avpriv_ prefix for some mpeg4audio symbols used in lavf. lavc: use avpriv_ prefix for some mpegaudio symbols used in lavf. lavc: use avpriv_ prefix for ff_aac_parse_header(). lavf: hide private symbols. lavf: use avpriv_ prefix for some dv functions. lavf: use avpriv_ prefix for ff_new_chapter(). avcodec: add CODEC_CAP_DELAY note to avcodec_decode_audio3() documentation avcodec: clarify the CODEC_CAP_DELAY note in avcodec_decode_video2() avcodec: clarify documentation of CODEC_CAP_DELAY ... Conflicts: configure doc/general.texi libavcodec/Makefile libavcodec/aacdec.c libavcodec/allcodecs.c libavcodec/avcodec.h libavcodec/dv.c libavcodec/dvdata.c libavcodec/dvdata.h libavcodec/libspeexenc.c libavcodec/mpegvideo.c libavcodec/version.h libavformat/avidec.c libavformat/dv.c libavformat/dv.h libavformat/flvenc.c libavformat/mov.c libavformat/mp3enc.c libavformat/oggparsespeex.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggparsespeex.c')
-rw-r--r--libavformat/oggparsespeex.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
index 80b2001ddf..bbeeb20d60 100644
--- a/libavformat/oggparsespeex.c
+++ b/libavformat/oggparsespeex.c
@@ -31,6 +31,7 @@
#include "oggdec.h"
struct speex_params {
+ int packet_size;
int final_packet_duration;
int seq;
};
@@ -58,14 +59,10 @@ static int speex_header(AVFormatContext *s, int idx) {
st->codec->sample_rate = AV_RL32(p + 36);
st->codec->channels = AV_RL32(p + 48);
- /* We treat the whole Speex packet as a single frame everywhere Speex
- is handled in FFmpeg. This avoids the complexities of splitting
- and joining individual Speex frames, which are not always
- byte-aligned. */
- st->codec->frame_size = AV_RL32(p + 56);
- frames_per_packet = AV_RL32(p + 64);
+ spxp->packet_size = AV_RL32(p + 56);
+ frames_per_packet = AV_RL32(p + 64);
if (frames_per_packet)
- st->codec->frame_size *= frames_per_packet;
+ spxp->packet_size *= frames_per_packet;
st->codec->extradata_size = os->psize;
st->codec->extradata = av_malloc(st->codec->extradata_size
@@ -95,7 +92,7 @@ static int speex_packet(AVFormatContext *s, int idx)
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
struct speex_params *spxp = os->private;
- int packet_size = s->streams[idx]->codec->frame_size;
+ int packet_size = spxp->packet_size;
if (os->flags & OGG_FLAG_EOS && os->lastpts != AV_NOPTS_VALUE &&
os->granule > 0) {
@@ -108,9 +105,10 @@ static int speex_packet(AVFormatContext *s, int idx)
if (!os->lastpts && os->granule > 0)
/* first packet */
- os->pduration = os->granule - packet_size * (ogg_page_packets(os) - 1);
- else if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs &&
- spxp->final_packet_duration)
+ os->lastpts = os->lastdts = os->granule - packet_size *
+ ogg_page_packets(os);
+ if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs &&
+ spxp->final_packet_duration)
/* final packet */
os->pduration = spxp->final_packet_duration;
else