---
Diffed against 0.16.1, not extensively tested, but seems to work.
Index: mpd/src/decoder/mpg123_decoder_plugin.c
===================================================================
--- mpd.orig/src/decoder/mpg123_decoder_plugin.c	2011-01-18 02:23:17.000000000 +0300
+++ mpd/src/decoder/mpg123_decoder_plugin.c	2011-01-18 02:27:36.000000000 +0300
@@ -24,6 +24,7 @@
 #include <glib.h>
 
 #include <mpg123.h>
+#include <stdio.h>
 
 #undef G_LOG_DOMAIN
 #define G_LOG_DOMAIN "mpg123"
@@ -125,7 +126,7 @@ mpd_mpg123_file_decode(struct decoder *d
 
 	/* tell MPD core we're ready */
 
-	decoder_initialized(decoder, &audio_format, false,
+	decoder_initialized(decoder, &audio_format, true,
 			    (float)num_samples /
 			    (float)audio_format.sample_rate);
 
@@ -172,7 +173,18 @@ mpd_mpg123_file_decode(struct decoder *d
 
 		cmd = decoder_data(decoder, NULL, buffer, nbytes, info.bitrate);
 
-		/* seeking not yet implemented */
+		if (cmd == DECODE_COMMAND_SEEK) {
+			off_t c = decoder_seek_where(decoder)*audio_format.sample_rate;
+			c = mpg123_seek(handle, c, SEEK_SET);
+			if (c < 0)
+				decoder_seek_error(decoder);
+			else {
+				decoder_command_finished(decoder);
+				decoder_timestamp(decoder, c/(double)audio_format.sample_rate);
+			}
+
+			cmd = DECODE_COMMAND_NONE;
+		}
 	} while (cmd == DECODE_COMMAND_NONE);
 
 	/* cleanup */
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to