summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/frame/audioFrame.cpp
blob: 55464afa53d8491adc6c3737b0795194b61b62a8 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
  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

 */



#include "audioFrame.h"

#include <iostream>

using namespace std;

AudioFrame::AudioFrame() {
  
  stereo=-1;
  frequencyHZ=-1;

  sampleSize=-1;
  lBigEndian=-1;
  lSigned=-1;
  setFrameType(_FRAME_AUDIO_BASE);
}


AudioFrame::~AudioFrame() {
}


int AudioFrame::getLen() {
  cout << "direct virtual call AudioFrame::getLen"<<endl;
  return 0;
}


void AudioFrame::setLen(int ) {
  cout << "direct virtual call AudioFrame::setLen"<<endl;
}


int AudioFrame::getSize() {
  cout << "direct virtual call AudioFrame::getSize"<<endl;
  return 0;
}


void AudioFrame::putFloatData(float* ,int ) {
  cout << "direct virtual call AudioFrame::putFloatData"<<endl;
}

void AudioFrame::putFloatData(float* ,float* ,int ) {
  cout << "direct virtual call AudioFrame::putFloatData L/R version"<<endl;
}

void AudioFrame::clearrawdata() {
  cout << "direct virtual call AudioFrame::clearrawdata"<<endl;
}

void AudioFrame::setFrameFormat(int stereo,int freq) {
  this->stereo=stereo;
  this->frequencyHZ=freq;
}



int AudioFrame::isFormatEqual(AudioFrame* compare) {
  if(compare->getStereo() != stereo) {
    return false;
  }
  if(compare->getSampleSize() != sampleSize) {
    return false;
  }
  if(compare->getBigEndian() != lBigEndian) {
    return false;
  }
  if(compare->getFrequenceHZ() != frequencyHZ) {
    return false;
  }
  if(compare->getSigned() != lSigned) {
    return false;
  }
  return true;
}

void AudioFrame::print(const char* msg) {
  cout << "PCMFrame::print:"<<msg<<endl;
  cout << "stereo:"<<stereo<<endl;
  cout << "sampleSize:"<<sampleSize<<endl;
  cout << "lBigEndian:"<<lBigEndian<<endl;
  cout << "frequencyHZ:"<<frequencyHZ<<endl;
  cout << "lSigned:"<<lSigned<<endl;
}


void AudioFrame::copyFormat(AudioFrame* dest) {
  if (dest->getFrameType() != _FRAME_AUDIO_BASE) {
    cout << "cannot copy frameFormat into frametype!= _FRAME_AUDIO_BASE"<<endl;
    exit(0);
  }
  dest->setFrameFormat(getStereo(),getFrequenceHZ());
  dest->sampleSize=getSampleSize();
  dest->lBigEndian=getBigEndian();
  dest->lSigned=getSigned();
}