~ubuntu-branches/ubuntu/feisty/avidemux/feisty

« back to all changes in this revision

Viewing changes to avidemux/ADM_audiofilter/audioencoder.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2006-12-15 17:13:20 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061215171320-w79pvpehxx2fr217
Tags: 1:2.3.0-0.0ubuntu1
* Merge from debian-multimedia.org, remaining Ubuntu change:
  - desktop file,
  - no support for ccache and make -j.
* Closes Ubuntu: #69614.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    copyright            : (C) 2006 by mean
 
3
    email                : fixounet@free.fr
 
4
 ***************************************************************************/
 
5
 
 
6
 
 
7
#ifndef AUDIO_ENCODER_H
 
8
#define AUDIO_ENCODER_H
 
9
/*!
 
10
  This structure defines an audio encoder
 
11
  \param encoder Encoder attached to this descriptor
 
12
   \param name The name of the codec
 
13
  \param bitrate The bitrate in kb/s
 
14
  \param configure Function to call to configure the codec
 
15
  \param maxChannels The maximum # of channels this codec supports
 
16
  \param param : An opaque structure that contains the codec specific configuration datas
 
17
*/
 
18
#include "audioeng_buildfilters.h"
 
19
#include "audiofilter_channel_route.h"
 
20
 
 
21
typedef struct ADM_audioEncoderDescriptor
 
22
{
 
23
  AUDIOENCODER encoder;
 
24
  int       (*configure)(ADM_audioEncoderDescriptor *descritor);
 
25
  const     char *name;
 
26
  uint32_t  bitrate;
 
27
  uint32_t  maxChannels;
 
28
  uint32_t  paramSize;
 
29
  void     *param;
 
30
};
 
31
 
 
32
/*!
 
33
  Base class for all audio encoder.It does the reverse of the bridge class and offers a proper GenericAudioStreamAPI
 
34
 
 
35
*/
 
36
#define DITHER_SIZE 4800
 
37
#define DITHER_CHANNELS 6
 
38
void            AUDMEncoder_initDither();
 
39
void dither16(float *start, uint32_t nb, uint8_t channels);
 
40
 
 
41
 //_____________________________________________
 
42
class AUDMEncoder : public AVDMGenericAudioStream
 
43
{
 
44
  protected:
 
45
    //
 
46
    uint32_t grab(uint8_t *outbuffer);
 
47
    uint32_t grab(float *outbuffer) {ADM_assert(0);return 1;}
 
48
    uint32_t  eof_met;
 
49
    uint32_t  _chunk;
 
50
    //
 
51
    uint8_t         *_extraData;
 
52
    uint32_t        _extraSize;
 
53
    AUDMAudioFilter *_incoming;
 
54
    uint8_t         cleanup(void);
 
55
    
 
56
    float          *tmpbuffer;
 
57
    uint8_t        refillBuffer(int minimum); // Mininum is in float
 
58
 
 
59
    CHANNEL_TYPE ch_order[MAX_CHANNELS];
 
60
    void reorderChannels(float *start, uint32_t nb);
 
61
 
 
62
    uint32_t       tmphead,tmptail;
 
63
  public:
 
64
    //
 
65
    uint32_t read(uint32_t len,uint8_t *buffer);
 
66
    uint32_t read(uint32_t len,float *buffer) {ADM_assert(0);return 1;}
 
67
    //
 
68
    virtual ~AUDMEncoder();
 
69
    AUDMEncoder(AUDMAudioFilter *in);   
 
70
    virtual uint8_t init(ADM_audioEncoderDescriptor *config)=0;
 
71
    virtual uint8_t getPacket(uint8_t *dest, uint32_t *len, uint32_t *samples)=0;
 
72
    virtual uint8_t packetPerFrame( void) {return 1;}
 
73
    virtual uint8_t extraData(uint32_t *l,uint8_t **d) {*l=_extraSize;*d=_extraData;return 1;}
 
74
            uint8_t  goTo(uint32_t timeMS) {ADM_assert(0);return 1;}
 
75
};
 
76
 
 
77
#endif