player: fix typecast
(upstream git commit 12f132dd220027ee2075572d7271a5b13cfa4cbe)
This commit is contained in:
parent
a8576afa28
commit
4ac94ca3e5
@ -1,11 +1,11 @@
|
||||
# $OpenBSD: Makefile,v 1.47 2012/10/30 16:59:23 dcoppa Exp $
|
||||
# $OpenBSD: Makefile,v 1.48 2012/11/20 09:23:59 dcoppa Exp $
|
||||
|
||||
SHARED_ONLY = Yes
|
||||
|
||||
COMMENT = console client for pandora
|
||||
|
||||
DISTNAME = pianobar-2012.09.07
|
||||
REVISION = 1
|
||||
REVISION = 2
|
||||
EXTRACT_SUFX = .tar.bz2
|
||||
CATEGORIES = audio
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
$OpenBSD: patch-src_player_c,v 1.13 2012/10/30 16:59:23 dcoppa Exp $
|
||||
$OpenBSD: patch-src_player_c,v 1.14 2012/11/20 09:23:59 dcoppa Exp $
|
||||
|
||||
commit dd6c620b53272e2eb4b091a835cd250309f04cad
|
||||
Author: Lars-Dominik Braun <lars@6xq.net>
|
||||
@ -10,8 +10,14 @@ Date: Sun Oct 28 18:24:50 2012 +0100
|
||||
broken frame. This also fixes invalid memory reads caused by
|
||||
sampleSizeCurr >= sampleSizeN. See issue #304.
|
||||
|
||||
--- src/player.c.orig Tue Oct 30 17:45:04 2012
|
||||
+++ src/player.c Tue Oct 30 17:45:34 2012
|
||||
commit 12f132dd220027ee2075572d7271a5b13cfa4cbe
|
||||
Author: Lars-Dominik Braun <lars@6xq.net>
|
||||
Date: Sat Nov 17 15:50:06 2012 +0100
|
||||
|
||||
player: Fix insane typecast
|
||||
|
||||
--- src/player.c.orig Fri Sep 7 16:44:39 2012
|
||||
+++ src/player.c Tue Nov 20 10:13:35 2012
|
||||
@@ -28,6 +28,7 @@ THE SOFTWARE.
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
@ -56,7 +62,7 @@ Date: Sun Oct 28 18:24:50 2012 +0100
|
||||
for (i = 0; i < frameInfo.samples; i++) {
|
||||
aacDecoded[i] = applyReplayGain (aacDecoded[i], player->scale);
|
||||
}
|
||||
@@ -157,11 +172,10 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, s
|
||||
@@ -157,12 +172,11 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, s
|
||||
(unsigned long long int) BAR_PLAYER_MS_TO_S_FACTOR /
|
||||
(unsigned long long int) player->samplerate /
|
||||
(unsigned long long int) player->channels;
|
||||
@ -65,10 +71,49 @@ Date: Sun Oct 28 18:24:50 2012 +0100
|
||||
- /* going through this loop can take up to a few seconds =>
|
||||
- * allow earlier thread abort */
|
||||
- QUIT_PAUSE_CHECK;
|
||||
+ }
|
||||
}
|
||||
+ if (player->sampleSizeCurr >= player->sampleSizeN) {
|
||||
+ /* no more frames, drop data */
|
||||
+ player->bufferRead = player->bufferFilled;
|
||||
}
|
||||
+ }
|
||||
} else {
|
||||
if (player->mode == PLAYER_INITIALIZED) {
|
||||
while (player->bufferRead+4 < player->bufferFilled) {
|
||||
@@ -235,12 +249,15 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, s
|
||||
/* how many frames do we have? */
|
||||
if (player->sampleSizeN == 0) {
|
||||
/* mp4 uses big endian, convert */
|
||||
+ memcpy (&player->sampleSizeN, player->buffer +
|
||||
+ player->bufferRead, sizeof (uint32_t));
|
||||
player->sampleSizeN =
|
||||
- bigToHostEndian32 (*((uint32_t *) (player->buffer +
|
||||
- player->bufferRead)));
|
||||
+ bigToHostEndian32 (player->sampleSizeN);
|
||||
+
|
||||
player->sampleSize = malloc (player->sampleSizeN *
|
||||
sizeof (*player->sampleSize));
|
||||
- player->bufferRead += 4;
|
||||
+ assert (player->sampleSize != NULL);
|
||||
+ player->bufferRead += sizeof (uint32_t);
|
||||
player->sampleSizeCurr = 0;
|
||||
/* set up song duration (assuming one frame always contains
|
||||
* the same number of samples)
|
||||
@@ -253,11 +270,15 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, s
|
||||
(unsigned long long int) player->channels;
|
||||
break;
|
||||
} else {
|
||||
+ memcpy (&player->sampleSize[player->sampleSizeCurr],
|
||||
+ player->buffer + player->bufferRead,
|
||||
+ sizeof (uint32_t));
|
||||
player->sampleSize[player->sampleSizeCurr] =
|
||||
- bigToHostEndian32 (*((uint32_t *) (player->buffer +
|
||||
- player->bufferRead)));
|
||||
+ bigToHostEndian32 (
|
||||
+ player->sampleSize[player->sampleSizeCurr]);
|
||||
+
|
||||
player->sampleSizeCurr++;
|
||||
- player->bufferRead += 4;
|
||||
+ player->bufferRead += sizeof (uint32_t);
|
||||
}
|
||||
/* all sizes read, nearly ready for data mode */
|
||||
if (player->sampleSizeCurr >= player->sampleSizeN) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user