Project

General

Profile

mpg123-debug.diff

John Lindgren, November 30, 2014 06:57

View differences:

src/mpg123/mpg123.c
36 36
#include <audacious/plugin.h>
37 37
#include <audacious/audtag.h>
38 38

  
39
#include <stdio.h>
40

  
39 41
/* Define to read all frame headers when calculating file length */
40 42
/* #define FULL_SCAN */
41 43

  
......
284 286

  
285 287
	set_format (ctx.decoder);
286 288

  
289
	printf ("trying to play %s\n", filename);
287 290
	if (mpg123_open_handle (ctx.decoder, file) < 0)
288 291
	{
289 292
OPEN_ERROR:
......
321 324

  
322 325
	if (! aud_input_open_audio (FMT_FLOAT, ctx.rate, ctx.channels))
323 326
	{
327
		printf ("open_audio error\n");
324 328
		error = TRUE;
325 329
		goto cleanup;
326 330
	}
327 331

  
328
	while (! aud_input_check_stop ())
332
	int total_bytes_written = 0;
333

  
334
	printf ("entering play loop\n");
335
	while (1)
329 336
	{
337
		if (aud_input_check_stop ())
338
		{
339
			printf ("stopped manually\n");
340
			break;
341
		}
342

  
330 343
		int seek = aud_input_check_seek ();
331 344

  
332 345
		if (seek >= 0)
333 346
		{
347
			printf ("seeking to %d\n", seek);
334 348
			if (mpg123_seek (ctx.decoder, (int64_t) seek * ctx.rate / 1000, SEEK_SET) < 0)
335 349
				print_mpg123_error (filename, ctx.decoder);
336 350

  
......
360 374
		if (! outbuf_size && (ret = mpg123_read (ctx.decoder, (void *) outbuf,
361 375
		 sizeof outbuf, & outbuf_size)) < 0)
362 376
		{
377
			printf ("mpg123_read returned %d\n", ret);
378
			printf ("total bytes written: %d\n", total_bytes_written);
363 379
			if (ret == MPG123_DONE || ret == MPG123_ERR_READER)
364 380
				break;
365 381

  
......
375 391
		{
376 392
			error_count = 0;
377 393

  
394
			total_bytes_written += outbuf_size;
378 395
			aud_input_write_audio (outbuf, outbuf_size);
379 396
			outbuf_size = 0;
380 397
		}
381 398
	}
382 399

  
383 400
cleanup:
401
	printf ("playback done\n");
384 402
	mpg123_delete(ctx.decoder);
385 403
	if (ctx.tu)
386 404
		tuple_unref (ctx.tu);