add a fix for the Ogg demuxer, from upstream via Brad
This commit is contained in:
parent
6fa22cf66b
commit
09abb3d2cd
@ -1,11 +1,11 @@
|
||||
# $OpenBSD: Makefile,v 1.79 2011/08/24 09:26:41 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.80 2011/08/28 11:17:48 sthen Exp $
|
||||
|
||||
COMMENT= audio/video converter and streamer
|
||||
|
||||
V= 20110408
|
||||
DISTNAME= ffmpeg-git-${V}
|
||||
PKGNAME= ffmpeg-${V}
|
||||
REVISION= 7
|
||||
REVISION= 8
|
||||
CATEGORIES= graphics multimedia
|
||||
MASTER_SITES= http://comstyle.com/source/
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
$OpenBSD: patch-libavformat_oggdec_c,v 1.2 2011/08/16 19:01:47 sthen Exp $
|
||||
$OpenBSD: patch-libavformat_oggdec_c,v 1.3 2011/08/28 11:17:48 sthen Exp $
|
||||
|
||||
- Fix demuxing chained audio streams.
|
||||
- Correct duration.
|
||||
- Abort header parsing when encountering a data packet.
|
||||
- Prevent heap corruption.
|
||||
- Make sure start time correction is applied once to each stream.
|
||||
|
||||
--- libavformat/oggdec.c.orig Tue Apr 5 19:28:59 2011
|
||||
+++ libavformat/oggdec.c Wed Aug 3 15:46:38 2011
|
||||
+++ libavformat/oggdec.c Wed Aug 24 18:18:44 2011
|
||||
@@ -148,7 +148,7 @@ ogg_find_codec (uint8_t * buf, int size)
|
||||
}
|
||||
|
||||
@ -86,7 +87,29 @@ $OpenBSD: patch-libavformat_oggdec_c,v 1.2 2011/08/16 19:01:47 sthen Exp $
|
||||
os->sync_pos = os->page_pos;
|
||||
}
|
||||
|
||||
@@ -482,6 +496,18 @@ ogg_get_length (AVFormatContext * s)
|
||||
@@ -454,6 +468,7 @@ ogg_get_length (AVFormatContext * s)
|
||||
struct ogg *ogg = s->priv_data;
|
||||
int i;
|
||||
int64_t size, end;
|
||||
+ int streams_left=0;
|
||||
|
||||
if(!s->pb->seekable)
|
||||
return 0;
|
||||
@@ -475,13 +490,37 @@ ogg_get_length (AVFormatContext * s)
|
||||
ogg->streams[i].codec) {
|
||||
s->streams[i]->duration =
|
||||
ogg_gptopts (s, i, ogg->streams[i].granule, NULL);
|
||||
- if (s->streams[i]->start_time != AV_NOPTS_VALUE)
|
||||
+ if (s->streams[i]->start_time != AV_NOPTS_VALUE) {
|
||||
s->streams[i]->duration -= s->streams[i]->start_time;
|
||||
+ streams_left-= (ogg->streams[i].got_start==-1);
|
||||
+ ogg->streams[i].got_start= 1;
|
||||
+ }else if(!ogg->streams[i].got_start){
|
||||
+ ogg->streams[i].got_start= -1;
|
||||
+ streams_left++;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
ogg_restore (s, 0);
|
||||
|
||||
@ -95,9 +118,15 @@ $OpenBSD: patch-libavformat_oggdec_c,v 1.2 2011/08/16 19:01:47 sthen Exp $
|
||||
+ while (!ogg_read_page (s, &i)){
|
||||
+ if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
|
||||
+ ogg->streams[i].codec) {
|
||||
+ s->streams[i]->duration -=
|
||||
+ ogg_gptopts (s, i, ogg->streams[i].granule, NULL);
|
||||
+ break;
|
||||
+ if(s->streams[i]->duration && s->streams[i]->start_time == AV_NOPTS_VALUE && !ogg->streams[i].got_start){
|
||||
+ int64_t start= ogg_gptopts (s, i, ogg->streams[i].granule, NULL);
|
||||
+ if(av_rescale_q(start, s->streams[i]->time_base, AV_TIME_BASE_Q) > AV_TIME_BASE)
|
||||
+ s->streams[i]->duration -= start;
|
||||
+ ogg->streams[i].got_start= 1;
|
||||
+ streams_left--;
|
||||
+ }
|
||||
+ if(streams_left<=0)
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ ogg_restore (s, 0);
|
||||
@ -105,7 +134,7 @@ $OpenBSD: patch-libavformat_oggdec_c,v 1.2 2011/08/16 19:01:47 sthen Exp $
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -600,15 +626,15 @@ ogg_read_timestamp (AVFormatContext * s, int stream_in
|
||||
@@ -600,15 +639,15 @@ ogg_read_timestamp (AVFormatContext * s, int stream_in
|
||||
int64_t pos_limit)
|
||||
{
|
||||
struct ogg *ogg = s->priv_data;
|
||||
@ -123,7 +152,7 @@ $OpenBSD: patch-libavformat_oggdec_c,v 1.2 2011/08/16 19:01:47 sthen Exp $
|
||||
pts = ogg_calc_pts(s, i, NULL);
|
||||
if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY))
|
||||
pts = AV_NOPTS_VALUE;
|
||||
@@ -633,6 +659,7 @@ static int ogg_read_seek(AVFormatContext *s, int strea
|
||||
@@ -633,6 +672,7 @@ static int ogg_read_seek(AVFormatContext *s, int strea
|
||||
os->keyframe_seek = 1;
|
||||
|
||||
ret = av_seek_frame_binary(s, stream_index, timestamp, flags);
|
||||
|
14
graphics/ffmpeg/patches/patch-libavformat_oggdec_h
Normal file
14
graphics/ffmpeg/patches/patch-libavformat_oggdec_h
Normal file
@ -0,0 +1,14 @@
|
||||
$OpenBSD: patch-libavformat_oggdec_h,v 1.1 2011/08/28 11:17:48 sthen Exp $
|
||||
|
||||
Make sure start time correction is applied once to each stream.
|
||||
|
||||
--- libavformat/oggdec.h.orig Wed Aug 24 18:15:40 2011
|
||||
+++ libavformat/oggdec.h Wed Aug 24 18:16:01 2011
|
||||
@@ -75,6 +75,7 @@ struct ogg_stream {
|
||||
int incomplete; ///< whether we're expecting a continuation in the next page
|
||||
int page_end; ///< current packet is the last one completed in the page
|
||||
int keyframe_seek;
|
||||
+ int got_start;
|
||||
void *private;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user