[xiph-cvs] cvs commit: vorbis-tools/ogg123 buffer.c http_transport.c ogg123.c
Stan Seibert
volsung at xiph.org
Tue Dec 18 21:37:34 PST 2001
volsung 01/12/18 21:37:34
Modified: ogg123 buffer.c http_transport.c ogg123.c
Log:
More buffer status fixes. Took out my DEBUG_BUFFER symbol and put back
the audio buffering.
Revision Changes Path
1.12 +1 -3 vorbis-tools/ogg123/buffer.c
Index: buffer.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/buffer.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- buffer.c 2001/12/19 04:59:16 1.11
+++ buffer.c 2001/12/19 05:37:32 1.12
@@ -11,7 +11,7 @@
* *
********************************************************************
- last mod: $Id: buffer.c,v 1.11 2001/12/19 04:59:16 volsung Exp $
+ last mod: $Id: buffer.c,v 1.12 2001/12/19 05:37:32 volsung Exp $
********************************************************************/
@@ -31,8 +31,6 @@
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MIN3(x,y,z) MIN(x,MIN(y,z))
#define MIN4(w,x,y,z) MIN( MIN(w,x), MIN(y,z) )
-
-#define DEBUG_BUFFER
/* Special debugging code. THIS IS NOT PORTABLE! */
#ifdef DEBUG_BUFFER
1.4 +33 -5 vorbis-tools/ogg123/http_transport.c
Index: http_transport.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/http_transport.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- http_transport.c 2001/12/19 04:59:16 1.3
+++ http_transport.c 2001/12/19 05:37:32 1.4
@@ -11,7 +11,7 @@
* *
********************************************************************
- last mod: $Id: http_transport.c,v 1.3 2001/12/19 04:59:16 volsung Exp $
+ last mod: $Id: http_transport.c,v 1.4 2001/12/19 05:37:32 volsung Exp $
********************************************************************/
@@ -27,9 +27,12 @@
#include "transport.h"
#include "buffer.h"
#include "status.h"
+#include "callbacks.h"
#define INPUT_BUFFER_SIZE 32768
+extern stat_format_t *stat_format; /* Bad hack! Will fix after RC3! */
+
typedef struct http_private_t {
buf_t *buf;
@@ -62,11 +65,28 @@
return size * nmemb;
}
+int progress_callback (void *arg, size_t dltotal, size_t dlnow,
+ size_t ultotal, size_t ulnow)
+{
+ data_source_t *source = arg;
+ print_statistics_arg_t *pstats_arg;
+
+ pstats_arg = new_print_statistics_arg(stat_format,
+ source->transport->statistics(source),
+ NULL);
+
+ print_statistics_action(NULL, pstats_arg);
+
+ return 0;
+}
+
/* -------------------------- Private functions --------------------- */
-void set_curl_opts (CURL *handle, buf_t *buf, char *url, http_private_t *priv)
+void set_curl_opts (CURL *handle, buf_t *buf, char *url, data_source_t *source)
{
+ http_private_t *private = (http_private_t *) source;
+
curl_easy_setopt(handle, CURLOPT_FILE, buf);
curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(handle, CURLOPT_URL, url);
@@ -79,8 +99,10 @@
curl_easy_setopt (handle, CURLOPT_HTTPPROXYTUNNEL, inputOpts.ProxyTunnel);
*/
curl_easy_setopt(handle, CURLOPT_MUTE, 1);
- curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, priv->error);
- curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 1);
+ curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, private->error);
+ curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, progress_callback);
+ curl_easy_setopt(handle, CURLOPT_PROGRESSDATA, source);
+ //curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(handle, CURLOPT_USERAGENT, "ogg123 "VERSION);
}
@@ -188,7 +210,7 @@
if (private->curl_handle == NULL)
goto fail;
- set_curl_opts(private->curl_handle, private->buf, source_string, private);
+ set_curl_opts(private->curl_handle, private->buf, source_string, source);
/* Start thread */
if (pthread_create(&private->curl_thread, NULL,
@@ -196,6 +218,12 @@
new_curl_thread_arg(private->buf, source,
private->curl_handle)) != 0)
goto fail;
+
+
+ stat_format[2].enabled = 0; /* remaining playback time */
+ stat_format[3].enabled = 0; /* total playback time */
+ stat_format[6].enabled = 1; /* Input buffer fill % */
+ stat_format[7].enabled = 1; /* Input buffer state */
return source;
1.52 +2 -2 vorbis-tools/ogg123/ogg123.c
Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- ogg123.c 2001/12/19 04:59:16 1.51
+++ ogg123.c 2001/12/19 05:37:32 1.52
@@ -14,7 +14,7 @@
* *
********************************************************************
- last mod: $Id: ogg123.c,v 1.51 2001/12/19 04:59:16 volsung Exp $
+ last mod: $Id: ogg123.c,v 1.52 2001/12/19 05:37:32 volsung Exp $
********************************************************************/
@@ -130,7 +130,7 @@
opts->nth = 1;
opts->ntimes = 1;
opts->seekpos = 0.0;
- opts->buffer_size = 0; //128 * 1024;
+ opts->buffer_size = 128 * 1024;
opts->prebuffer = 0.0f;
opts->input_buffer_size = 32 * 1024;
opts->input_prebuffer = 50.0f;
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list