functions to

o reset Audio format
o get current payload

(quiz? what comes next?)



git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@819 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 19 years ago
parent 39bf65f2f6
commit ec59caa0f6

@ -223,6 +223,10 @@ void AmAudioFormat::destroyCodec()
codec = NULL;
}
void AmAudioFormat::resetCodec() {
codec = NULL;
getCodec();
}
amci_codec_t* AmAudioFormat::getCodec()
{
@ -270,6 +274,11 @@ AmAudio::~AmAudio()
#endif
}
void AmAudio::setFormat(AmAudioFormat* new_fmt) {
fmt.reset(new_fmt);
fmt->resetCodec();
}
void AmAudio::close()
{
}
@ -495,8 +504,6 @@ void DblBuffer::swap()
active_buf = !active_buf;
}
int AmAudioRtpFormat::getCodecId()
{
if(!m_currentPayloadP){

@ -109,11 +109,11 @@ public:
int channels;
/** Sampling rate. */
int rate;
/* frame length in samples (frame based codecs) */
/* frame length in ms (frame based codecs) - unused */
int frame_length;
/* frame size in bytes */
/* frame size in samples */
int frame_size;
/* encoded frame size in bytes */
/* encoded frame size in bytes - unused */
int frame_encoded_size;
string sdp_format_parameters;
@ -122,7 +122,9 @@ public:
virtual ~AmAudioFormat();
/** @return The format's codec pointer. */
amci_codec_t* getCodec();
virtual amci_codec_t* getCodec();
void resetCodec();
/** @return Handler returned by the codec's init function.*/
long getHCodec();
long getHCodecNoInit() { return h_codec; } // do not initialize
@ -158,7 +160,7 @@ class AmAudioSimpleFormat: public AmAudioFormat
int codec_id;
protected:
int getCodecId() { return codec_id; }
virtual int getCodecId() { return codec_id; }
public:
AmAudioSimpleFormat(int codec_id);
@ -176,7 +178,7 @@ class AmAudioRtpFormat: public AmAudioFormat
std::map<int, CodecContainer *> m_codecContainerByPayload;
protected:
int getCodecId();
virtual int getCodecId();
public:
/**
@ -191,6 +193,8 @@ public:
* changes payload. returns != 0 on error.
*/
int setCurrentPayload(int payload);
int getCurrentPayload() { return m_currentPayload; };
};
/**
@ -299,6 +303,8 @@ public:
int incRecordTime(unsigned int samples);
void setBufferedOutput(unsigned int buffer_size);
void setFormat(AmAudioFormat* new_fmt);
};

@ -54,20 +54,15 @@ public:
* @param subtype Subtype for the file format (see amci.h).
*/
AmAudioFileFormat(const string& name, int subtype = -1);
/**
* Constructor for file based formats.
* All information are taken from the file descriptor.
* @param name The file format name (ex. "Wav").
* @param fd A file descriptor filled by the a plug-in's open function.
*/
AmAudioFileFormat(const string& name, const amci_file_desc_t* fd);
virtual ~AmAudioFileFormat() { }
/** @return Format name. */
string getName() { return name; }
/** @return Format subtype. */
int getSubtypeId() { return subtype; }
/** @return Subtype pointer. */
amci_subtype_t* getSubtype();
virtual amci_subtype_t* getSubtype();
void setSubtypeId(int subtype_id);
};
@ -104,7 +99,7 @@ protected:
int write(unsigned int user_ts, unsigned int size);
/** @return a file format from file name. (ex: '1234.wav') */
AmAudioFileFormat* fileName2Fmt(const string& name);
virtual AmAudioFileFormat* fileName2Fmt(const string& name);
/** internal function for opening the file */
int fpopen_int(const string& filename, OpenMode mode, FILE* n_fp);

@ -157,6 +157,10 @@ int AmRtpAudio::setCurrentPayload(int payload)
return res;
}
int AmRtpAudio::getCurrentPayload() {
return ((AmAudioRtpFormat *) fmt.get())->getCurrentPayload();
}
unsigned int AmRtpAudio::conceal_loss(unsigned int ts_diff, unsigned char *buffer)
{
int s=0;

@ -100,6 +100,7 @@ public:
bool sendIntReached();
int setCurrentPayload(int payload);
int getCurrentPayload();
int receive(unsigned int wallclock_ts);

Loading…
Cancel
Save