Package com.biglybt.core.devices.impl
Class TranscodeQueueImpl
- java.lang.Object
-
- com.biglybt.core.devices.impl.TranscodeQueueImpl
-
- All Implemented Interfaces:
TranscodeQueue
public class TranscodeQueueImpl extends java.lang.Object implements TranscodeQueue
-
-
Field Summary
Fields Modifier and Type Field Description private CopyOnWriteList<TranscodeQueueActionListener>
action_listeners
private AsyncDispatcher
anaylsis_dispatcher
(package private) boolean
config_dirty
private static java.lang.String
CONFIG_FILE
private TranscodeJobImpl
current_job
private static java.lang.Object
KEY_XCODE_ERROR
private CopyOnWriteList<TranscodeQueueListener>
listeners
private TranscodeManagerImpl
manager
(package private) int
max_bytes_per_sec
(package private) boolean
paused
(package private) java.util.List<TranscodeJobImpl>
queue
(package private) AESemaphore
queue_sem
(package private) AEThread2
queue_thread
-
Constructor Summary
Constructors Modifier Constructor Description protected
TranscodeQueueImpl(TranscodeManagerImpl _manager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TranscodeJobImpl
add(TranscodeTarget target, TranscodeProfile profile, DiskManagerFileInfo file, boolean add_stopped)
TranscodeJobImpl
add(TranscodeTarget target, TranscodeProfile profile, DiskManagerFileInfo file, boolean add_stopped, boolean stream, int transcode_requirement)
TranscodeJobImpl
add(TranscodeTarget target, TranscodeProfile profile, DiskManagerFileInfo file, int transcode_requirement, boolean add_stopped)
void
addActionListener(TranscodeQueueActionListener listener)
void
addListener(TranscodeQueueListener listener)
protected TranscodeProviderAnalysis
analyse(TranscodeJobImpl job)
protected void
analyse(TranscodeJobImpl job, TranscodeAnalysisListener listener)
protected void
checkJobStatus()
protected void
close()
protected void
configDirty()
void
generate(IndentWriter writer)
TranscodeJob
getCurrentJob()
protected int
getIndex(TranscodeJobImpl job)
protected TranscodeJobImpl
getJob(TranscodeFile for_file)
int
getJobCount()
TranscodeJobImpl[]
getJobs()
long
getMaxBytesPerSecond()
protected void
initialise()
boolean
isPaused()
boolean
isTranscoding()
protected void
jobChanged(TranscodeJob job, boolean schedule, boolean persistable)
protected void
loadConfig()
protected void
log(java.lang.String str)
protected void
log(java.lang.String str, java.lang.Throwable e)
protected DiskManagerFileInfo
lookupFile(byte[] hash, int index)
protected TranscodeProfile
lookupProfile(java.lang.String profile_id)
protected TranscodeTarget
lookupTarget(java.lang.String target_id)
void
moveDown(TranscodeJobImpl job)
void
moveUp(TranscodeJobImpl job)
void
pause()
protected boolean
process(TranscodeJobImpl job)
protected void
remove(TranscodeJobImpl job, boolean force)
void
removeActionListener(TranscodeQueueActionListener listener)
void
removeListener(TranscodeQueueListener listener)
void
resume()
protected void
saveConfig()
protected void
schedule()
void
setMaxBytesPerSecond(long max)
protected void
updateStatus(int tick_count)
-
-
-
Field Detail
-
CONFIG_FILE
private static final java.lang.String CONFIG_FILE
- See Also:
- Constant Field Values
-
KEY_XCODE_ERROR
private static final java.lang.Object KEY_XCODE_ERROR
-
manager
private TranscodeManagerImpl manager
-
queue
java.util.List<TranscodeJobImpl> queue
-
queue_sem
AESemaphore queue_sem
-
queue_thread
AEThread2 queue_thread
-
current_job
private volatile TranscodeJobImpl current_job
-
anaylsis_dispatcher
private AsyncDispatcher anaylsis_dispatcher
-
listeners
private CopyOnWriteList<TranscodeQueueListener> listeners
-
action_listeners
private CopyOnWriteList<TranscodeQueueActionListener> action_listeners
-
paused
volatile boolean paused
-
max_bytes_per_sec
volatile int max_bytes_per_sec
-
config_dirty
volatile boolean config_dirty
-
-
Constructor Detail
-
TranscodeQueueImpl
protected TranscodeQueueImpl(TranscodeManagerImpl _manager)
-
-
Method Detail
-
initialise
protected void initialise()
-
process
protected boolean process(TranscodeJobImpl job)
-
schedule
protected void schedule()
-
updateStatus
protected void updateStatus(int tick_count)
-
checkJobStatus
protected void checkJobStatus()
-
add
public TranscodeJobImpl add(TranscodeTarget target, TranscodeProfile profile, DiskManagerFileInfo file, boolean add_stopped) throws TranscodeException
- Specified by:
add
in interfaceTranscodeQueue
- Throws:
TranscodeException
-
add
public TranscodeJobImpl add(TranscodeTarget target, TranscodeProfile profile, DiskManagerFileInfo file, int transcode_requirement, boolean add_stopped) throws TranscodeException
- Specified by:
add
in interfaceTranscodeQueue
- Throws:
TranscodeException
-
add
public TranscodeJobImpl add(TranscodeTarget target, TranscodeProfile profile, DiskManagerFileInfo file, boolean add_stopped, boolean stream, int transcode_requirement) throws TranscodeException
- Throws:
TranscodeException
-
remove
protected void remove(TranscodeJobImpl job, boolean force) throws TranscodeActionVetoException
- Throws:
TranscodeActionVetoException
-
jobChanged
protected void jobChanged(TranscodeJob job, boolean schedule, boolean persistable)
-
getIndex
protected int getIndex(TranscodeJobImpl job)
-
getJobs
public TranscodeJobImpl[] getJobs()
- Specified by:
getJobs
in interfaceTranscodeQueue
-
getJobCount
public int getJobCount()
- Specified by:
getJobCount
in interfaceTranscodeQueue
-
getCurrentJob
public TranscodeJob getCurrentJob()
- Specified by:
getCurrentJob
in interfaceTranscodeQueue
-
isTranscoding
public boolean isTranscoding()
- Specified by:
isTranscoding
in interfaceTranscodeQueue
-
getJob
protected TranscodeJobImpl getJob(TranscodeFile for_file)
-
moveUp
public void moveUp(TranscodeJobImpl job)
-
moveDown
public void moveDown(TranscodeJobImpl job)
-
pause
public void pause()
- Specified by:
pause
in interfaceTranscodeQueue
-
isPaused
public boolean isPaused()
- Specified by:
isPaused
in interfaceTranscodeQueue
-
resume
public void resume()
- Specified by:
resume
in interfaceTranscodeQueue
-
getMaxBytesPerSecond
public long getMaxBytesPerSecond()
- Specified by:
getMaxBytesPerSecond
in interfaceTranscodeQueue
-
setMaxBytesPerSecond
public void setMaxBytesPerSecond(long max)
- Specified by:
setMaxBytesPerSecond
in interfaceTranscodeQueue
-
lookupTarget
protected TranscodeTarget lookupTarget(java.lang.String target_id) throws TranscodeException
- Throws:
TranscodeException
-
lookupProfile
protected TranscodeProfile lookupProfile(java.lang.String profile_id) throws TranscodeException
- Throws:
TranscodeException
-
lookupFile
protected DiskManagerFileInfo lookupFile(byte[] hash, int index) throws TranscodeException
- Throws:
TranscodeException
-
analyse
protected void analyse(TranscodeJobImpl job, TranscodeAnalysisListener listener) throws TranscodeException
- Throws:
TranscodeException
-
analyse
protected TranscodeProviderAnalysis analyse(TranscodeJobImpl job) throws TranscodeException
- Throws:
TranscodeException
-
configDirty
protected void configDirty()
-
loadConfig
protected void loadConfig()
-
saveConfig
protected void saveConfig()
-
close
protected void close()
-
addListener
public void addListener(TranscodeQueueListener listener)
- Specified by:
addListener
in interfaceTranscodeQueue
-
removeListener
public void removeListener(TranscodeQueueListener listener)
- Specified by:
removeListener
in interfaceTranscodeQueue
-
addActionListener
public void addActionListener(TranscodeQueueActionListener listener)
- Specified by:
addActionListener
in interfaceTranscodeQueue
-
removeActionListener
public void removeActionListener(TranscodeQueueActionListener listener)
- Specified by:
removeActionListener
in interfaceTranscodeQueue
-
log
protected void log(java.lang.String str)
-
log
protected void log(java.lang.String str, java.lang.Throwable e)
-
generate
public void generate(IndentWriter writer)
-
-