Skip to content

Commit 0e14bba

Browse files
committed
Buildfix
1 parent 85245e5 commit 0e14bba

3 files changed

Lines changed: 63 additions & 65 deletions

File tree

deps/dr/dr_flac.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5416,7 +5416,6 @@ static drflac_bool32 drflac__on_seek_ogg(void* pUserData, int offset, drflac_see
54165416
return DRFLAC_TRUE;
54175417
}
54185418

5419-
54205419
static drflac_bool32 drflac_ogg__seek_to_pcm_frame(drflac* pFlac, drflac_uint64 pcmFrameIndex)
54215420
{
54225421
drflac_oggbs* oggbs = (drflac_oggbs*)pFlac->_oggbs;
@@ -7750,8 +7749,7 @@ drflac_uint64 drflac_read_pcm_frames_f32(drflac* pFlac, drflac_uint64 framesToRe
77507749
return framesRead;
77517750
}
77527751

7753-
7754-
drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 pcmFrameIndex)
7752+
uint32_t drflac_seek_to_pcm_frame(drflac* pFlac, uint64_t pcmFrameIndex)
77557753
{
77567754
if (pFlac == NULL)
77577755
return DRFLAC_FALSE;

deps/dr/dr_flac.h

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ David Reid - [email protected]
77
GitHub: https://github.com/mackron/dr_libs
88
*/
99

10-
#ifndef dr_flac_h
11-
#define dr_flac_h
10+
#ifndef DR_FLAC_H
11+
#define DR_FLAC_H
1212

1313
#ifdef __cplusplus
1414
extern "C" {
1515
#endif
1616

17+
#include <stdint.h>
18+
#include <stddef.h> /* For size_t. */
19+
1720
#define DRFLAC_STRINGIFY(x) #x
1821
#define DRFLAC_XSTRINGIFY(x) DRFLAC_STRINGIFY(x)
1922

@@ -22,8 +25,6 @@ extern "C" {
2225
#define DRFLAC_VERSION_REVISION 42
2326
#define DRFLAC_VERSION_STRING DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MAJOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_MINOR) "." DRFLAC_XSTRINGIFY(DRFLAC_VERSION_REVISION)
2427

25-
#include <stddef.h> /* For size_t. */
26-
2728
/* Sized Types */
2829
typedef signed char drflac_int8;
2930
typedef unsigned char drflac_uint8;
@@ -59,6 +60,27 @@ typedef drflac_uint32 drflac_bool32;
5960
#define DRFLAC_FALSE 0
6061
/* End Sized Types */
6162

63+
/*
64+
BIT READING ATTEMPT #2
65+
66+
This uses a 32- or 64-bit bit-shifted cache - as bits are read, the cache is shifted such that the first valid bit is sitting
67+
on the most significant bit. It uses the notion of an L1 and L2 cache (borrowed from CPU architecture), where the L1 cache
68+
is a 32- or 64-bit unsigned integer (depending on whether or not a 32- or 64-bit build is being compiled) and the L2 is an
69+
array of "cache lines", with each cache line being the same size as the L1. The L2 is a buffer of about 4KB and is where data
70+
from onRead() is read into.
71+
*/
72+
#define DRFLAC_CACHE_L1_SIZE_BYTES(bs) (sizeof((bs)->cache))
73+
#define DRFLAC_CACHE_L1_SIZE_BITS(bs) (sizeof((bs)->cache)*8)
74+
#define DRFLAC_CACHE_L1_BITS_REMAINING(bs) (DRFLAC_CACHE_L1_SIZE_BITS(bs) - (bs)->consumedBits)
75+
#define DRFLAC_CACHE_L1_SELECTION_MASK(_bitCount) (~((~(drflac_cache_t)0) >> (_bitCount)))
76+
#define DRFLAC_CACHE_L1_SELECTION_SHIFT(bs, _bitCount) (DRFLAC_CACHE_L1_SIZE_BITS(bs) - (_bitCount))
77+
#define DRFLAC_CACHE_L1_SELECT(bs, _bitCount) (((bs)->cache) & DRFLAC_CACHE_L1_SELECTION_MASK(_bitCount))
78+
#define DRFLAC_CACHE_L1_SELECT_AND_SHIFT(bs, _bitCount) (DRFLAC_CACHE_L1_SELECT((bs), (_bitCount)) >> DRFLAC_CACHE_L1_SELECTION_SHIFT((bs), (_bitCount)))
79+
#define DRFLAC_CACHE_L1_SELECT_AND_SHIFT_SAFE(bs, _bitCount)(DRFLAC_CACHE_L1_SELECT((bs), (_bitCount)) >> (DRFLAC_CACHE_L1_SELECTION_SHIFT((bs), (_bitCount)) & (DRFLAC_CACHE_L1_SIZE_BITS(bs)-1)))
80+
#define DRFLAC_CACHE_L2_SIZE_BYTES(bs) (sizeof((bs)->cacheL2))
81+
#define DRFLAC_CACHE_L2_LINE_COUNT(bs) (DRFLAC_CACHE_L2_SIZE_BYTES(bs) / sizeof((bs)->cacheL2[0]))
82+
#define DRFLAC_CACHE_L2_LINES_REMAINING(bs) (DRFLAC_CACHE_L2_LINE_COUNT(bs) - (bs)->nextL2Line)
83+
6284
/* Allocation Callbacks */
6385
typedef struct
6486
{
@@ -514,6 +536,38 @@ typedef struct
514536
drflac_uint8 pExtraData[1];
515537
} drflac;
516538

539+
/* Structure representing an iterator for vorbis comments in a VORBIS_COMMENT metadata block. */
540+
typedef struct
541+
{
542+
drflac_uint32 countRemaining;
543+
const char* pRunningData;
544+
} drflac_vorbis_comment_iterator;
545+
546+
/* Structure representing an iterator for cuesheet tracks in a CUESHEET metadata block. */
547+
typedef struct
548+
{
549+
drflac_uint32 countRemaining;
550+
const char* pRunningData;
551+
} drflac_cuesheet_track_iterator;
552+
553+
/* The order of members here is important because we map this directly to the raw data within the CUESHEET metadata block. */
554+
typedef struct
555+
{
556+
drflac_uint64 offset;
557+
drflac_uint8 index;
558+
drflac_uint8 reserved[3];
559+
} drflac_cuesheet_track_index;
560+
561+
typedef struct
562+
{
563+
drflac_uint64 offset;
564+
drflac_uint8 trackNumber;
565+
char ISRC[12];
566+
drflac_bool8 isAudio;
567+
drflac_bool8 preEmphasis;
568+
drflac_uint8 indexCount;
569+
const drflac_cuesheet_track_index* pIndexPoints;
570+
} drflac_cuesheet_track;
517571

518572
/*
519573
Opens a FLAC decoder.
@@ -716,7 +770,7 @@ Return Value
716770
-------------
717771
`DRFLAC_TRUE` if successful; `DRFLAC_FALSE` otherwise.
718772
*/
719-
drflac_bool32 drflac_seek_to_pcm_frame(drflac* pFlac, drflac_uint64 pcmFrameIndex);
773+
uint32_t drflac_seek_to_pcm_frame(drflac* pFlac, uint64_t pcmFrameIndex);
720774

721775
/*
722776
Opens a FLAC decoder from a pre-allocated block of memory
@@ -760,62 +814,8 @@ Set pAllocationCallbacks to the same object that was passed to drflac_open_*_and
760814
*/
761815
void drflac_free(void* p, const drflac_allocation_callbacks* pAllocationCallbacks);
762816

763-
764-
/* Structure representing an iterator for vorbis comments in a VORBIS_COMMENT metadata block. */
765-
typedef struct
766-
{
767-
drflac_uint32 countRemaining;
768-
const char* pRunningData;
769-
} drflac_vorbis_comment_iterator;
770-
771-
/* Structure representing an iterator for cuesheet tracks in a CUESHEET metadata block. */
772-
typedef struct
773-
{
774-
drflac_uint32 countRemaining;
775-
const char* pRunningData;
776-
} drflac_cuesheet_track_iterator;
777-
778-
/* The order of members here is important because we map this directly to the raw data within the CUESHEET metadata block. */
779-
typedef struct
780-
{
781-
drflac_uint64 offset;
782-
drflac_uint8 index;
783-
drflac_uint8 reserved[3];
784-
} drflac_cuesheet_track_index;
785-
786-
typedef struct
787-
{
788-
drflac_uint64 offset;
789-
drflac_uint8 trackNumber;
790-
char ISRC[12];
791-
drflac_bool8 isAudio;
792-
drflac_bool8 preEmphasis;
793-
drflac_uint8 indexCount;
794-
const drflac_cuesheet_track_index* pIndexPoints;
795-
} drflac_cuesheet_track;
796-
797-
/*
798-
BIT READING ATTEMPT #2
799-
800-
This uses a 32- or 64-bit bit-shifted cache - as bits are read, the cache is shifted such that the first valid bit is sitting
801-
on the most significant bit. It uses the notion of an L1 and L2 cache (borrowed from CPU architecture), where the L1 cache
802-
is a 32- or 64-bit unsigned integer (depending on whether or not a 32- or 64-bit build is being compiled) and the L2 is an
803-
array of "cache lines", with each cache line being the same size as the L1. The L2 is a buffer of about 4KB and is where data
804-
from onRead() is read into.
805-
*/
806-
#define DRFLAC_CACHE_L1_SIZE_BYTES(bs) (sizeof((bs)->cache))
807-
#define DRFLAC_CACHE_L1_SIZE_BITS(bs) (sizeof((bs)->cache)*8)
808-
#define DRFLAC_CACHE_L1_BITS_REMAINING(bs) (DRFLAC_CACHE_L1_SIZE_BITS(bs) - (bs)->consumedBits)
809-
#define DRFLAC_CACHE_L1_SELECTION_MASK(_bitCount) (~((~(drflac_cache_t)0) >> (_bitCount)))
810-
#define DRFLAC_CACHE_L1_SELECTION_SHIFT(bs, _bitCount) (DRFLAC_CACHE_L1_SIZE_BITS(bs) - (_bitCount))
811-
#define DRFLAC_CACHE_L1_SELECT(bs, _bitCount) (((bs)->cache) & DRFLAC_CACHE_L1_SELECTION_MASK(_bitCount))
812-
#define DRFLAC_CACHE_L1_SELECT_AND_SHIFT(bs, _bitCount) (DRFLAC_CACHE_L1_SELECT((bs), (_bitCount)) >> DRFLAC_CACHE_L1_SELECTION_SHIFT((bs), (_bitCount)))
813-
#define DRFLAC_CACHE_L1_SELECT_AND_SHIFT_SAFE(bs, _bitCount)(DRFLAC_CACHE_L1_SELECT((bs), (_bitCount)) >> (DRFLAC_CACHE_L1_SELECTION_SHIFT((bs), (_bitCount)) & (DRFLAC_CACHE_L1_SIZE_BITS(bs)-1)))
814-
#define DRFLAC_CACHE_L2_SIZE_BYTES(bs) (sizeof((bs)->cacheL2))
815-
#define DRFLAC_CACHE_L2_LINE_COUNT(bs) (DRFLAC_CACHE_L2_SIZE_BYTES(bs) / sizeof((bs)->cacheL2[0]))
816-
#define DRFLAC_CACHE_L2_LINES_REMAINING(bs) (DRFLAC_CACHE_L2_LINE_COUNT(bs) - (bs)->nextL2Line)
817-
818817
#ifdef __cplusplus
819818
}
820819
#endif
821-
#endif /* dr_flac_h */
820+
821+
#endif /* DR_FLAC_H */

griffin/griffin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,6 @@ MENU
14151415
DEPENDENCIES
14161416
============================================================ */
14171417
#ifdef HAVE_FLAC
1418-
#include "../deps/dr/dr_flac.c"
14191418
#include "../deps/libFLAC/bitmath.c"
14201419
#include "../deps/libFLAC/bitreader.c"
14211420
#include "../deps/libFLAC/cpu.c"
@@ -1459,6 +1458,7 @@ DEPENDENCIES
14591458
#include "../libretro-common/formats/libchdr/libchdr_huffman.c"
14601459

14611460
#ifdef HAVE_FLAC
1461+
#include "../deps/dr/dr_flac.c"
14621462
#include "../libretro-common/formats/libchdr/libchdr_flac.c"
14631463
#include "../libretro-common/formats/libchdr/libchdr_flac_codec.c"
14641464
#endif

0 commit comments

Comments
 (0)