aboutsummaryrefslogtreecommitdiff
path: root/lib/DllLibFlac.h
blob: 1206351538a5985065782b3a684017a5f61efe38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#pragma once

/*
 *      Copyright (C) 2005-2008 Team XBMC
 *      http://www.xbmc.org
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with XBMC; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 *  http://www.gnu.org/copyleft/gpl.html
 *
 */

#if (defined HAVE_CONFIG_H) && (!defined WIN32)
  #include "config.h"
#endif
#include <FLAC/stream_decoder.h>
#include "DynamicDll.h"
#include "utils/log.h"

class DllLibFlacInterface
{
public:
    virtual ~DllLibFlacInterface() {}
    virtual FLAC__StreamDecoder *FLAC__stream_decoder_new()=0;
    virtual void   FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(
        FLAC__StreamDecoder *decoder,
        FLAC__StreamDecoderReadCallback read_callback,
        FLAC__StreamDecoderSeekCallback seek_callback,
        FLAC__StreamDecoderTellCallback tell_callback,
        FLAC__StreamDecoderLengthCallback length_callback,
        FLAC__StreamDecoderEofCallback eof_callback,
        FLAC__StreamDecoderWriteCallback write_callback,
        FLAC__StreamDecoderMetadataCallback metadata_callback,
        FLAC__StreamDecoderErrorCallback error_callback,
        void *client_data
      )=0;
    virtual FLAC__bool FLAC__stream_decoder_set_md5_checking(FLAC__StreamDecoder *decoder, FLAC__bool value)=0;
    virtual FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type)=0;
    virtual FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4])=0;
    virtual FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type)=0;
    virtual FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4])=0;
    virtual FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder)=0;
    virtual const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__bool FLAC__stream_decoder_get_md5_checking(const FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder)=0;
    virtual unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder)=0;
    virtual unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder)=0;
    virtual unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder)=0;
    virtual unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position)=0;
    virtual FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder)=0;
    virtual FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder)=0;
    virtual FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *decoder, FLAC__uint64 sample)=0;
};

