Mercurial > libavformat.hg
comparison oggparsespeex.c @ 5434:68c8e7affd44 libavformat
Fix PTS for OGM codecs.
Fixes issue251
author | conrad |
---|---|
date | Sat, 12 Dec 2009 20:18:43 +0000 |
parents | 5de92e352cf9 |
children | e993cab1faf3 |
comparison
equal
deleted
inserted
replaced
5433:3e568c0b36d3 | 5434:68c8e7affd44 |
---|---|
93 if (!spxp) { | 93 if (!spxp) { |
94 spxp = av_mallocz(sizeof(*spxp)); | 94 spxp = av_mallocz(sizeof(*spxp)); |
95 os->private = spxp; | 95 os->private = spxp; |
96 } | 96 } |
97 | 97 |
98 if (os->flags & OGG_FLAG_EOS && os->lastgp != -1 && os->granule > 0) { | 98 if (os->flags & OGG_FLAG_EOS && os->lastpts != AV_NOPTS_VALUE && |
99 os->granule > 0) { | |
99 /* first packet of final page. we have to calculate the final packet | 100 /* first packet of final page. we have to calculate the final packet |
100 duration here because it is the only place we know the next-to-last | 101 duration here because it is the only place we know the next-to-last |
101 granule position. */ | 102 granule position. */ |
102 spxp->final_packet_duration = os->granule - os->lastgp - | 103 spxp->final_packet_duration = os->granule - os->lastpts - |
103 packet_size * (ogg_page_packets(os) - 1); | 104 packet_size * (ogg_page_packets(os) - 1); |
104 } | 105 } |
105 | 106 |
106 if (!os->lastgp && os->granule > 0) | 107 if (!os->lastpts && os->granule > 0) |
107 /* first packet */ | 108 /* first packet */ |
108 os->pduration = os->granule - packet_size * (ogg_page_packets(os) - 1); | 109 os->pduration = os->granule - packet_size * (ogg_page_packets(os) - 1); |
109 else if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs && | 110 else if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs && |
110 spxp->final_packet_duration) | 111 spxp->final_packet_duration) |
111 /* final packet */ | 112 /* final packet */ |