From e0c2c77c2ab1fcd65b18a4c8c71b34b2b8652900 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 22 Mar 2013 07:05:00 +0100 Subject: ffmpeg decoder plugin: do not allocate an AVFrame on stack. AVFrame must be allocated with avcodec_alloc_frame(). --- NEWS | 1 + src/decoder/ffmpeg_decoder_plugin.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 7fa7dc035..ea746b9c8 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ ver 0.17.4 (2013/??/??) - allow to omit END in ranges (START:END) * decoder: - ffmpeg: support float planar audio (ffmpeg 1.1) + - ffmpeg: fix AVFrame allocation * player: - implement missing "idle" events on output errors * clock: fix build failure diff --git a/src/decoder/ffmpeg_decoder_plugin.c b/src/decoder/ffmpeg_decoder_plugin.c index 4c4cb2b81..fcf7507f4 100644 --- a/src/decoder/ffmpeg_decoder_plugin.c +++ b/src/decoder/ffmpeg_decoder_plugin.c @@ -318,20 +318,33 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is, cmd == DECODE_COMMAND_NONE) { int audio_size = buffer_size; #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,25,0) - AVFrame frame; + + AVFrame *frame = avcodec_alloc_frame(); + if (frame == NULL) { + g_warning("Could not allocate frame"); + break; + } + int got_frame = 0; int len = avcodec_decode_audio4(codec_context, - &frame, &got_frame, + frame, &got_frame, &packet2); if (len >= 0 && got_frame) { audio_size = copy_interleave_frame(codec_context, - &frame, + frame, aligned_buffer, buffer_size); if (audio_size < 0) len = audio_size; } else if (len >= 0) len = -1; + +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0) + avcodec_free_frame(&frame); +#else + av_freep(&frame); +#endif + #elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,25,0) int len = avcodec_decode_audio3(codec_context, aligned_buffer, &audio_size, -- cgit v1.2.3 From a30eb194d5c5188a0e824e72ce959677d5801c0a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 8 Apr 2013 21:30:32 +0200 Subject: command: don't print undefined audio_format Check audio_format_defined(). --- src/command.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/command.c b/src/command.c index c405925f2..472571006 100644 --- a/src/command.c +++ b/src/command.c @@ -381,18 +381,21 @@ handle_status(struct client *client, song, playlist_get_song_id(&g_playlist, song)); } - if (player_status.state != PLAYER_STATE_STOP) { - struct audio_format_string af_string; - + if (player_status.state != PLAYER_STATE_STOP) client_printf(client, COMMAND_STATUS_TIME ": %i:%i\n" "elapsed: %1.3f\n" - COMMAND_STATUS_BITRATE ": %u\n" - COMMAND_STATUS_AUDIO ": %s\n", + COMMAND_STATUS_BITRATE ": %u\n", (int)(player_status.elapsed_time + 0.5), (int)(player_status.total_time + 0.5), player_status.elapsed_time, - player_status.bit_rate, + player_status.bit_rate); + + if (audio_format_defined(&player_status.audio_format)) { + struct audio_format_string af_string; + + client_printf(client, + COMMAND_STATUS_AUDIO ": %s\n", audio_format_to_string(&player_status.audio_format, &af_string)); } -- cgit v1.2.3 From 436335e9a3251cbfe42848843e1acea33d22177c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 8 Apr 2013 21:22:06 +0200 Subject: player_control: don't emit IDLE_PLAYER before audio format is known Eliminates one IDLE_PLAYER call in playlist_control, and add two new ones to player_thread. Fixes Mantis bug 3636. --- NEWS | 1 + src/player_control.c | 2 -- src/player_thread.c | 4 ++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index ea746b9c8..dae06def2 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.17.4 (2013/??/??) * protocol: - allow to omit END in ranges (START:END) + - don't emit IDLE_PLAYER before audio format is known * decoder: - ffmpeg: support float planar audio (ffmpeg 1.1) - ffmpeg: fix AVFrame allocation diff --git a/src/player_control.c b/src/player_control.c index 90f616d77..b18639087 100644 --- a/src/player_control.c +++ b/src/player_control.c @@ -127,8 +127,6 @@ pc_play(struct player_control *pc, struct song *song) assert(pc->next_song == NULL); player_unlock(pc); - - idle_add(IDLE_PLAYER); } void diff --git a/src/player_thread.c b/src/player_thread.c index 593788caf..ac0b0579e 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -313,6 +313,8 @@ player_open_output(struct player *player) pc->state = PLAYER_STATE_PLAY; player_unlock(pc); + idle_add(IDLE_PLAYER); + return true; } else { player->output_open = false; @@ -375,6 +377,8 @@ player_check_decoder_startup(struct player *player) pc->audio_format = dc->in_audio_format; player_unlock(pc); + idle_add(IDLE_PLAYER); + player->play_audio_format = dc->out_audio_format; player->decoder_starting = false; -- cgit v1.2.3 From f3832bcaa863fcbca09b8b108d7e083291c34e40 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 8 Apr 2013 21:34:51 +0200 Subject: .gitignore: stricter matches --- .gitignore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 11ac5f9a8..c86964e5c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,7 @@ *.Plo *.Po *.a -*.bz2 *.d -*.gz *.la *.lo *.o @@ -72,3 +70,6 @@ test/dump_rva2 test/dump_text_file test/test_byte_reverse test/test_vorbis_encoder + +/*.tar.gz +/*.tar.bz2 -- cgit v1.2.3 From 1894aed26142c919e49289e9e154673f658d955c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 8 Apr 2013 21:33:38 +0200 Subject: Makefile.am: enable "dist-xz" --- .gitignore | 2 ++ Makefile.am | 2 +- configure.ac | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c86964e5c..a876b705e 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,5 @@ test/test_vorbis_encoder /*.tar.gz /*.tar.bz2 +/*.tar.xz +/mpd-*/ diff --git a/Makefile.am b/Makefile.am index a0b32f8be..90fa3481c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ ACLOCAL_AMFLAGS = -I m4 -AUTOMAKE_OPTIONS = foreign 1.11 dist-bzip2 subdir-objects +AUTOMAKE_OPTIONS = foreign 1.11 dist-bzip2 dist-xz subdir-objects AM_CPPFLAGS += -I$(srcdir)/src $(GLIB_CFLAGS) diff --git a/configure.ac b/configure.ac index 05f288822..8c0af6ddf 100644 --- a/configure.ac +++ b/configure.ac @@ -8,7 +8,7 @@ VERSION_REVISION=0 VERSION_EXTRA=0 AC_CONFIG_SRCDIR([src/main.c]) -AM_INIT_AUTOMAKE([foreign 1.11 dist-bzip2 subdir-objects]) +AM_INIT_AUTOMAKE([foreign 1.11 dist-bzip2 dist-xz subdir-objects]) AM_SILENT_RULES AC_CONFIG_HEADERS(config.h) AC_CONFIG_MACRO_DIR([m4]) -- cgit v1.2.3 From cd71038655677878205a9532dd91667c5ac8b1b8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 8 Apr 2013 22:00:35 +0200 Subject: command: don't check audio_format if not playing Fixes valgrind warning. --- src/command.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/command.c b/src/command.c index 472571006..34ec87247 100644 --- a/src/command.c +++ b/src/command.c @@ -381,7 +381,7 @@ handle_status(struct client *client, song, playlist_get_song_id(&g_playlist, song)); } - if (player_status.state != PLAYER_STATE_STOP) + if (player_status.state != PLAYER_STATE_STOP) { client_printf(client, COMMAND_STATUS_TIME ": %i:%i\n" "elapsed: %1.3f\n" @@ -391,13 +391,14 @@ handle_status(struct client *client, player_status.elapsed_time, player_status.bit_rate); - if (audio_format_defined(&player_status.audio_format)) { - struct audio_format_string af_string; + if (audio_format_defined(&player_status.audio_format)) { + struct audio_format_string af_string; - client_printf(client, - COMMAND_STATUS_AUDIO ": %s\n", - audio_format_to_string(&player_status.audio_format, - &af_string)); + client_printf(client, + COMMAND_STATUS_AUDIO ": %s\n", + audio_format_to_string(&player_status.audio_format, + &af_string)); + } } if ((updateJobId = isUpdatingDB())) { -- cgit v1.2.3 From 0a9c7ff6cf9ce560767f3971fd88843976b9dc61 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 8 Apr 2013 21:38:40 +0200 Subject: release 0.17.4 --- NEWS | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index dae06def2..1f850ea7b 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -ver 0.17.4 (2013/??/??) +ver 0.17.4 (2013/04/08) * protocol: - allow to omit END in ranges (START:END) - don't emit IDLE_PLAYER before audio format is known diff --git a/configure.ac b/configure.ac index 8c0af6ddf..fc8cc2177 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) -AC_INIT(mpd, 0.17.4~git, musicpd-dev-team@lists.sourceforge.net) +AC_INIT(mpd, 0.17.4, musicpd-dev-team@lists.sourceforge.net) VERSION_MAJOR=0 VERSION_MINOR=17 -- cgit v1.2.3