public class BlockThreadManager
extends java.lang.Object
implements java.lang.Runnable
Constructor and Description |
---|
BlockThreadManager(FLACEncoder encoder)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addFrameThread(Frame frame)
Add a Frame to this manager, which it will use to encode a block.
|
boolean |
addRequest(BlockEncodeRequest ber)
Add a BlockEncodeRequest to the manager.
|
void |
blockWhileQueueExceeds(int count)
This function is used to help control flow of BlockEncodeRequests into
this manager.
|
int |
getTotalManagedCount()
Get total number of BlockEncodeRequests added to this manager, but not
yet passed back to the FLACEncoder object.
|
BlockEncodeRequest |
getWaitingRequest()
Get a BlockEncodeRequest object which is queued for encoding, pausing for
up to 0.5 seconds till one is available.
|
void |
notifyFrameThreadExit(FrameThread ft)
Notify this manager that a FrameThread has ended it's run() method,
returning the FrameThread object to the manager for use in future Threads.
|
void |
returnFinishedRequest(BlockEncodeRequest ber)
Used to return a finished BlockEncodeRequest from a FrameThread.
|
void |
run()
Waits for the next BlockEncodeRequest that needs to be sent back to the
FLACEncoder for finalizing.
|
void |
stop()
Notify this manager that it may stop as soon as all currently outstanding
requests are completed.
|
public BlockThreadManager(FLACEncoder encoder)
encoder
- FLACEncoder to use in encoding process.public int getTotalManagedCount()
public void blockWhileQueueExceeds(int count)
count
- Maximum number of outstanding requests that may exist before
this method may return.public boolean addFrameThread(Frame frame)
frame
- Frame to use for encoding.public void notifyFrameThreadExit(FrameThread ft)
ft
- FrameThread object which is ending.public BlockEncodeRequest getWaitingRequest()
public void stop()
public void returnFinishedRequest(BlockEncodeRequest ber)
ber
- finished BlockEncodeRequest that needs passed back to the
FLACEncoder object.public void run()
run
in interface java.lang.Runnable
public boolean addRequest(BlockEncodeRequest ber)
ber
- Block request to encode