void Tool::packetdump(char **argv)
{
	PacketStream packetfile;
	const char *path = *argv;
	Encoded buffer;
	Info info;
	ssize_t count;
	
	packetfile.open(argv);

	if(!packetfile.isOpen())
	{
		cerr << "audiotool: " << path << ": unable to access" << endl;
		exit(-1);
	}

	if(!packetfile.isStreamable())
	{
		cerr << "audiotool: " << path << ": missing needed codec" << endl;
		exit(-1);
	}

	packetfile.getInfo(&info);

	buffer = new unsigned char[maxFramesize(info)];

	while((count = packetfile.getPacket(buffer)) > 0)
		cout << "-- " << count << endl;			

	delete[] buffer;
	packetfile.close();		
	exit(0);
}
Beispiel #2
0
void AudioStream::open(const char *fname, Mode m, timeout_t framing)
{
    if(!framing)
        framing = 20;

    close();
    AudioFile::open(fname, m, framing);
    if(!is_open())
        return;

    streamable = true;

    if(is_linear(info.encoding))
        return;

    codec = AudioCodec::get(info);
    if(!codec)
        streamable = false;
    else
        framebuf = new unsigned char[maxFramesize(info)];
}
Beispiel #3
0
void AudioStream::create(const char *fname, Info *info, bool exclusive, timeout_t framing)
{
    if(!framing)
        framing = 20;

    close();
    AudioFile::create(fname, info, exclusive, framing);
    if(!is_open())
        return;

    streamable = true;

    if(is_linear(AudioFile::info.encoding))
        return;

    codec = AudioCodec::get(AudioFile::info);
    if(!codec) {
        streamable = false;
        return;
    }
    framebuf = new unsigned char[maxFramesize(AudioFile::info)];
}