/* Copyright (c) 2011 Xiph.Org Foundation
Written by Jean-Marc Valin */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* set padding length to zero for all but the first frame */ while (curr_nb_frames > 1)
{
rp->nb_frames++;
rp->padding_len[rp->nb_frames] = 0;
rp->paddings[rp->nb_frames] = NULL;
curr_nb_frames--;
}
rp->nb_frames++; return OPUS_OK;
}
int opus_repacketizer_get_nb_frames(OpusRepacketizer *rp)
{ return rp->nb_frames;
}
opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsignedchar *data, opus_int32 maxlen, int self_delimited, int pad, const opus_extension_data *extensions, int nb_extensions)
{ int i, count;
opus_int32 tot_size;
opus_int16 *len; constunsignedchar **frames; unsignedchar * ptr; int ones_begin=0, ones_end=0; int ext_begin=0, ext_len=0; int ext_count, total_ext_count;
VARDECL(opus_extension_data, all_extensions);
SAVE_STACK;
len = rp->len+begin;
frames = rp->frames+begin; if (self_delimited)
tot_size = 1 + (len[count-1]>=252); else
tot_size = 0;
/* figure out total number of extensions */
total_ext_count = nb_extensions; for (i=begin;i<end;i++)
{ int n = opus_packet_extensions_count(rp->paddings[i], rp->padding_len[i]); if (n > 0) total_ext_count += n;
}
ALLOC(all_extensions, total_ext_count ? total_ext_count : ALLOC_NONE, opus_extension_data); /* copy over any extensions that were passed in */ for (ext_count=0;ext_count<nb_extensions;ext_count++)
{
all_extensions[ext_count] = extensions[ext_count];
}
/* incorporate any extensions from the repacketizer padding */ for (i=begin;i<end;i++)
{ int j;
opus_int32 frame_ext_count;
frame_ext_count = total_ext_count - ext_count; int ret = opus_packet_extensions_parse(rp->paddings[i], rp->padding_len[i],
&all_extensions[ext_count], &frame_ext_count); if (ret<0)
{
RESTORE_STACK; return OPUS_INTERNAL_ERROR;
} /* renumber the extension frame numbers */ for (j=0;j<frame_ext_count;j++)
{
all_extensions[ext_count+j].frame += i-begin;
}
ext_count += frame_ext_count;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.