summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/decoder/vorbisPlugin.h
blob: b680ed69e8afc64972b737b2ad6db20555e4842a (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
/*
  vorbis player plugin
  Copyright (C) 2000  Martin Vogt

  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.

  For more information look at the file COPYRIGHT in this package

 */


#ifndef __VORBISPLUGIN_H
#define __VORBISPLUGIN_H

#include "nukePlugin.h"

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdio.h>
#include <math.h>

#ifndef OGG_VORBIS
class VorbisPlugin : public NukePlugin {
};
#else


#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>

/**
   callbacks from vorbisfile
*/
extern "C" {

extern size_t  fread_func  (void *ptr,size_t size,size_t nmemb, void *stream);
extern int     fseek_func  (void *stream, ogg_int64_t offset, int whence);
extern int     fclose_func (void *stream);
extern long    ftell_func  (void *stream);

}


class VorbisPlugin : public DecoderPlugin {
  
  OggVorbis_File vf;


  // END vorbis setup
  

  int lnoLength;
  int lAutoPlay;
  TimeStamp* timeDummy;
  char* pcmout;           // temporay pcm buffer
  int last_section;
  int current_section;
  int lshutdown; 

 public:
  VorbisPlugin();
  ~VorbisPlugin();

  void decoder_loop();
  int seek_impl(int second);
  void config(const char* key,const char* value,void* user_data);

  // vorbis bug workaround [START]
  int vorbis_seek_bug_active;
  ::InputStream* getInputStream() { return input; }
  // vorbis bug workaround [END]

 private:
  int processVorbis(vorbis_info* vi,vorbis_comment* comment);
  int getTotalLength();
  int init();

};

#endif
//OGG_VORBIS

#endif