summaryrefslogtreecommitdiff
path: root/codec.h
blob: 8c76bff460684bff27f85f82bba39c507efbb31a (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
/*
    DeaDBeeF - ultimate music player for GNU/Linux systems with X11
    Copyright (C) 2009  Alexey Yakovenko

    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 of the License, 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 this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CODEC_H
#define __CODEC_H

#include <stdint.h>
//#include "playlist.h"

#if 0
typedef struct {
    int bitsPerSample;
    int channels;
    int samplesPerSecond;
//    float position;
    float readposition;
} fileinfo_t;

struct playItem_s;

typedef struct codec_s {
    int (*init) (struct playItem_s *it);
    void (*free) (void);
    // player is responsible for starting next song if -1 is returned
    int (*read) (char *bytes, int size);
    int (*seek) (float time);
    struct playItem_s * (*insert) (struct playItem_s *after, const char *fname); // after==NULL means "prepend to beginning"
    const char ** (*getexts) (void);
    int (*numvoices) (void);
    void (*mutevoice) (int voice, int mute);
    const char *id; // codec id used for playlist serialization
    const char *filetypes[20]; // NULL terminated array of const strings, representing supported file types (can be NULL)
    fileinfo_t info;
} codec_t;
#endif

//codec_t *get_codec_for_file (const char *fname);

void
codec_init_locking (void);

void
codec_free_locking (void);

void
codec_lock (void);

void
codec_unlock (void);

#endif	// __CODEC_H