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

« back to all changes in this revision

Viewing changes to avidemux/ADM_audiofilter/audioeng_null.cpp

  • 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
 
                          audioeng_null.cpp  -  description
3
 
                             -------------------
4
 
        This audio plug in does nothing at all.
5
 
        except that you are sure that the output is WAV PCM  with the given size
6
 
 
7
 
    begin                : Sun Jan 13 2002
8
 
    copyright            : (C) 2002 by mean
9
 
    email                : fixounet@free.fr
10
 
 ***************************************************************************/
11
 
 
12
 
/***************************************************************************
13
 
 *                                                                         *
14
 
 *   This program is free software; you can redistribute it and/or modify  *
15
 
 *   it under the terms of the GNU General Public License as published by  *
16
 
 *   the Free Software Foundation; either version 2 of the License, or     *
17
 
 *   (at your option) any later version.                                   *
18
 
 *                                                                         *
19
 
 ***************************************************************************/
20
 
#include <stdio.h>
21
 
#include <stdlib.h>
22
 
#include <string.h>
23
 
//#include <stream.h>
24
 
#include <ADM_assert.h>
25
 
#include <math.h>
26
 
 
27
 
#include "config.h"
28
 
#include "avifmt.h"
29
 
#include "avifmt2.h"
30
 
#include "avio.hxx"
31
 
#include "fourcc.h"
32
 
//#include "aviaudio.hxx"
33
 
#include "audioprocess.hxx"
34
 
//#include "toolkit.hxx"
35
 
 
36
 
// Ctor: Duplicate
37
 
//__________
38
 
    
39
 
    
40
 
AVDMProcessAudio_Null::AVDMProcessAudio_Null
41
 
(AVDMGenericAudioStream * instream, uint32_t time_offset, uint32_t duration):
42
 
AVDMBufferedAudioStream    (instream)
43
 
{
44
 
double dur;
45
 
    _wavheader = new WAVHeader;
46
 
 
47
 
    memcpy(_wavheader, _instream->getInfo(), sizeof(WAVHeader));
48
 
    _wavheader->encoding = WAV_PCM;
49
 
    
50
 
    // bug spotted by jmisack
51
 
      _wavheader->bitspersample=16;
52
 
      
53
 
      
54
 
    // Case AC3 Downmixing to stereo ...
55
 
    if( _wavheader->channels >2)
56
 
                _wavheader->channels =2;
57
 
    _wavheader->byterate =_wavheader->channels * _wavheader->frequency * 2;
58
 
    strcpy(_name, "PROC:NULL");
59
 
    _instream->goToTime(time_offset);
60
 
    _start_time = time_offset;
61
 
 
62
 
    dur=duration;
63
 
    dur=dur*_wavheader->byterate*1.1;
64
 
    dur=dur/1000;
65
 
    _size = (uint32_t)dur;
66
 
    _length = (uint32_t)dur;
67
 
 
68
 
};
69
 
 
70
 
AVDMProcessAudio_Null::~AVDMProcessAudio_Null()
71
 
{
72
 
    delete(_wavheader);
73
 
};
74
 
uint32_t        AVDMProcessAudio_Null::grab(uint8_t *obuffer)
75
 
{
76
 
uint32_t rdall=0;
77
 
  rdall = _instream->readDecompress(1000, obuffer);
78
 
  if (rdall == 0)
79
 
              return MINUS_ONE; // we could not get a single byte ! End of stream
80
 
  return rdall;
81
 
}
82
 
uint8_t  AVDMProcessAudio_Null::goToTime(uint32_t newoffset)
83
 
{
84
 
         _instream->goToTime(_start_time);
85
 
         if(newoffset)
86
 
         {
87
 
                printf("AFNull: MMm Null not going to 0 ?\n");
88
 
         }
89
 
        return 1;
90
 
}
91
 
 
92
 
// EOF