[xiph-cvs] cvs commit: vorbis-tools/ogg123 audio.c audio.h buffer.c callbacks.c ogg123.c oggvorbis_format.c status.c
Stan Seibert
volsung at xiph.org
Wed Dec 12 07:52:27 PST 2001
volsung 01/12/12 07:52:27
Modified: ogg123 Tag: volsung_kc_20011011 audio.c audio.h buffer.c
callbacks.c ogg123.c oggvorbis_format.c status.c
Log:
More statistics printing updates.
Revision Changes Path
No revision
No revision
1.1.2.5 +1 -3 vorbis-tools/ogg123/Attic/audio.c
Index: audio.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Attic/audio.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- audio.c 2001/12/11 18:46:22 1.1.2.4
+++ audio.c 2001/12/12 15:52:24 1.1.2.5
@@ -11,7 +11,7 @@
* *
********************************************************************
- last mod: $Id: audio.c,v 1.1.2.4 2001/12/11 18:46:22 volsung Exp $
+ last mod: $Id: audio.c,v 1.1.2.5 2001/12/12 15:52:24 volsung Exp $
********************************************************************/
@@ -59,9 +59,7 @@
int audio_devices_write(audio_device_t *d, void *ptr, int nbytes)
{
- audio_device_t *start = d;
- d = start;
while (d != NULL) {
if (ao_play(d->device, ptr, nbytes) == 0)
return 0; /* error occurred */
1.1.2.4 +2 -1 vorbis-tools/ogg123/Attic/audio.h
Index: audio.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Attic/audio.h,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- audio.h 2001/12/11 18:46:22 1.1.2.3
+++ audio.h 2001/12/12 15:52:24 1.1.2.4
@@ -11,7 +11,7 @@
* *
********************************************************************
- last mod: $Id: audio.h,v 1.1.2.3 2001/12/11 18:46:22 volsung Exp $
+ last mod: $Id: audio.h,v 1.1.2.4 2001/12/12 15:52:24 volsung Exp $
********************************************************************/
@@ -46,6 +46,7 @@
audio_device_t *append_audio_device(audio_device_t *devices_list,
int driver_id,
ao_option *options, char *filename);
+void audio_devices_print_info(audio_device_t *d);
int audio_devices_write(audio_device_t *d, void *ptr, int nbytes);
int add_ao_option(ao_option **op_h, const char *optstring);
void close_audio_devices (audio_device_t *devices);
1.7.2.23.2.9 +2 -2 vorbis-tools/ogg123/buffer.c
Index: buffer.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/buffer.c,v
retrieving revision 1.7.2.23.2.8
retrieving revision 1.7.2.23.2.9
diff -u -r1.7.2.23.2.8 -r1.7.2.23.2.9
--- buffer.c 2001/12/12 04:29:35 1.7.2.23.2.8
+++ buffer.c 2001/12/12 15:52:24 1.7.2.23.2.9
@@ -11,7 +11,7 @@
* *
********************************************************************
- last mod: $Id: buffer.c,v 1.7.2.23.2.8 2001/12/12 04:29:35 volsung Exp $
+ last mod: $Id: buffer.c,v 1.7.2.23.2.9 2001/12/12 15:52:24 volsung Exp $
********************************************************************/
@@ -674,7 +674,7 @@
stats = malloc_buffer_stats();
stats->size = buf->size;
- stats->fill = (double) buf->curfill / (double) buf->size;
+ stats->fill = (double) buf->curfill / (double) buf->size * 100.0;
stats->prebuffering = buf->prebuffering;
stats->paused = buf->paused;
stats->eos = buf->eos;
1.1.2.2 +3 -7 vorbis-tools/ogg123/Attic/callbacks.c
Index: callbacks.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Attic/callbacks.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- callbacks.c 2001/12/11 18:46:22 1.1.2.1
+++ callbacks.c 2001/12/12 15:52:25 1.1.2.2
@@ -11,7 +11,7 @@
* *
********************************************************************
- last mod: $Id: callbacks.c,v 1.1.2.1 2001/12/11 18:46:22 volsung Exp $
+ last mod: $Id: callbacks.c,v 1.1.2.2 2001/12/12 15:52:25 volsung Exp $
********************************************************************/
@@ -56,11 +56,7 @@
while (current != NULL) {
ao_info *info = ao_driver_info(current->driver_id);
-
- status_message(2, "\nDevice: %s", info->name);
- status_message(2, "Author: %s", info->author);
- status_message(2, "Comments: %s\n", info->comment);
-
+
if (current->filename == NULL)
current->device = ao_open_live(current->driver_id, &format,
current->options);
@@ -86,7 +82,7 @@
info->short_name);
break;
case AO_EFAIL:
- status_error("Error: Device failure.\n");
+ status_error("Error: Device %s failure.\n", info->short_name);
break;
case AO_ENOTFILE:
status_error("Error: An output file cannot be given for %s device.\n", info->short_name);
1.39.2.30.2.18 +57 -3 vorbis-tools/ogg123/ogg123.c
Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.39.2.30.2.17
retrieving revision 1.39.2.30.2.18
diff -u -r1.39.2.30.2.17 -r1.39.2.30.2.18
--- ogg123.c 2001/12/12 04:29:35 1.39.2.30.2.17
+++ ogg123.c 2001/12/12 15:52:25 1.39.2.30.2.18
@@ -14,7 +14,7 @@
* *
********************************************************************
- last mod: $Id: ogg123.c,v 1.39.2.30.2.17 2001/12/12 04:29:35 volsung Exp $
+ last mod: $Id: ogg123.c,v 1.39.2.30.2.18 2001/12/12 15:52:25 volsung Exp $
********************************************************************/
@@ -144,9 +144,58 @@
opts->prebuffer = 0.0f;
opts->default_device = NULL;
- opts->status_freq = 4;
+ opts->status_freq = 10.0;
}
+
+/* This function selects which statistics to display for our
+ particular configuration. This does not have anything to do with
+ verbosity, but rather with which stats make sense to display. */
+void select_stats (stat_format_t *stats, ogg123_options_t *opts,
+ data_source_t *source, decoder_t *decoder,
+ buf_t *audio_buffer)
+{
+ data_source_stats_t *data_source_stats;
+
+ if (audio_buffer != NULL) {
+ /* Turn on output buffer stats */
+ stats[8].enabled = 1; /* Fill */
+ stats[9].enabled = 1; /* State */
+ } else {
+ stats[8].enabled = 0;
+ stats[9].enabled = 0;
+ }
+
+ data_source_stats = source->transport->statistics(source);
+ if (data_source_stats->input_buffer_used) {
+ /* Turn on input buffer stats */
+ stats[6].enabled = 1; /* Fill */
+ stats[7].enabled = 1; /* State */
+ } else {
+ stats[6].enabled = 0;
+ stats[7].enabled = 0;
+ }
+
+ /* Put logic here to decide if this stream needs a total time display */
+}
+
+void print_audio_devices_info(audio_device_t *d)
+{
+ ao_info *info;
+
+ while (d != NULL) {
+ info = ao_driver_info(d->driver_id);
+
+ status_message(2, "\nDevice: %s", info->name);
+ status_message(2, "Author: %s", info->author);
+ status_message(2, "Comments: %s\n", info->comment);
+
+ d = d->next_device;
+ }
+
+}
+
+
/* ----------------------------- callbacks ------------------------------ */
void decoder_error_callback (void *arg, int severity, char *message, ...)
@@ -186,10 +235,12 @@
audio_play_arg.devices = options.devices;
audio_play_arg.stat_format = stat_format;
-
+ /* Don't use status_message until after this point! */
status_set_verbosity(options.verbosity);
+ print_audio_devices_info(options.devices);
+
/* Setup signal handlers and callbacks */
ATEXIT (exit_cleanup);
@@ -295,6 +346,9 @@
format->name);
return;
}
+
+ /* Decide which statistics are valid */
+ select_stats(stat_format, &options, source, decoder, audio_buffer);
/* Reset all of the signal flags and setup the timer */
1.1.2.5 +14 -14 vorbis-tools/ogg123/Attic/oggvorbis_format.c
Index: oggvorbis_format.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Attic/oggvorbis_format.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- oggvorbis_format.c 2001/12/11 18:46:23 1.1.2.4
+++ oggvorbis_format.c 2001/12/12 15:52:25 1.1.2.5
@@ -11,7 +11,7 @@
* *
********************************************************************
- last mod: $Id: oggvorbis_format.c,v 1.1.2.4 2001/12/11 18:46:23 volsung Exp $
+ last mod: $Id: oggvorbis_format.c,v 1.1.2.5 2001/12/12 15:52:25 volsung Exp $
********************************************************************/
@@ -45,18 +45,18 @@
char *key; /* includes the '=' for programming convenience */
char *formatstr; /* formatted output */
} vorbis_comment_keys[] = {
- {"ARTIST=", "Artist: %s\n"},
- {"ALBUM=", "Album: %s\n"},
- {"TITLE=", "Title: %s\n"},
- {"VERSION=", "Version: %s\n"},
- {"TRACKNUMBER=", "Track number: %s\n"},
- {"ORGANIZATION=", "Organization: %s\n"},
- {"GENRE=", "Genre: %s\n"},
- {"DESCRIPTION=", "Description: %s\n"},
- {"DATE=", "Date: %s\n"},
- {"LOCATION=", "Location: %s\n"},
- {"COPYRIGHT=", "Copyright %s\n"},
- {NULL, "Comment: %s\n"}
+ {"ARTIST=", "Artist: %s"},
+ {"ALBUM=", "Album: %s"},
+ {"TITLE=", "Title: %s"},
+ {"VERSION=", "Version: %s"},
+ {"TRACKNUMBER=", "Track number: %s"},
+ {"ORGANIZATION=", "Organization: %s"},
+ {"GENRE=", "Genre: %s"},
+ {"DESCRIPTION=", "Description: %s"},
+ {"DATE=", "Date: %s"},
+ {"LOCATION=", "Location: %s"},
+ {"COPYRIGHT=", "Copyright %s"},
+ {NULL, "Comment: %s"}
};
@@ -348,7 +348,7 @@
priv->vi->channels,
priv->vi->rate);
- cb->printf_metadata(decoder->callback_arg, 2,
+ cb->printf_metadata(decoder->callback_arg, 3,
"Encoded by: %s", priv->vc->vendor);
}
1.1.2.7.2.7 +7 -4 vorbis-tools/ogg123/Attic/status.c
Index: status.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Attic/status.c,v
retrieving revision 1.1.2.7.2.6
retrieving revision 1.1.2.7.2.7
diff -u -r1.1.2.7.2.6 -r1.1.2.7.2.7
--- status.c 2001/12/11 18:46:23 1.1.2.7.2.6
+++ status.c 2001/12/12 15:52:25 1.1.2.7.2.7
@@ -11,7 +11,7 @@
* *
********************************************************************
- last mod: $Id: status.c,v 1.1.2.7.2.6 2001/12/11 18:46:23 volsung Exp $
+ last mod: $Id: status.c,v 1.1.2.7.2.7 2001/12/12 15:52:25 volsung Exp $
********************************************************************/
@@ -229,9 +229,10 @@
if (cur->arg.stringarg == NULL) {
fprintf(stderr, "Memory allocation error in stats_init()\n");
exit(1);
- }
+ }
+ write_time_string(cur->arg.stringarg, 0.0);
-
+
cur = stats + 2; /* remaining playback time (preformatted) */
cur->verbosity = 1;
cur->enabled = 1;
@@ -243,6 +244,7 @@
fprintf(stderr, "Memory allocation error in stats_init()\n");
exit(1);
}
+ write_time_string(cur->arg.stringarg, 0.0);
cur = stats + 3; /* total playback time (preformatted) */
@@ -256,6 +258,7 @@
fprintf(stderr, "Memory allocation error in stats_init()\n");
exit(1);
}
+ write_time_string(cur->arg.stringarg, 0.0);
cur = stats + 4; /* instantaneous bitrate */
@@ -357,7 +360,7 @@
already doing output, we skip it. */
if (pthread_mutex_trylock(&output_lock) == 0) {
- if (decoder_statistics) {
+ if (decoder_statistics != NULL) {
/* Current playback time */
write_time_string(stats[1].arg.stringarg,
decoder_statistics->current_time);
--- >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