[xiph-commits] r7065 - icecast/trunk/libshout/src

brendan at dactyl.lonelymoon.com brendan
Fri Jul 9 00:48:16 PDT 2004


Author: brendan
Date: Fri Jul  9 00:48:16 2004
New Revision: 7065

Modified:
icecast/trunk/libshout/src/ogg.c
Log:
Move stray variable declarations to top of functions.


Modified: icecast/trunk/libshout/src/ogg.c
===================================================================
--- icecast/trunk/libshout/src/ogg.c	2004-07-09 07:38:39 UTC (rev 7064)
+++ icecast/trunk/libshout/src/ogg.c	2004-07-09 07:48:16 UTC (rev 7065)
@@ -136,7 +136,7 @@
ogg_data->bos = 1;
}

-			ogg_codec_t *codec = calloc(1, sizeof(ogg_codec_t));
+			codec = calloc(1, sizeof(ogg_codec_t));
if (! codec)
return self->error = SHOUTERR_MALLOC;

@@ -272,6 +272,7 @@
{
ogg_packet packet;
vorbis_data_t *vorbis_data = codec->codec_data;
+	uint64_t samples = 0;

if (codec->headers < 3) {
while (ogg_stream_packetout (&codec->os, &packet) > 0) {
@@ -283,8 +284,6 @@
return SHOUTERR_SUCCESS;
}

-	uint64_t samples = 0;
-
while (ogg_stream_packetout (&codec->os, &packet) > 0)
samples += vorbis_blocksize(vorbis_data, &packet);

@@ -349,6 +348,9 @@
{
theora_data_t *theora_data = codec->codec_data;
ogg_packet packet;
+	double per_frame, duration, new_time;
+	ogg_int64_t granulepos, iframe, pframe;
+	uint64_t frames;

if (ogg_page_granulepos(page) == 0)
{
@@ -365,15 +367,14 @@
return SHOUTERR_SUCCESS;
}

-	double per_frame = (double)theora_data->ti.fps_denominator / theora_data->ti.fps_numerator * 1000000;
-	double duration;
-	ogg_int64_t granulepos = ogg_page_granulepos(page);
+	per_frame = (double)theora_data->ti.fps_denominator / theora_data->ti.fps_numerator * 1000000;
+	granulepos = ogg_page_granulepos(page);

if (granulepos > 0) {
-		ogg_int64_t iframe = granulepos >> theora_data->granule_shift;
-		ogg_int64_t pframe = granulepos - (iframe << theora_data->granule_shift);
-		uint64_t frames = iframe + pframe;
-		double new_time = (frames  * per_frame);
+		iframe = granulepos >> theora_data->granule_shift;
+		pframe = granulepos - (iframe << theora_data->granule_shift);
+		frames = iframe + pframe;
+		new_time = (frames  * per_frame);

duration = new_time - theora_data->prev_time;
theora_data->prev_time = new_time;
@@ -396,6 +397,7 @@
static int theora_ilog(unsigned int v)
{
int ret = 0;
+
while (v) {
ret++;
v >>= 1;



More information about the commits mailing list