Package com.biglybt.core.devices.impl
Class TranscodeJobImpl
- java.lang.Object
-
- com.biglybt.core.devices.impl.TranscodeJobImpl
-
- All Implemented Interfaces:
TranscodeJob
,DownloadWillBeRemovedListener
public class TranscodeJobImpl extends java.lang.Object implements TranscodeJob, DownloadWillBeRemovedListener
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
auto_retry
private int
auto_retry_count
private boolean
auto_retry_enabled
private Download
download
private boolean
download_ok
private java.lang.String
error
private int
eta
private DiskManagerFileInfo
file
private boolean
is_stream
private long
paused_on
private int
percent_complete
private boolean
prefer_direct_input
private long
process_time
private TranscodeProfile
profile
private TranscodeQueueImpl
queue
private long
started_on
private int
state
private java.io.InputStream
stream
private AESemaphore
stream_sem
private TranscodeTarget
target
private TranscodeFileImpl
transcode_file
private static int
TRANSCODE_OK_DL_PERCENT
private int
transcode_requirement
private boolean
use_direct_input
-
Fields inherited from interface com.biglybt.core.devices.TranscodeJob
ST_CANCELLED, ST_COMPLETE, ST_FAILED, ST_PAUSED, ST_QUEUED, ST_REMOVED, ST_RUNNING, ST_STOPPED
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TranscodeJobImpl(TranscodeQueueImpl _queue, TranscodeTarget _target, TranscodeProfile _profile, DiskManagerFileInfo _file, boolean _add_stopped, int _transcode_requirement, boolean _is_stream)
protected
TranscodeJobImpl(TranscodeQueueImpl _queue, java.util.Map<java.lang.String,java.lang.Object> map)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
analyseNow(TranscodeAnalysisListener listener)
boolean
canPause()
protected boolean
canUseDirectInput()
protected void
complete()
protected void
destroy()
void
downloadWillBeRemoved(Download download)
protected void
failed(java.lang.Throwable e)
void
generate(IndentWriter writer)
protected int
getAutoRetryCount()
protected DeviceImpl
getDevice()
long
getDownloadETA()
boolean
getEnableAutoRetry()
java.lang.String
getError()
java.lang.String
getETA()
long
getETASecs()
DiskManagerFileInfo
getFile()
int
getIndex()
java.lang.String
getName()
int
getPercentComplete()
boolean
getPreferDirectInput()
long
getProcessTime()
TranscodeProfile
getProfile()
int
getState()
protected java.io.InputStream
getStream(int wait_for_millis)
TranscodeTarget
getTarget()
TranscodeFileImpl
getTranscodeFile()
int
getTranscodeRequirement()
protected void
init()
protected boolean
isAutoRetry()
protected boolean
isStream()
void
moveDown()
void
moveUp()
void
pause()
void
queue()
void
remove()
void
removeForce()
protected void
reset()
void
resume()
protected void
setAutoRetry(boolean _auto_retry)
void
setEnableAutoRetry(boolean enabled)
void
setPreferDirectInput(boolean prefer)
protected void
setStream(java.io.InputStream _stream)
protected void
setUseDirectInput()
protected void
starts()
void
stop()
protected java.util.Map<java.lang.String,java.lang.Object>
toMap()
protected void
updateProgress(int _done, int _eta)
protected void
updateStatus()
protected void
updateStatus(boolean report_change)
protected boolean
useDirectInput()
-
-
-
Field Detail
-
TRANSCODE_OK_DL_PERCENT
private static final int TRANSCODE_OK_DL_PERCENT
- See Also:
- Constant Field Values
-
queue
private TranscodeQueueImpl queue
-
target
private TranscodeTarget target
-
profile
private TranscodeProfile profile
-
file
private DiskManagerFileInfo file
-
transcode_file
private TranscodeFileImpl transcode_file
-
is_stream
private boolean is_stream
-
stream
private volatile java.io.InputStream stream
-
stream_sem
private AESemaphore stream_sem
-
transcode_requirement
private int transcode_requirement
-
state
private int state
-
percent_complete
private int percent_complete
-
eta
private int eta
-
error
private java.lang.String error
-
started_on
private long started_on
-
paused_on
private long paused_on
-
process_time
private long process_time
-
use_direct_input
private boolean use_direct_input
-
prefer_direct_input
private boolean prefer_direct_input
-
auto_retry_enabled
private boolean auto_retry_enabled
-
auto_retry
private boolean auto_retry
-
auto_retry_count
private int auto_retry_count
-
download
private Download download
-
download_ok
private volatile boolean download_ok
-
-
Constructor Detail
-
TranscodeJobImpl
protected TranscodeJobImpl(TranscodeQueueImpl _queue, TranscodeTarget _target, TranscodeProfile _profile, DiskManagerFileInfo _file, boolean _add_stopped, int _transcode_requirement, boolean _is_stream) throws TranscodeException
- Throws:
TranscodeException
-
TranscodeJobImpl
protected TranscodeJobImpl(TranscodeQueueImpl _queue, java.util.Map<java.lang.String,java.lang.Object> map) throws java.io.IOException, TranscodeException
- Throws:
java.io.IOException
TranscodeException
-
-
Method Detail
-
toMap
protected java.util.Map<java.lang.String,java.lang.Object> toMap() throws java.io.IOException
- Throws:
java.io.IOException
-
init
protected void init() throws TranscodeException
- Throws:
TranscodeException
-
updateStatus
protected void updateStatus()
-
updateStatus
protected void updateStatus(boolean report_change)
-
getDownloadETA
public long getDownloadETA()
- Specified by:
getDownloadETA
in interfaceTranscodeJob
-
canUseDirectInput
protected boolean canUseDirectInput()
-
useDirectInput
protected boolean useDirectInput()
-
setUseDirectInput
protected void setUseDirectInput()
-
setPreferDirectInput
public void setPreferDirectInput(boolean prefer)
- Specified by:
setPreferDirectInput
in interfaceTranscodeJob
-
getPreferDirectInput
public boolean getPreferDirectInput()
- Specified by:
getPreferDirectInput
in interfaceTranscodeJob
-
setAutoRetry
protected void setAutoRetry(boolean _auto_retry)
-
isAutoRetry
protected boolean isAutoRetry()
-
getAutoRetryCount
protected int getAutoRetryCount()
-
setEnableAutoRetry
public void setEnableAutoRetry(boolean enabled)
- Specified by:
setEnableAutoRetry
in interfaceTranscodeJob
-
getEnableAutoRetry
public boolean getEnableAutoRetry()
- Specified by:
getEnableAutoRetry
in interfaceTranscodeJob
-
isStream
protected boolean isStream()
-
setStream
protected void setStream(java.io.InputStream _stream)
-
getStream
protected java.io.InputStream getStream(int wait_for_millis) throws java.io.IOException
- Throws:
java.io.IOException
-
downloadWillBeRemoved
public void downloadWillBeRemoved(Download download) throws DownloadRemovalVetoException
- Specified by:
downloadWillBeRemoved
in interfaceDownloadWillBeRemovedListener
- Throws:
DownloadRemovalVetoException
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceTranscodeJob
-
reset
protected void reset()
-
starts
protected void starts()
-
failed
protected void failed(java.lang.Throwable e)
-
complete
protected void complete()
-
updateProgress
protected void updateProgress(int _done, int _eta)
-
getTarget
public TranscodeTarget getTarget()
- Specified by:
getTarget
in interfaceTranscodeJob
-
getTranscodeRequirement
public int getTranscodeRequirement()
- Specified by:
getTranscodeRequirement
in interfaceTranscodeJob
-
analyseNow
public void analyseNow(TranscodeAnalysisListener listener) throws TranscodeException
- Specified by:
analyseNow
in interfaceTranscodeJob
- Throws:
TranscodeException
-
getDevice
protected DeviceImpl getDevice()
-
getProfile
public TranscodeProfile getProfile()
- Specified by:
getProfile
in interfaceTranscodeJob
-
getFile
public DiskManagerFileInfo getFile()
- Specified by:
getFile
in interfaceTranscodeJob
-
getTranscodeFile
public TranscodeFileImpl getTranscodeFile()
- Specified by:
getTranscodeFile
in interfaceTranscodeJob
-
getIndex
public int getIndex()
- Specified by:
getIndex
in interfaceTranscodeJob
-
getState
public int getState()
- Specified by:
getState
in interfaceTranscodeJob
-
getPercentComplete
public int getPercentComplete()
- Specified by:
getPercentComplete
in interfaceTranscodeJob
-
getETASecs
public long getETASecs()
- Specified by:
getETASecs
in interfaceTranscodeJob
-
getETA
public java.lang.String getETA()
- Specified by:
getETA
in interfaceTranscodeJob
-
getError
public java.lang.String getError()
- Specified by:
getError
in interfaceTranscodeJob
-
canPause
public boolean canPause()
- Specified by:
canPause
in interfaceTranscodeJob
-
pause
public void pause()
- Specified by:
pause
in interfaceTranscodeJob
-
resume
public void resume()
- Specified by:
resume
in interfaceTranscodeJob
-
queue
public void queue()
- Specified by:
queue
in interfaceTranscodeJob
-
stop
public void stop()
- Specified by:
stop
in interfaceTranscodeJob
-
remove
public void remove() throws TranscodeActionVetoException
- Specified by:
remove
in interfaceTranscodeJob
- Throws:
TranscodeActionVetoException
-
removeForce
public void removeForce()
- Specified by:
removeForce
in interfaceTranscodeJob
-
destroy
protected void destroy()
-
moveUp
public void moveUp()
- Specified by:
moveUp
in interfaceTranscodeJob
-
moveDown
public void moveDown()
- Specified by:
moveDown
in interfaceTranscodeJob
-
getProcessTime
public long getProcessTime()
- Specified by:
getProcessTime
in interfaceTranscodeJob
-
generate
public void generate(IndentWriter writer)
-
-