class DllLibFlac : public DllDynamic, DllLibFlacInterface
{
  DECLARE_DLL_WRAPPER(DllLibFlac, DLL_PATH_FLAC_CODEC)
  DEFINE_METHOD0(FLAC__StreamDecoder*, FLAC__stream_decoder_new)
  DEFINE_METHOD1(void, FLAC__stream_decoder_delete, (FLAC__StreamDecoder *p1))
  DEFINE_METHOD10(FLAC__StreamDecoderInitStatus, FLAC__stream_decoder_init_stream,
                 (FLAC__StreamDecoder *p1,
                  FLAC__StreamDecoderReadCallback p2,
                  FLAC__StreamDecoderSeekCallback p3,
                  FLAC__StreamDecoderTellCallback p4,
                  FLAC__StreamDecoderLengthCallback p5,
                  FLAC__StreamDecoderEofCallback p6,
                  FLAC__StreamDecoderWriteCallback p7,
                  FLAC__StreamDecoderMetadataCallback p8,
                  FLAC__StreamDecoderErrorCallback p9,
                  void *p10))
  DEFINE_METHOD2(FLAC__bool, FLAC__stream_decoder_set_md5_checking, (FLAC__StreamDecoder *p1, FLAC__bool p2))
  DEFINE_METHOD2(FLAC__bool, FLAC__stream_decoder_set_metadata_respond, (FLAC__StreamDecoder *p1, FLAC__MetadataType p2))
  DEFINE_METHOD2(FLAC__bool, FLAC__stream_decoder_set_metadata_respond_application, (FLAC__StreamDecoder *p1, const FLAC__byte p2[4]))
  DEFINE_METHOD1(FLAC__bool, FLAC__stream_decoder_set_metadata_respond_all, (FLAC__StreamDecoder *p1))
  DEFINE_METHOD2(FLAC__bool, FLAC__stream_decoder_set_metadata_ignore, (FLAC__StreamDecoder *p1, FLAC__MetadataType p2))
  DEFINE_METHOD2(FLAC__bool, FLAC__stream_decoder_set_metadata_ignore_application, (FLAC__StreamDecoder *p1, const FLAC__byte p2[4]))
  DEFINE_METHOD1(FLAC__bool, FLAC__stream_decoder_set_metadata_ignore_all, (FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(FLAC__StreamDecoderState, FLAC__stream_decoder_get_state, (const FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(const char *, FLAC__stream_decoder_get_resolved_state_string, (const FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(FLAC__bool, FLAC__stream_decoder_get_md5_checking, (const FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(FLAC__uint64, FLAC__stream_decoder_get_total_samples, (const FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(unsigned, FLAC__stream_decoder_get_channels, (const FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(FLAC__ChannelAssignment, FLAC__stream_decoder_get_channel_assignment, (const FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(unsigned, FLAC__stream_decoder_get_bits_per_sample, (const FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(unsigned, FLAC__stream_decoder_get_sample_rate, (const FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(unsigned, FLAC__stream_decoder_get_blocksize, (const FLAC__StreamDecoder *p1))
  DEFINE_METHOD2(FLAC__bool, FLAC__stream_decoder_get_decode_position, (const FLAC__StreamDecoder *p1, FLAC__uint64 *p2))
  DEFINE_METHOD1(FLAC__bool, FLAC__stream_decoder_finish, (FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(FLAC__bool, FLAC__stream_decoder_flush, (FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(FLAC__bool, FLAC__stream_decoder_reset, (FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(FLAC__bool, FLAC__stream_decoder_process_single, (FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(FLAC__bool, FLAC__stream_decoder_process_until_end_of_metadata, (FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(FLAC__bool, FLAC__stream_decoder_process_until_end_of_stream, (FLAC__StreamDecoder *p1))
  DEFINE_METHOD1(FLAC__bool, FLAC__stream_decoder_skip_single_frame, (FLAC__StreamDecoder *p1))
  DEFINE_METHOD2(FLAC__bool, FLAC__stream_decoder_seek_absolute, (FLAC__StreamDecoder *p1, FLAC__uint64 p2))

  BEGIN_METHOD_RESOLVE()
    RESOLVE_METHOD(FLAC__stream_decoder_new)
    RESOLVE_METHOD(FLAC__stream_decoder_delete)
    RESOLVE_METHOD(FLAC__stream_decoder_init_stream)
    RESOLVE_METHOD(FLAC__stream_decoder_set_md5_checking)
    RESOLVE_METHOD(FLAC__stream_decoder_set_metadata_respond)
    RESOLVE_METHOD(FLAC__stream_decoder_set_metadata_respond_application)
    RESOLVE_METHOD(FLAC__stream_decoder_set_metadata_respond_all)
    RESOLVE_METHOD(FLAC__stream_decoder_set_metadata_ignore)
    RESOLVE_METHOD(FLAC__stream_decoder_set_metadata_ignore_application)
    RESOLVE_METHOD(FLAC__stream_decoder_set_metadata_ignore_all)
    RESOLVE_METHOD(FLAC__stream_decoder_get_state)
    RESOLVE_METHOD(FLAC__stream_decoder_get_resolved_state_string)
    RESOLVE_METHOD(FLAC__stream_decoder_get_md5_checking)
    RESOLVE_METHOD(FLAC__stream_decoder_get_total_samples)
    RESOLVE_METHOD(FLAC__stream_decoder_get_channels)
    RESOLVE_METHOD(FLAC__stream_decoder_get_channel_assignment)
    RESOLVE_METHOD(FLAC__stream_decoder_get_bits_per_sample)
    RESOLVE_METHOD(FLAC__stream_decoder_get_sample_rate)
    RESOLVE_METHOD(FLAC__stream_decoder_get_blocksize)
    RESOLVE_METHOD(FLAC__stream_decoder_get_decode_position)
    RESOLVE_METHOD(FLAC__stream_decoder_finish)
    RESOLVE_METHOD(FLAC__stream_decoder_flush)
    RESOLVE_METHOD(FLAC__stream_decoder_reset)
    RESOLVE_METHOD(FLAC__stream_decoder_process_single)
    RESOLVE_METHOD(FLAC__stream_decoder_process_until_end_of_metadata)
    RESOLVE_METHOD(FLAC__stream_decoder_process_until_end_of_stream)
    RESOLVE_METHOD(FLAC__stream_decoder_skip_single_frame)
    RESOLVE_METHOD(FLAC__stream_decoder_seek_absolute)
  END_METHOD_RESOLVE()
};