dynamic_flac.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 17 Jun 2015 00:11:41 -0700
changeset 705 fe757163b8f7
parent 617 87116a42526e
child 711 f40c5ac95b12
permissions -rw-r--r--
Fixed bug 3018 - Loading MIDI music using FluidSynth leaks memory.

Philipp Wiesemann

There is a memory leak in fluidsynth.c and fluidsynth_loadsong_RW_internal(). The allocated temporary buffer is not deleted if fluid_player_add_mem() returns FLUID_OK.
slouken@382
     1
/*
slouken@518
     2
  SDL_mixer:  An audio mixer library based on the SDL library
slouken@601
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
slouken@382
     4
slouken@518
     5
  This software is provided 'as-is', without any express or implied
slouken@518
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@518
     7
  arising from the use of this software.
slouken@382
     8
slouken@518
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@518
    10
  including commercial applications, and to alter it and redistribute it
slouken@518
    11
  freely, subject to the following restrictions:
slouken@382
    12
slouken@518
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@518
    14
     claim that you wrote the original software. If you use this software
slouken@518
    15
     in a product, an acknowledgment in the product documentation would be
slouken@518
    16
     appreciated but is not required.
slouken@518
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@518
    18
     misrepresented as being the original software.
slouken@518
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@382
    20
slouken@518
    21
  The following file defines all of the functions/objects used to dynamically
slouken@518
    22
  link to the libFLAC library.
slouken@617
    23
    ~ Austen Dicken (admin@cvpcs.org)
slouken@382
    24
*/
slouken@382
    25
slouken@382
    26
#ifdef FLAC_MUSIC
slouken@382
    27
slouken@382
    28
#include <FLAC/stream_decoder.h>
slouken@382
    29
slouken@382
    30
typedef struct {
slouken@617
    31
    int loaded;
slouken@617
    32
    void *handle;
slouken@617
    33
    FLAC__StreamDecoder *(*FLAC__stream_decoder_new)();
slouken@617
    34
    void (*FLAC__stream_decoder_delete)(FLAC__StreamDecoder *decoder);
slouken@617
    35
    FLAC__StreamDecoderInitStatus (*FLAC__stream_decoder_init_stream)(
slouken@617
    36
                        FLAC__StreamDecoder *decoder,
slouken@617
    37
                        FLAC__StreamDecoderReadCallback read_callback,
slouken@617
    38
                        FLAC__StreamDecoderSeekCallback seek_callback,
slouken@617
    39
                        FLAC__StreamDecoderTellCallback tell_callback,
slouken@617
    40
                        FLAC__StreamDecoderLengthCallback length_callback,
slouken@617
    41
                        FLAC__StreamDecoderEofCallback eof_callback,
slouken@617
    42
                        FLAC__StreamDecoderWriteCallback write_callback,
slouken@617
    43
                        FLAC__StreamDecoderMetadataCallback metadata_callback,
slouken@617
    44
                        FLAC__StreamDecoderErrorCallback error_callback,
slouken@617
    45
                        void *client_data);
slouken@617
    46
    FLAC__bool (*FLAC__stream_decoder_finish)(FLAC__StreamDecoder *decoder);
slouken@617
    47
    FLAC__bool (*FLAC__stream_decoder_flush)(FLAC__StreamDecoder *decoder);
slouken@617
    48
    FLAC__bool (*FLAC__stream_decoder_process_single)(
slouken@617
    49
                        FLAC__StreamDecoder *decoder);
slouken@617
    50
    FLAC__bool (*FLAC__stream_decoder_process_until_end_of_metadata)(
slouken@617
    51
                        FLAC__StreamDecoder *decoder);
slouken@617
    52
    FLAC__bool (*FLAC__stream_decoder_process_until_end_of_stream)(
slouken@617
    53
                        FLAC__StreamDecoder *decoder);
slouken@617
    54
    FLAC__bool (*FLAC__stream_decoder_seek_absolute)(
slouken@617
    55
                        FLAC__StreamDecoder *decoder,
slouken@617
    56
                        FLAC__uint64 sample);
slouken@617
    57
    FLAC__StreamDecoderState (*FLAC__stream_decoder_get_state)(
slouken@617
    58
                        const FLAC__StreamDecoder *decoder);
slouken@382
    59
} flac_loader;
slouken@382
    60
slouken@382
    61
extern flac_loader flac;
slouken@382
    62
slouken@470
    63
#endif /* FLAC_MUSIC */
slouken@470
    64
slouken@382
    65
extern int Mix_InitFLAC();
slouken@382
    66
extern void Mix_QuitFLAC();