Commit 097fbd29 authored by giles's avatar giles

Remove trailing whitespace.


git-svn-id: http://svn.annodex.net/liboggz/trunk@3764 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 15c4d8a3
......@@ -170,6 +170,7 @@ auto_theora (OGGZ * oggz, long serialno, unsigned char * data, long length, void
OGGZ_AUTO_MULT * (ogg_int64_t)fps_denominator);
oggz_set_granuleshift (oggz, serialno, keyframe_shift);
oggz_stream_set_numheaders (oggz, serialno, 3);
return 1;
......@@ -212,12 +213,12 @@ auto_flac0 (OGGZ * oggz, long serialno, unsigned char * data, long length, void
unsigned char * header = data;
ogg_int64_t granule_rate = 0;
granule_rate = (ogg_int64_t) (header[14] << 12) | (header[15] << 4) |
granule_rate = (ogg_int64_t) (header[14] << 12) | (header[15] << 4) |
((header[16] >> 4)&0xf);
#ifdef DEBUG
printf ("Got flac rate %d\n", (int)granule_rate);
#endif
oggz_set_granulerate (oggz, serialno, granule_rate, OGGZ_AUTO_MULT);
oggz_stream_set_numheaders (oggz, serialno, 3);
......@@ -234,7 +235,7 @@ auto_flac (OGGZ * oggz, long serialno, unsigned char * data, long length, void *
if (length < 51) return 0;
granule_rate = (ogg_int64_t) (header[27] << 12) | (header[28] << 4) |
granule_rate = (ogg_int64_t) (header[27] << 12) | (header[28] << 4) |
((header[29] >> 4)&0xf);
#ifdef DEBUG
printf ("Got flac rate %d\n", (int)granule_rate);
......@@ -349,7 +350,7 @@ auto_kate (OGGZ * oggz, long serialno, unsigned char * data, long length, void *
oggz_set_granulerate (oggz, serialno, gps_numerator,
OGGZ_AUTO_MULT * gps_denominator);
oggz_set_granuleshift (oggz, serialno, granule_shift);
oggz_stream_set_numheaders (oggz, serialno, numheaders);
return 1;
......@@ -369,7 +370,7 @@ auto_dirac (OGGZ * oggz, long serialno, unsigned char * data, long length, void
/*
FIXME: where is this in Ogg Dirac?
keyframe_granule_shift = (char) ((header[40] & 0x03) << 3);
keyframe_granule_shift |= (header[41] & 0xe0) >> 5;
keyframe_granule_shift |= (header[41] & 0xe0) >> 5;
*/
keyframe_shift = keyframe_granule_shift;
......@@ -421,7 +422,7 @@ auto_fisbone (OGGZ * oggz, long serialno, unsigned char * data, long length, voi
/* Increment the number of headers for this stream */
numheaders = oggz_stream_get_numheaders (oggz, serialno);
oggz_stream_set_numheaders (oggz, serialno, numheaders+1);
return 1;
}
......@@ -432,7 +433,7 @@ auto_fishead (OGGZ * oggz, long serialno, unsigned char * data, long length, voi
/* For skeleton, numheaders will get incremented as each header is seen */
oggz_stream_set_numheaders (oggz, serialno, 1);
return 1;
}
......@@ -446,27 +447,27 @@ typedef struct {
int encountered_first_data_packet;
} auto_calc_speex_info_t;
static ogg_int64_t
static ogg_int64_t
auto_calc_speex(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
/*
* on the first (b_o_s) packet, set calculate_data to be the number
* of speex frames per packet
*/
auto_calc_speex_info_t *info
auto_calc_speex_info_t *info
= (auto_calc_speex_info_t *)stream->calculate_data;
if (stream->calculate_data == NULL) {
stream->calculate_data = malloc(sizeof(auto_calc_speex_info_t));
info = stream->calculate_data;
info->encountered_first_data_packet = 0;
info->packet_size =
info->packet_size =
(*(int *)(op->packet + 64)) * (*(int *)(op->packet + 56));
info->headers_encountered = 1;
return 0;
}
if (info->headers_encountered < 2) {
info->headers_encountered += 1;
} else {
......@@ -481,7 +482,7 @@ auto_calc_speex(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
if (stream->last_granulepos > 0) {
return stream->last_granulepos + info->packet_size;
}
return -1;
}
......@@ -499,15 +500,15 @@ typedef struct {
int encountered_first_data_packet;
} auto_calc_celt_info_t;
static ogg_int64_t
static ogg_int64_t
auto_calc_celt (ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
/*
* on the first (b_o_s) packet, set calculate_data to be the number
* of celt frames per packet
*/
auto_calc_celt_info_t *info
auto_calc_celt_info_t *info
= (auto_calc_celt_info_t *)stream->calculate_data;
if (stream->calculate_data == NULL) {
......@@ -524,7 +525,7 @@ auto_calc_celt (ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
info->headers_encountered = 1;
return 0;
}
if (info->headers_encountered < 2) {
info->headers_encountered += 1;
} else {
......@@ -539,7 +540,7 @@ auto_calc_celt (ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
if (stream->last_granulepos > 0) {
return stream->last_granulepos + info->packet_size;
}
return -1;
}
......@@ -550,8 +551,8 @@ auto_calc_celt (ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
* Header packets are marked by a set MSB in the first byte. Inter packets
* are marked by a set 2MSB in the first byte. Intra packets (keyframes)
* are any that are left over ;-)
*
* (see http://www.theora.org/doc/Theora_I_spec.pdf for the theora
*
* (see http://www.theora.org/doc/Theora_I_spec.pdf for the theora
* specification)
*/
......@@ -560,7 +561,7 @@ typedef struct {
} auto_calc_theora_info_t;
static ogg_int64_t
static ogg_int64_t
auto_calc_theora(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
long keyframe_no;
......@@ -582,7 +583,7 @@ auto_calc_theora(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
info->encountered_first_data_packet = 0;
return (ogg_int64_t)0;
}
/* known granulepos */
if (now > (ogg_int64_t)(-1)) {
info->encountered_first_data_packet = 1;
......@@ -609,7 +610,7 @@ auto_calc_theora(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
return stream->last_granulepos + 1;
}
keyframe_shift = stream->granuleshift;
keyframe_shift = stream->granuleshift;
/*
* retrieve last keyframe number
*/
......@@ -619,12 +620,12 @@ auto_calc_theora(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
*/
keyframe_no += (stream->last_granulepos & ((1 << keyframe_shift) - 1)) + 1;
return ((ogg_int64_t)keyframe_no) << keyframe_shift;
}
static ogg_int64_t
auto_rcalc_theora(ogg_int64_t next_packet_gp, oggz_stream_t *stream,
auto_rcalc_theora(ogg_int64_t next_packet_gp, oggz_stream_t *stream,
ogg_packet *this_packet, ogg_packet *next_packet) {
int keyframe = (int)(next_packet_gp >> stream->granuleshift);
......@@ -665,9 +666,9 @@ auto_rcalc_theora(ogg_int64_t next_packet_gp, oggz_stream_t *stream,
* (additional information is not required)
*
* The two blocksizes can be determined from the first header packet, by reading
* byte 28. 1 << (packet[28] >> 4) == long_size.
* byte 28. 1 << (packet[28] >> 4) == long_size.
* 1 << (packet[28] & 0xF) == short_size.
*
*
* (see http://xiph.org/vorbis/doc/Vorbis_I_spec.html for specification)
*/
......@@ -681,13 +682,13 @@ typedef struct {
int log2_num_modes;
int mode_sizes[1];
} auto_calc_vorbis_info_t;
static ogg_int64_t
static ogg_int64_t
auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
auto_calc_vorbis_info_t *info;
if (stream->calculate_data == NULL) {
/*
* on the first (b_o_s) packet, determine the long and short sizes,
......@@ -695,7 +696,7 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
*/
int short_size;
int long_size;
long_size = 1 << (op->packet[28] >> 4);
short_size = 1 << (op->packet[28] & 0xF);
......@@ -721,10 +722,10 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
/*
* the code pages, a whole bunch of other fairly useless stuff, AND,
* RIGHT AT THE END (of a bunch of variable-length compressed rubbish that
* basically has only one actual set of values that everyone uses BUT YOU
* basically has only one actual set of values that everyone uses BUT YOU
* CAN'T BE SURE OF THAT, OH NO YOU CAN'T) is the only piece of data that's
* actually useful to us - the packet modes (because it's inconceivable to
* think people might want _just that_ and nothing else, you know, for
* think people might want _just that_ and nothing else, you know, for
* seeking and stuff).
*
* Fortunately, because of the mandate that non-used bits must be zero
......@@ -739,11 +740,11 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
int size_check;
int *mode_size_ptr;
int i;
/*
/*
* This is the format of the mode data at the end of the packet for all
* Vorbis Version 1 :
*
*
* [ 6:number_of_modes ]
* [ 1:size | 16:window_type(0) | 16:transform_type(0) | 8:mapping ]
* [ 1:size | 16:window_type(0) | 16:transform_type(0) | 8:mapping ]
......@@ -756,7 +757,7 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
* 0 0 0 0 0 1 0 0
* 0 0 1 0 0 0 0 0
* 0 0 1 0 0 0 0 0
* 0 0 1|0 0 0 0 0
* 0 0 1|0 0 0 0 0
* 0 0 0 0|0|0 0 0
* 0 0 0 0 0 0 0 0
* 0 0 0 0|0 0 0 0
......@@ -766,11 +767,11 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
* 0 0 0 0 0 0 0 0 V
* 0 0 0|0 0 0 0 0
* 0 0 0 0 0 0 0 0
* 0 0 1|0 0 0 0 0
* 0 0|1|0 0 0 0 0
*
*
* i.e. each entry is an important bit, 32 bits of 0, 8 bits of blah, a
* 0 0 1|0 0 0 0 0
* 0 0|1|0 0 0 0 0
*
*
* i.e. each entry is an important bit, 32 bits of 0, 8 bits of blah, a
* bit of 1.
* Let's find our last 1 bit first.
*
......@@ -788,7 +789,7 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
while (1)
{
/*
* from current_pos-5:(offset+1) to current_pos-1:(offset+1) should
* be zero
......@@ -796,15 +797,15 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
offset = (offset + 7) % 8;
if (offset == 7)
current_pos -= 1;
if
if
(
((current_pos[-5] & ~((1 << (offset + 1)) - 1)) != 0)
||
current_pos[-4] != 0
||
current_pos[-3] != 0
||
current_pos[-4] != 0
||
current_pos[-3] != 0
||
current_pos[-2] != 0
||
((current_pos[-1] & ((1 << (offset + 1)) - 1)) != 0)
......@@ -812,12 +813,12 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
{
break;
}
size += 1;
current_pos -= 5;
}
}
if (offset > 4) {
size_check = (current_pos[0] >> (offset - 5)) & 0x3F;
......@@ -827,10 +828,10 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
/* shift to appropriate position */
size_check <<= (5 - offset);
/* or in part of byte from current_pos - 1 */
size_check |= (current_pos[-1] & ~((1 << (offset + 3)) - 1)) >>
size_check |= (current_pos[-1] & ~((1 << (offset + 3)) - 1)) >>
(offset + 3);
}
size_check += 1;
if (size_check != size)
{
......@@ -843,7 +844,7 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
stream->calculate_data = realloc(stream->calculate_data,
sizeof(auto_calc_vorbis_info_t) + (size - 1) * sizeof(int));
info = (auto_calc_vorbis_info_t *)(stream->calculate_data);
i = -1;
while ((1 << (++i)) < size);
info->log2_num_modes = i;
......@@ -858,9 +859,9 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
*mode_size_ptr++ = (current_pos[0] >> offset) & 0x1;
current_pos += 5;
}
}
return 0;
}
......@@ -868,7 +869,7 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
return -1;
{
{
/*
* we're in a data packet! First we need to get the mode of the packet,
* and from the mode, the size
......@@ -879,7 +880,7 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
mode = (op->packet[0] >> 1) & ((1 << info->log2_num_modes) - 1);
size = info->mode_sizes[mode];
/*
* if we have a working granulepos, we use it, but only if we can't
* calculate a valid gp value.
......@@ -905,28 +906,28 @@ auto_calc_vorbis(ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op) {
return -1;
}
result = stream->last_granulepos +
result = stream->last_granulepos +
(
(info->last_was_long ? info->long_size : info->short_size)
+
(info->last_was_long ? info->long_size : info->short_size)
+
(size ? info->long_size : info->short_size)
) / 4;
info->last_was_long = size;
return result;
}
}
ogg_int64_t
auto_rcalc_vorbis(ogg_int64_t next_packet_gp, oggz_stream_t *stream,
ogg_packet *this_packet, ogg_packet *next_packet) {
auto_calc_vorbis_info_t *info =
auto_calc_vorbis_info_t *info =
(auto_calc_vorbis_info_t *)stream->calculate_data;
int mode =
int mode =
(this_packet->packet[0] >> 1) & ((1 << info->log2_num_modes) - 1);
int this_size = info->mode_sizes[mode] ? info->long_size : info->short_size;
int next_size;
......@@ -961,7 +962,7 @@ typedef struct {
int encountered_first_data_packet;
} auto_calc_flac_info_t;
static ogg_int64_t
static ogg_int64_t
auto_calc_flac (ogg_int64_t now, oggz_stream_t *stream, ogg_packet *op)
{
auto_calc_flac_info_t *info;
......@@ -1072,26 +1073,26 @@ const oggz_auto_contenttype_t oggz_auto_codec_ident[] = {
{"\200kate\0\0\0", 8, "Kate", auto_kate, NULL, NULL},
{"BBCD\0", 5, "Dirac", auto_dirac, NULL, NULL},
{"", 0, "Unknown", NULL, NULL, NULL}
};
};
static int
oggz_auto_identify (OGGZ * oggz, long serialno, unsigned char * data, long len)
{
int i;
for (i = 0; i < OGGZ_CONTENT_UNKNOWN; i++)
{
const oggz_auto_contenttype_t *codec = oggz_auto_codec_ident + i;
if (len >= codec->bos_str_len &&
memcmp (data, codec->bos_str, codec->bos_str_len) == 0) {
oggz_stream_set_content (oggz, serialno, i);
return 1;
}
}
oggz_stream_set_content (oggz, serialno, OGGZ_CONTENT_UNKNOWN);
return 0;
}
......@@ -1125,7 +1126,7 @@ oggz_auto_read_bos_page (OGGZ * oggz, ogg_page * og, long serialno,
}
int
oggz_auto_read_bos_packet (OGGZ * oggz, ogg_packet * op, long serialno,
oggz_auto_read_bos_packet (OGGZ * oggz, ogg_packet * op, long serialno,
void * user_data)
{
int content = 0;
......@@ -1140,13 +1141,13 @@ oggz_auto_read_bos_packet (OGGZ * oggz, ogg_packet * op, long serialno,
}
}
ogg_int64_t
oggz_auto_calculate_granulepos(int content, ogg_int64_t now,
ogg_int64_t
oggz_auto_calculate_granulepos(int content, ogg_int64_t now,
oggz_stream_t *stream, ogg_packet *op) {
if (oggz_auto_codec_ident[content].calculator != NULL) {
ogg_int64_t r = oggz_auto_codec_ident[content].calculator(now, stream, op);
return r;
}
}
return now;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment