summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/frame/audioFrame.h
blob: 853a53914ae280cb2e45cf59ab13f7eb0adfecac (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
/* 
  abstract definition of an audio frame
  Copyright (C) 2001  Martin Vogt

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU Library General Public License as published by
  the Free Software Foundation.

  For more information look at the file COPYRIGHT in this package

 */




#ifndef __AUDIOFRAME_H
#define __AUDIOFRAME_H


#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#ifdef WORDS_BIGENDIAN
#define AUDIOFRAME_BIGENDIAN 1
#else
#define AUDIOFRAME_BIGENDIAN 0
#endif


#include "frame.h"
#include <kdemacros.h>
#define SCALFACTOR           SHRT_MAX
#define MP3FRAMESIZE         (2*2*2*32*18)


class TDE_EXPORT AudioFrame : public Frame {

  int stereo;
  int frequencyHZ;
  
 public:
  AudioFrame();
  virtual ~AudioFrame();

  // info about "import" data
  void setFrameFormat(int stereo,int freq);

  inline int getStereo()      { return stereo;      }
  inline int getFrequenceHZ() { return frequencyHZ; }

  // these return values depend on the implementation
  // how the data is stored internally after "import"
  inline int getSampleSize()  { return sampleSize;  }
  inline int getBigEndian()   { return lBigEndian;  }
  inline int getSigned()      { return lSigned;     }

  // info about output
  virtual int getLen();
  virtual void setLen(int len);
  virtual int getSize();
  virtual void clearrawdata();

  // data import
  virtual void putFloatData(float* data,int len);
  virtual void putFloatData(float* left,float* right,int len);


  int isFormatEqual(AudioFrame* compare);
  // Note: this can only be called with _real_ AudioFrame's as dest
  void copyFormat(AudioFrame* dest);

  void print(const char* msg);

 protected:
  int sampleSize;
  int lBigEndian;
  int lSigned;

};


#endif