[iortcw] 185/497: All: Update opusfile to 0.6
Simon McVittie
smcv at debian.org
Fri Sep 8 10:36:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit 9fd43cf2cefae140944747993603757ea94bef5e
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date: Tue Aug 26 09:18:46 2014 +0000
All: Update opusfile to 0.6
---
MP/Makefile | 2 +-
.../code/opusfile-0.6}/include/opusfile.h | 19 +++++++++--
MP/code/{opusfile-0.5 => opusfile-0.6}/src/http.c | 0
.../code/opusfile-0.6}/src/info.c | 12 ++++---
.../{opusfile-0.5 => opusfile-0.6}/src/internal.c | 0
.../{opusfile-0.5 => opusfile-0.6}/src/internal.h | 0
.../code/opusfile-0.6}/src/opusfile.c | 39 ++++++++++------------
.../{opusfile-0.5 => opusfile-0.6}/src/stream.c | 0
.../{opusfile-0.5 => opusfile-0.6}/src/wincerts.c | 0
.../{opusfile-0.5 => opusfile-0.6}/src/winerrno.h | 0
SP/Makefile | 2 +-
.../code/opusfile-0.6}/include/opusfile.h | 19 +++++++++--
SP/code/{opusfile-0.5 => opusfile-0.6}/src/http.c | 0
.../code/opusfile-0.6}/src/info.c | 12 ++++---
.../{opusfile-0.5 => opusfile-0.6}/src/internal.c | 0
.../{opusfile-0.5 => opusfile-0.6}/src/internal.h | 0
.../code/opusfile-0.6}/src/opusfile.c | 39 ++++++++++------------
.../{opusfile-0.5 => opusfile-0.6}/src/stream.c | 0
.../{opusfile-0.5 => opusfile-0.6}/src/wincerts.c | 0
.../{opusfile-0.5 => opusfile-0.6}/src/winerrno.h | 0
20 files changed, 84 insertions(+), 60 deletions(-)
diff --git a/MP/Makefile b/MP/Makefile
index 6107963..6843bdd 100644
--- a/MP/Makefile
+++ b/MP/Makefile
@@ -286,7 +286,7 @@ JPDIR=$(MOUNT_DIR)/jpeg-8c
OGGDIR=$(MOUNT_DIR)/libogg-1.3.1
VORBISDIR=$(MOUNT_DIR)/libvorbis-1.3.4
OPUSDIR=$(MOUNT_DIR)/opus-1.1
-OPUSFILEDIR=$(MOUNT_DIR)/opusfile-0.5
+OPUSFILEDIR=$(MOUNT_DIR)/opusfile-0.6
ZDIR=$(MOUNT_DIR)/zlib
Q3ASMDIR=$(MOUNT_DIR)/tools/asm
LBURGDIR=$(MOUNT_DIR)/tools/lcc/lburg
diff --git a/SP/code/opusfile-0.5/include/opusfile.h b/MP/code/opusfile-0.6/include/opusfile.h
similarity index 99%
rename from SP/code/opusfile-0.5/include/opusfile.h
rename to MP/code/opusfile-0.6/include/opusfile.h
index 850cd6b..a31b6c4 100644
--- a/SP/code/opusfile-0.5/include/opusfile.h
+++ b/MP/code/opusfile-0.6/include/opusfile.h
@@ -1453,6 +1453,10 @@ int op_channel_count(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
/**Get the total (compressed) size of the stream, or of an individual link in
a (possibly-chained) Ogg Opus stream, including all headers and Ogg muxing
overhead.
+ \warning If the Opus stream (or link) is concurrently multiplexed with other
+ logical streams (e.g., video), this returns the size of the entire stream
+ (or link), not just the number of bytes in the first logical Opus stream.
+ Returning the latter would require scanning the entire file.
\param _of The \c OggOpusFile from which to retrieve the compressed size.
\param _li The index of the link whose compressed size should be computed.
Use a negative number to get the compressed size of the entire
@@ -1537,13 +1541,22 @@ const OpusTags *op_tags(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
\retval #OP_EINVAL The stream was only partially open.*/
int op_current_link(const OggOpusFile *_of) OP_ARG_NONNULL(1);
-/**Computes the bitrate for a given link in a (possibly chained) Ogg Opus
- stream.
+/**Computes the bitrate of the stream, or of an individual link in a
+ (possibly-chained) Ogg Opus stream.
The stream must be seekable to compute the bitrate.
For unseekable streams, use op_bitrate_instant() to get periodic estimates.
+ \warning If the Opus stream (or link) is concurrently multiplexed with other
+ logical streams (e.g., video), this uses the size of the entire stream (or
+ link) to compute the bitrate, not just the number of bytes in the first
+ logical Opus stream.
+ Returning the latter requires scanning the entire file, but this may be done
+ by decoding the whole file and calling op_bitrate_instant() once at the
+ end.
+ Install a trivial decoding callback with op_set_decode_callback() if you
+ wish to skip actual decoding during this process.
\param _of The \c OggOpusFile from which to retrieve the bitrate.
\param _li The index of the link whose bitrate should be computed.
- USe a negative number to get the bitrate of the whole stream.
+ Use a negative number to get the bitrate of the whole stream.
\return The bitrate on success, or a negative value on error.
\retval #OP_EINVAL The stream was only partially open, the stream was not
seekable, or \a _li was larger than the number of
diff --git a/MP/code/opusfile-0.5/src/http.c b/MP/code/opusfile-0.6/src/http.c
similarity index 100%
rename from MP/code/opusfile-0.5/src/http.c
rename to MP/code/opusfile-0.6/src/http.c
diff --git a/SP/code/opusfile-0.5/src/info.c b/MP/code/opusfile-0.6/src/info.c
similarity index 98%
rename from SP/code/opusfile-0.5/src/info.c
rename to MP/code/opusfile-0.6/src/info.c
index 6cf9851..3134927 100644
--- a/SP/code/opusfile-0.5/src/info.c
+++ b/MP/code/opusfile-0.6/src/info.c
@@ -28,11 +28,13 @@ static int op_parse_int16le(const unsigned char *_data){
}
static opus_uint32 op_parse_uint32le(const unsigned char *_data){
- return _data[0]|_data[1]<<8|_data[2]<<16|_data[3]<<24;
+ return _data[0]|(opus_uint32)_data[1]<<8|
+ (opus_uint32)_data[2]<<16|(opus_uint32)_data[3]<<24;
}
static opus_uint32 op_parse_uint32be(const unsigned char *_data){
- return _data[3]|_data[2]<<8|_data[1]<<16|_data[0]<<24;
+ return _data[3]|(opus_uint32)_data[2]<<8|
+ (opus_uint32)_data[1]<<16|(opus_uint32)_data[0]<<24;
}
int opus_head_parse(OpusHead *_head,const unsigned char *_data,size_t _len){
@@ -259,10 +261,11 @@ int opus_tags_add(OpusTags *_tags,const char *_tag,const char *_value){
_tags->user_comments[ncomments]=comment=
(char *)_ogg_malloc(sizeof(*comment)*(tag_len+value_len+2));
if(OP_UNLIKELY(comment==NULL))return OP_EFAULT;
- _tags->comment_lengths[ncomments]=tag_len+value_len+1;
memcpy(comment,_tag,sizeof(*comment)*tag_len);
comment[tag_len]='=';
memcpy(comment+tag_len+1,_value,sizeof(*comment)*(value_len+1));
+ _tags->comment_lengths[ncomments]=tag_len+value_len+1;
+ _tags->comments=ncomments+1;
return 0;
}
@@ -278,6 +281,7 @@ int opus_tags_add_comment(OpusTags *_tags,const char *_comment){
_tags->user_comments[ncomments]=op_strdup_with_len(_comment,comment_len);
if(OP_UNLIKELY(_tags->user_comments[ncomments]==NULL))return OP_EFAULT;
_tags->comment_lengths[ncomments]=comment_len;
+ _tags->comments=ncomments+1;
return 0;
}
@@ -560,7 +564,7 @@ static int opus_picture_tag_parse_impl(OpusPictureTag *_pic,const char *_tag,
i+=4;
/*If one of these is set, they all must be, but colors==0 is a valid value.*/
colors_set=width!=0||height!=0||depth!=0||colors!=0;
- if(width==0||height==0||depth==0&&colors_set)return OP_ENOTFORMAT;
+ if((width==0||height==0||depth==0)&&colors_set)return OP_ENOTFORMAT;
data_length=op_parse_uint32be(_buf+i);
i+=4;
if(data_length>_buf_sz-i)return OP_ENOTFORMAT;
diff --git a/MP/code/opusfile-0.5/src/internal.c b/MP/code/opusfile-0.6/src/internal.c
similarity index 100%
rename from MP/code/opusfile-0.5/src/internal.c
rename to MP/code/opusfile-0.6/src/internal.c
diff --git a/MP/code/opusfile-0.5/src/internal.h b/MP/code/opusfile-0.6/src/internal.h
similarity index 100%
rename from MP/code/opusfile-0.5/src/internal.h
rename to MP/code/opusfile-0.6/src/internal.h
diff --git a/SP/code/opusfile-0.5/src/opusfile.c b/MP/code/opusfile-0.6/src/opusfile.c
similarity index 99%
rename from SP/code/opusfile-0.5/src/opusfile.c
rename to MP/code/opusfile-0.6/src/opusfile.c
index 392ddb2..e8ce150 100644
--- a/SP/code/opusfile-0.5/src/opusfile.c
+++ b/MP/code/opusfile-0.6/src/opusfile.c
@@ -156,8 +156,8 @@ static int op_get_data(OggOpusFile *_of,int _nbytes){
/*Save a tiny smidge of verbosity to make the code more readable.*/
static int op_seek_helper(OggOpusFile *_of,opus_int64 _offset){
if(_offset==_of->offset)return 0;
- if(_of->callbacks.seek==NULL||
- (*_of->callbacks.seek)(_of->source,_offset,SEEK_SET)){
+ if(_of->callbacks.seek==NULL
+ ||(*_of->callbacks.seek)(_of->source,_offset,SEEK_SET)){
return OP_EREAD;
}
_of->offset=_offset;
@@ -496,30 +496,25 @@ static int op_fetch_headers_impl(OggOpusFile *_of,OpusHead *_head,
ogg_stream_pagein(&_of->os,_og);
if(OP_LIKELY(ogg_stream_packetout(&_of->os,&op)>0)){
ret=opus_head_parse(_head,op.packet,op.bytes);
- /*If it's just a stream type we don't recognize, ignore it.*/
- if(ret==OP_ENOTFORMAT)continue;
- /*Everything else is fatal.*/
- if(OP_UNLIKELY(ret<0))return ret;
/*Found a valid Opus header.
Continue setup.*/
- _of->ready_state=OP_STREAMSET;
+ if(OP_LIKELY(ret>=0))_of->ready_state=OP_STREAMSET;
+ /*If it's just a stream type we don't recognize, ignore it.
+ Everything else is fatal.*/
+ else if(ret!=OP_ENOTFORMAT)return ret;
}
}
/*Get the next page.
No need to clamp the boundary offset against _of->end, as all errors
- become OP_ENOTFORMAT.*/
+ become OP_ENOTFORMAT or OP_EBADHEADER.*/
if(OP_UNLIKELY(op_get_next_page(_of,_og,
OP_ADV_OFFSET(_of->offset,OP_CHUNK_SIZE))<0)){
- return OP_ENOTFORMAT;
- }
- /*If this page also belongs to our Opus stream, submit it and break.*/
- if(_of->ready_state==OP_STREAMSET
- &&_of->os.serialno==ogg_page_serialno(_og)){
- ogg_stream_pagein(&_of->os,_og);
- break;
+ return _of->ready_state<OP_STREAMSET?OP_ENOTFORMAT:OP_EBADHEADER;
}
}
if(OP_UNLIKELY(_of->ready_state!=OP_STREAMSET))return OP_ENOTFORMAT;
+ /*If the first non-header page belonged to our Opus stream, submit it.*/
+ if(_of->os.serialno==ogg_page_serialno(_og))ogg_stream_pagein(&_of->os,_og);
/*Loop getting packets.*/
for(;;){
switch(ogg_stream_packetout(&_of->os,&op)){
@@ -930,7 +925,7 @@ static int op_find_initial_pcm_offset(OggOpusFile *_of,
prev_packet_gp=pcm_start;
for(pi=0;pi<op_count;pi++){
if(cur_page_eos){
- ogg_int64_t diff;
+ ogg_int64_t diff = 0;
OP_ALWAYS_TRUE(!op_granpos_diff(&diff,cur_page_gp,prev_packet_gp));
diff=durations[pi]-diff;
/*If we have samples to trim...*/
@@ -1715,7 +1710,7 @@ opus_int64 op_raw_total(const OggOpusFile *_of,int _li){
ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li){
OggOpusLink *links;
- ogg_int64_t diff;
+ ogg_int64_t diff = 0;
int nlinks;
nlinks=_of->nlinks;
if(OP_UNLIKELY(_of->ready_state<OP_OPENED)
@@ -2114,7 +2109,7 @@ int op_raw_seek(OggOpusFile *_of,opus_int64 _pos){
static ogg_int64_t op_get_granulepos(const OggOpusFile *_of,
ogg_int64_t _pcm_offset,int *_li){
const OggOpusLink *links;
- ogg_int64_t duration;
+ ogg_int64_t duration = 0;
int nlinks;
int li;
OP_ASSERT(_pcm_offset>=0);
@@ -2166,7 +2161,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
ogg_int64_t _target_gp,int _li){
const OggOpusLink *link;
ogg_page og;
- ogg_int64_t pcm_pre_skip;
+ ogg_int64_t pcm_pre_skip = 0;
ogg_int64_t pcm_start;
ogg_int64_t pcm_end;
ogg_int64_t best_gp;
@@ -2239,7 +2234,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
}
}
else{
- ogg_int64_t prev_page_gp;
+ ogg_int64_t prev_page_gp = 0;
/*We might get lucky and already have the packet with the target
buffered.
Worth checking.
@@ -2289,7 +2284,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
d2=end-begin>>1;
if(force_bisect)bisect=begin+(end-begin>>1);
else{
- ogg_int64_t diff2;
+ ogg_int64_t diff2 = 0;
OP_ALWAYS_TRUE(!op_granpos_diff(&diff,_target_gp,pcm_start));
OP_ALWAYS_TRUE(!op_granpos_diff(&diff2,pcm_end,pcm_start));
/*Take a (pretty decent) guess.*/
@@ -2503,7 +2498,7 @@ static ogg_int64_t op_get_pcm_offset(const OggOpusFile *_of,
ogg_int64_t _gp,int _li){
const OggOpusLink *links;
ogg_int64_t pcm_offset;
- ogg_int64_t delta;
+ ogg_int64_t delta = 0;
int li;
links=_of->links;
pcm_offset=0;
diff --git a/MP/code/opusfile-0.5/src/stream.c b/MP/code/opusfile-0.6/src/stream.c
similarity index 100%
rename from MP/code/opusfile-0.5/src/stream.c
rename to MP/code/opusfile-0.6/src/stream.c
diff --git a/MP/code/opusfile-0.5/src/wincerts.c b/MP/code/opusfile-0.6/src/wincerts.c
similarity index 100%
rename from MP/code/opusfile-0.5/src/wincerts.c
rename to MP/code/opusfile-0.6/src/wincerts.c
diff --git a/MP/code/opusfile-0.5/src/winerrno.h b/MP/code/opusfile-0.6/src/winerrno.h
similarity index 100%
rename from MP/code/opusfile-0.5/src/winerrno.h
rename to MP/code/opusfile-0.6/src/winerrno.h
diff --git a/SP/Makefile b/SP/Makefile
index 07f4d8c..2192493 100644
--- a/SP/Makefile
+++ b/SP/Makefile
@@ -282,7 +282,7 @@ JPDIR=$(MOUNT_DIR)/jpeg-8c
OGGDIR=$(MOUNT_DIR)/libogg-1.3.1
VORBISDIR=$(MOUNT_DIR)/libvorbis-1.3.4
OPUSDIR=$(MOUNT_DIR)/opus-1.1
-OPUSFILEDIR=$(MOUNT_DIR)/opusfile-0.5
+OPUSFILEDIR=$(MOUNT_DIR)/opusfile-0.6
ZDIR=$(MOUNT_DIR)/zlib
SPLDIR=$(MOUNT_DIR)/splines
Q3ASMDIR=$(MOUNT_DIR)/tools/asm
diff --git a/MP/code/opusfile-0.5/include/opusfile.h b/SP/code/opusfile-0.6/include/opusfile.h
similarity index 99%
rename from MP/code/opusfile-0.5/include/opusfile.h
rename to SP/code/opusfile-0.6/include/opusfile.h
index 850cd6b..a31b6c4 100644
--- a/MP/code/opusfile-0.5/include/opusfile.h
+++ b/SP/code/opusfile-0.6/include/opusfile.h
@@ -1453,6 +1453,10 @@ int op_channel_count(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
/**Get the total (compressed) size of the stream, or of an individual link in
a (possibly-chained) Ogg Opus stream, including all headers and Ogg muxing
overhead.
+ \warning If the Opus stream (or link) is concurrently multiplexed with other
+ logical streams (e.g., video), this returns the size of the entire stream
+ (or link), not just the number of bytes in the first logical Opus stream.
+ Returning the latter would require scanning the entire file.
\param _of The \c OggOpusFile from which to retrieve the compressed size.
\param _li The index of the link whose compressed size should be computed.
Use a negative number to get the compressed size of the entire
@@ -1537,13 +1541,22 @@ const OpusTags *op_tags(const OggOpusFile *_of,int _li) OP_ARG_NONNULL(1);
\retval #OP_EINVAL The stream was only partially open.*/
int op_current_link(const OggOpusFile *_of) OP_ARG_NONNULL(1);
-/**Computes the bitrate for a given link in a (possibly chained) Ogg Opus
- stream.
+/**Computes the bitrate of the stream, or of an individual link in a
+ (possibly-chained) Ogg Opus stream.
The stream must be seekable to compute the bitrate.
For unseekable streams, use op_bitrate_instant() to get periodic estimates.
+ \warning If the Opus stream (or link) is concurrently multiplexed with other
+ logical streams (e.g., video), this uses the size of the entire stream (or
+ link) to compute the bitrate, not just the number of bytes in the first
+ logical Opus stream.
+ Returning the latter requires scanning the entire file, but this may be done
+ by decoding the whole file and calling op_bitrate_instant() once at the
+ end.
+ Install a trivial decoding callback with op_set_decode_callback() if you
+ wish to skip actual decoding during this process.
\param _of The \c OggOpusFile from which to retrieve the bitrate.
\param _li The index of the link whose bitrate should be computed.
- USe a negative number to get the bitrate of the whole stream.
+ Use a negative number to get the bitrate of the whole stream.
\return The bitrate on success, or a negative value on error.
\retval #OP_EINVAL The stream was only partially open, the stream was not
seekable, or \a _li was larger than the number of
diff --git a/SP/code/opusfile-0.5/src/http.c b/SP/code/opusfile-0.6/src/http.c
similarity index 100%
rename from SP/code/opusfile-0.5/src/http.c
rename to SP/code/opusfile-0.6/src/http.c
diff --git a/MP/code/opusfile-0.5/src/info.c b/SP/code/opusfile-0.6/src/info.c
similarity index 98%
rename from MP/code/opusfile-0.5/src/info.c
rename to SP/code/opusfile-0.6/src/info.c
index 6cf9851..3134927 100644
--- a/MP/code/opusfile-0.5/src/info.c
+++ b/SP/code/opusfile-0.6/src/info.c
@@ -28,11 +28,13 @@ static int op_parse_int16le(const unsigned char *_data){
}
static opus_uint32 op_parse_uint32le(const unsigned char *_data){
- return _data[0]|_data[1]<<8|_data[2]<<16|_data[3]<<24;
+ return _data[0]|(opus_uint32)_data[1]<<8|
+ (opus_uint32)_data[2]<<16|(opus_uint32)_data[3]<<24;
}
static opus_uint32 op_parse_uint32be(const unsigned char *_data){
- return _data[3]|_data[2]<<8|_data[1]<<16|_data[0]<<24;
+ return _data[3]|(opus_uint32)_data[2]<<8|
+ (opus_uint32)_data[1]<<16|(opus_uint32)_data[0]<<24;
}
int opus_head_parse(OpusHead *_head,const unsigned char *_data,size_t _len){
@@ -259,10 +261,11 @@ int opus_tags_add(OpusTags *_tags,const char *_tag,const char *_value){
_tags->user_comments[ncomments]=comment=
(char *)_ogg_malloc(sizeof(*comment)*(tag_len+value_len+2));
if(OP_UNLIKELY(comment==NULL))return OP_EFAULT;
- _tags->comment_lengths[ncomments]=tag_len+value_len+1;
memcpy(comment,_tag,sizeof(*comment)*tag_len);
comment[tag_len]='=';
memcpy(comment+tag_len+1,_value,sizeof(*comment)*(value_len+1));
+ _tags->comment_lengths[ncomments]=tag_len+value_len+1;
+ _tags->comments=ncomments+1;
return 0;
}
@@ -278,6 +281,7 @@ int opus_tags_add_comment(OpusTags *_tags,const char *_comment){
_tags->user_comments[ncomments]=op_strdup_with_len(_comment,comment_len);
if(OP_UNLIKELY(_tags->user_comments[ncomments]==NULL))return OP_EFAULT;
_tags->comment_lengths[ncomments]=comment_len;
+ _tags->comments=ncomments+1;
return 0;
}
@@ -560,7 +564,7 @@ static int opus_picture_tag_parse_impl(OpusPictureTag *_pic,const char *_tag,
i+=4;
/*If one of these is set, they all must be, but colors==0 is a valid value.*/
colors_set=width!=0||height!=0||depth!=0||colors!=0;
- if(width==0||height==0||depth==0&&colors_set)return OP_ENOTFORMAT;
+ if((width==0||height==0||depth==0)&&colors_set)return OP_ENOTFORMAT;
data_length=op_parse_uint32be(_buf+i);
i+=4;
if(data_length>_buf_sz-i)return OP_ENOTFORMAT;
diff --git a/SP/code/opusfile-0.5/src/internal.c b/SP/code/opusfile-0.6/src/internal.c
similarity index 100%
rename from SP/code/opusfile-0.5/src/internal.c
rename to SP/code/opusfile-0.6/src/internal.c
diff --git a/SP/code/opusfile-0.5/src/internal.h b/SP/code/opusfile-0.6/src/internal.h
similarity index 100%
rename from SP/code/opusfile-0.5/src/internal.h
rename to SP/code/opusfile-0.6/src/internal.h
diff --git a/MP/code/opusfile-0.5/src/opusfile.c b/SP/code/opusfile-0.6/src/opusfile.c
similarity index 99%
rename from MP/code/opusfile-0.5/src/opusfile.c
rename to SP/code/opusfile-0.6/src/opusfile.c
index 392ddb2..e8ce150 100644
--- a/MP/code/opusfile-0.5/src/opusfile.c
+++ b/SP/code/opusfile-0.6/src/opusfile.c
@@ -156,8 +156,8 @@ static int op_get_data(OggOpusFile *_of,int _nbytes){
/*Save a tiny smidge of verbosity to make the code more readable.*/
static int op_seek_helper(OggOpusFile *_of,opus_int64 _offset){
if(_offset==_of->offset)return 0;
- if(_of->callbacks.seek==NULL||
- (*_of->callbacks.seek)(_of->source,_offset,SEEK_SET)){
+ if(_of->callbacks.seek==NULL
+ ||(*_of->callbacks.seek)(_of->source,_offset,SEEK_SET)){
return OP_EREAD;
}
_of->offset=_offset;
@@ -496,30 +496,25 @@ static int op_fetch_headers_impl(OggOpusFile *_of,OpusHead *_head,
ogg_stream_pagein(&_of->os,_og);
if(OP_LIKELY(ogg_stream_packetout(&_of->os,&op)>0)){
ret=opus_head_parse(_head,op.packet,op.bytes);
- /*If it's just a stream type we don't recognize, ignore it.*/
- if(ret==OP_ENOTFORMAT)continue;
- /*Everything else is fatal.*/
- if(OP_UNLIKELY(ret<0))return ret;
/*Found a valid Opus header.
Continue setup.*/
- _of->ready_state=OP_STREAMSET;
+ if(OP_LIKELY(ret>=0))_of->ready_state=OP_STREAMSET;
+ /*If it's just a stream type we don't recognize, ignore it.
+ Everything else is fatal.*/
+ else if(ret!=OP_ENOTFORMAT)return ret;
}
}
/*Get the next page.
No need to clamp the boundary offset against _of->end, as all errors
- become OP_ENOTFORMAT.*/
+ become OP_ENOTFORMAT or OP_EBADHEADER.*/
if(OP_UNLIKELY(op_get_next_page(_of,_og,
OP_ADV_OFFSET(_of->offset,OP_CHUNK_SIZE))<0)){
- return OP_ENOTFORMAT;
- }
- /*If this page also belongs to our Opus stream, submit it and break.*/
- if(_of->ready_state==OP_STREAMSET
- &&_of->os.serialno==ogg_page_serialno(_og)){
- ogg_stream_pagein(&_of->os,_og);
- break;
+ return _of->ready_state<OP_STREAMSET?OP_ENOTFORMAT:OP_EBADHEADER;
}
}
if(OP_UNLIKELY(_of->ready_state!=OP_STREAMSET))return OP_ENOTFORMAT;
+ /*If the first non-header page belonged to our Opus stream, submit it.*/
+ if(_of->os.serialno==ogg_page_serialno(_og))ogg_stream_pagein(&_of->os,_og);
/*Loop getting packets.*/
for(;;){
switch(ogg_stream_packetout(&_of->os,&op)){
@@ -930,7 +925,7 @@ static int op_find_initial_pcm_offset(OggOpusFile *_of,
prev_packet_gp=pcm_start;
for(pi=0;pi<op_count;pi++){
if(cur_page_eos){
- ogg_int64_t diff;
+ ogg_int64_t diff = 0;
OP_ALWAYS_TRUE(!op_granpos_diff(&diff,cur_page_gp,prev_packet_gp));
diff=durations[pi]-diff;
/*If we have samples to trim...*/
@@ -1715,7 +1710,7 @@ opus_int64 op_raw_total(const OggOpusFile *_of,int _li){
ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li){
OggOpusLink *links;
- ogg_int64_t diff;
+ ogg_int64_t diff = 0;
int nlinks;
nlinks=_of->nlinks;
if(OP_UNLIKELY(_of->ready_state<OP_OPENED)
@@ -2114,7 +2109,7 @@ int op_raw_seek(OggOpusFile *_of,opus_int64 _pos){
static ogg_int64_t op_get_granulepos(const OggOpusFile *_of,
ogg_int64_t _pcm_offset,int *_li){
const OggOpusLink *links;
- ogg_int64_t duration;
+ ogg_int64_t duration = 0;
int nlinks;
int li;
OP_ASSERT(_pcm_offset>=0);
@@ -2166,7 +2161,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
ogg_int64_t _target_gp,int _li){
const OggOpusLink *link;
ogg_page og;
- ogg_int64_t pcm_pre_skip;
+ ogg_int64_t pcm_pre_skip = 0;
ogg_int64_t pcm_start;
ogg_int64_t pcm_end;
ogg_int64_t best_gp;
@@ -2239,7 +2234,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
}
}
else{
- ogg_int64_t prev_page_gp;
+ ogg_int64_t prev_page_gp = 0;
/*We might get lucky and already have the packet with the target
buffered.
Worth checking.
@@ -2289,7 +2284,7 @@ static int op_pcm_seek_page(OggOpusFile *_of,
d2=end-begin>>1;
if(force_bisect)bisect=begin+(end-begin>>1);
else{
- ogg_int64_t diff2;
+ ogg_int64_t diff2 = 0;
OP_ALWAYS_TRUE(!op_granpos_diff(&diff,_target_gp,pcm_start));
OP_ALWAYS_TRUE(!op_granpos_diff(&diff2,pcm_end,pcm_start));
/*Take a (pretty decent) guess.*/
@@ -2503,7 +2498,7 @@ static ogg_int64_t op_get_pcm_offset(const OggOpusFile *_of,
ogg_int64_t _gp,int _li){
const OggOpusLink *links;
ogg_int64_t pcm_offset;
- ogg_int64_t delta;
+ ogg_int64_t delta = 0;
int li;
links=_of->links;
pcm_offset=0;
diff --git a/SP/code/opusfile-0.5/src/stream.c b/SP/code/opusfile-0.6/src/stream.c
similarity index 100%
rename from SP/code/opusfile-0.5/src/stream.c
rename to SP/code/opusfile-0.6/src/stream.c
diff --git a/SP/code/opusfile-0.5/src/wincerts.c b/SP/code/opusfile-0.6/src/wincerts.c
similarity index 100%
rename from SP/code/opusfile-0.5/src/wincerts.c
rename to SP/code/opusfile-0.6/src/wincerts.c
diff --git a/SP/code/opusfile-0.5/src/winerrno.h b/SP/code/opusfile-0.6/src/winerrno.h
similarity index 100%
rename from SP/code/opusfile-0.5/src/winerrno.h
rename to SP/code/opusfile-0.6/src/winerrno.h
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list