[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    Re: Network Streaming
From:       Stefan Westerfeld <stefan () space ! twc ! de>
Date:       2000-12-05 19:34:37
[Download RAW message or body]

   Hi!

On Tue, Dec 05, 2000 at 03:59:28PM +0100, Martin Vogt wrote:
> On Tue, Dec 05, 2000 at 03:17:27PM +0100, Stefan Westerfeld wrote:
> > It's right, the interfaces are missing, although I am not sure you need to
> > care about threading here. How about something along the lines:
> >
> You need.
> The codec polls after some time (decoded mp3 frame) for example
> the eof method of the input.
> If the gui decided to shutdown the connection with a close
> call you have a race.
> The usual way to handle this is to make a global mutex lock
> around the class.

You can implement a streaming .wav codec (without threading or locking):

void StreamingWavCodec::calculateBlock(long samples)
{
	if(initializing)
	{
		if(receivedBytes() > headerlen)
		{
			[analyze header]
			initializing = false;
		}
	}
	else
	{
		if(receivedBytes() > samples*samplesize)
		{
			[convert received bytes to the output]
			return;
		}
	}
	[write zero samples]
}

I suppose you can do the same for mp3, but with our current already
multithreaded mpeglib routines, the way to go would might be to provide
an ArtsInputStream besides the ArtsOutputStream. So the data would be
received trough the Arts::PlayObject interface, read by mpeglib through
the ArtsInputStream, decoded by the decoder in a second thread, read back
from the PlayObject through the ArtsOutputStream, and finally converted
and inserted into the flowsystem there.

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan@space.twc.de (PGP!), Hamburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-         
_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic