changeset 1387:20c6caad7e03

Fixed the play/stop indication; added a temporary workaround for including the last 3 seconds in playback
author Calin Crisan ccrisan@gmail.com
date Fri, 27 Jul 2007 21:59:26 +0300
parents b8dd67ad7b86
children eb6c11de9f33
files src/cdaudio-ng/cdaudio-ng.c
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/cdaudio-ng/cdaudio-ng.c	Fri Jul 27 18:56:43 2007 +0900
+++ b/src/cdaudio-ng/cdaudio-ng.c	Fri Jul 27 21:59:26 2007 +0300
@@ -1,8 +1,3 @@
-
-/*
-	todo:
-		- about dialog
-*/
 
 #include <string.h>
 #include <stdlib.h>
@@ -479,6 +474,11 @@
 	playing_track = trackno;
 	is_paused = FALSE;
 
+	char *title = xmms_get_titlestring(xmms_get_gentitle_format(), create_tuple_from_trackinfo(pinputplayback->filename));
+
+	inputplugin.set_info(title, calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn), 128000, 44100, 2);
+	free(title);
+
 	if (use_dae) {
 		if (debug)
 			printf("cdaudio-ng: using digital audio extraction\n");
@@ -520,11 +520,6 @@
 			return;
 		}
 	}
-
-	char *title = xmms_get_titlestring(xmms_get_gentitle_format(), create_tuple_from_trackinfo(pinputplayback->filename));
-
-	inputplugin.set_info(title, calculate_track_length(trackinfo[trackno].startlsn, trackinfo[trackno].endlsn), 128000, 44100, 2);
-	free(title);
 }
 
 void cdaudio_stop(InputPlayback *pinputplayback)
@@ -773,6 +768,8 @@
 	gboolean output_paused = FALSE;
 	int read_error_counter = 0;
 
+	//pdae_params->endlsn += 75 * 3;
+
 	while (pdae_params->pplayback->playing) {
 			/* handle pause status */
 		if (is_paused) {
@@ -808,13 +805,16 @@
 			/* compute the actual number of sectors to read */
 		int lsncount = CDDA_DAE_FRAMES <= (pdae_params->endlsn - pdae_params->currlsn + 1) ? CDDA_DAE_FRAMES : (pdae_params->endlsn - pdae_params->currlsn + 1);
 			/* check too see if we have reached the end of the song */
-		if (lsncount <= 0)
+		if (lsncount <= 0) {
+			sleep(3);
 			break;
+		}
 
 		if (cdio_read_audio_sectors(pcdio, buffer, pdae_params->currlsn, lsncount) != DRIVER_OP_SUCCESS) {
 			fprintf(stderr, "cdaudio-ng: failed to read audio sector\n");
 			read_error_counter++;
 			if (read_error_counter >= 2) {
+				read_error_counter = 0;
 				fprintf(stderr, "cdaudio-ng: this cd can no longer be played, stopping\n");
 				break;
 			}