4
4
mirror of https://github.com/H-uru/korman.git synced 2025-07-14 02:27:36 -04:00

C Korlib code de-duplication

Moves all PyHSPlasma struct definitions into a private header file.
Also adds move constructor and assignment support to PyObjectRef.
This commit is contained in:
2019-01-14 20:50:24 -05:00
parent a3ed2f0178
commit ce6cd0811e
10 changed files with 63 additions and 47 deletions

View File

@ -15,6 +15,7 @@
*/
#include "sound.h"
#include "PyHSPlasma_private.h"
#include <PRP/Audio/plSoundBuffer.h>
#include <Stream/hsStream.h>
@ -22,20 +23,6 @@
static const int BITS_PER_SAMPLE = 16;
extern "C" {
typedef struct {
PyObject_HEAD
hsStream* fThis;
bool fPyOwned;
} pyStream;
typedef struct {
PyObject_HEAD
plWAVHeader* fThis;
bool fPyOwned;
} pyWAVHeader;
static size_t _read_stream(void* ptr, size_t size, size_t nmemb, void* datasource) {
hsStream* s = static_cast<hsStream*>(datasource);
// hsStream is a bit overzealous protecting us against overreads, so we need to
@ -115,5 +102,3 @@ PyObject* inspect_vorbisfile(PyObject*, PyObject* args) {
// Therefore, we only need to return the size.
return PyLong_FromSsize_t(size);
}
};