org.jmythapi.protocol.impl
Class RemoteEncoder

java.lang.Object
  extended by org.jmythapi.protocol.impl.RemoteEncoder
All Implemented Interfaces:
IVersionable, IRemoteEncoder

public class RemoteEncoder
extends Object
implements IVersionable, IRemoteEncoder

TODO: what exactly is the difference between a Recorder and a RemoteEncoder?


Constructor Summary
RemoteEncoder(IBackendConnection mythtvConnection, int encoderID)
           
 
Method Summary
 boolean cancelNextRecording(Boolean cancel)
          Tells the encoder to cancel the next recording.
 IInputInfoTuned getBusyInput()
          Queries the currently used input of a busy encoder.
 IInputInfoTuned getBusyInput(Integer timeBuffer)
          Queries the input that will be used by the encoder in the given amount of seconds.
 IRemoteEncoderBusyStatus getBusyStatus()
          Query the current busy status of the recorder.
 IRemoteEncoderBusyStatus getBusyStatus(Integer timeBuffer)
          Query the current busy status of the recorder.
 IProgramInfo getCurrentRecording()
          Returns the encoders current recording.
 RemoteEncoderFlags getFlags()
          Gets additional information about the current encoder state.
 IFreeInputList getFreeInputs()
          Gets the free inputs of the encoder.
 List<IInputInfo> getInputs()
          Gets a list of all inputs of the encoder.
 long getMaxBitrate()
          Gets the maximum bitrate the encoder can output.
 IProgramRecordingStatus getRecordingStatus()
          Gets the current recording status of the tuner.
 int getRemoteEncoderID()
          Gets the ID of this remote encoder.
 ISleepStatus getSleepStatus()
          Gets the current sleep status of the encoder.
 IRemoteEncoderState getState()
          Returns the current encoder state (TvState).
 ProtocolVersion getVersionNr()
          Gets the protocol-version of an object.
 boolean isBusy()
          Query whether the recorder is currently busy.
 boolean isBusy(Integer timeBuffer)
          Query whether the recorder is busy, or will be within the next time_buffer seconds.
 boolean matchesRecording(IProgramInfo programInfo)
          Checks if this encoder is currently recording the given recording.
 boolean matchesRecording(List<String> programInfoArgs)
           
 boolean startRecording(IProgramInfo programInfo)
          TODO: is it possible to pass in a Nextrecorderproiinfo here?
 boolean startRecording(List<String> programInfoArgs)
           
 boolean stopRecording()
          Stop a currently active recording on the given recorder.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteEncoder

public RemoteEncoder(IBackendConnection mythtvConnection,
                     int encoderID)
Method Detail

getVersionNr

public ProtocolVersion getVersionNr()
Description copied from interface: IVersionable
Gets the protocol-version of an object.

Specified by:
getVersionNr in interface IVersionable
Returns:
the version a given object was created for.

getRemoteEncoderID

public int getRemoteEncoderID()
Description copied from interface: IRemoteEncoder
Gets the ID of this remote encoder.

Specified by:
getRemoteEncoderID in interface IRemoteEncoder
Returns:
the remote encoder ID.

getMaxBitrate

public long getMaxBitrate()
                   throws IOException
Description copied from interface: IRemoteEncoder
Gets the maximum bitrate the encoder can output.

Specified by:
getMaxBitrate in interface IRemoteEncoder
Throws:
IOException - on communication errors
See Also:
QUERY_REMOTEENCODER_GET_MAX_BITRATE

getSleepStatus

public ISleepStatus getSleepStatus()
                            throws IOException
Description copied from interface: IRemoteEncoder
Gets the current sleep status of the encoder.

Specified by:
getSleepStatus in interface IRemoteEncoder
Returns:
the current sleep status of the encoder.
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_GET_SLEEPSTATUS

getState

public IRemoteEncoderState getState()
                             throws IOException
Description copied from interface: IRemoteEncoder
Returns the current encoder state (TvState).

For example an idle encoder is in the state NONE, whereas a encoder recording a scheduled program is in the state RECORDING_ONLY.

See State for all available states.

Specified by:
getState in interface IRemoteEncoder
Returns:
the remote-encoder state
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_GET_STATE

getFlags

public RemoteEncoderFlags getFlags()
                            throws IOException
Description copied from interface: IRemoteEncoder
Gets additional information about the current encoder state.

In addition to the encoder-state, various other flags can be checked to get further information.
For example an idle encoder may currently fetch EIT informations (See EIT_SCANNER_RUNNING).

See Flags for all available flags.

Specified by:
getFlags in interface IRemoteEncoder
Returns:
additional information about the current encoder state.
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_GET_FLAGS

isBusy

public boolean isBusy()
               throws IOException
Description copied from interface: IRemoteEncoder
Query whether the recorder is currently busy.

Specified by:
isBusy in interface IRemoteEncoder
Returns:
true if the encoder is currently busy.
Throws:
IOException - on communication errors.
See Also:
IRemoteEncoder.isBusy(Integer)

isBusy

public boolean isBusy(Integer timeBuffer)
               throws IOException
Description copied from interface: IRemoteEncoder
Query whether the recorder is busy, or will be within the next time_buffer seconds.

Specified by:
isBusy in interface IRemoteEncoder
Returns:
true if the encoder is currently busy or will be busy in the given amount of seconds.
Throws:
IOException - on communication errors.
See Also:
IRemoteEncoder.getBusyStatus(Integer)

getBusyStatus

public IRemoteEncoderBusyStatus getBusyStatus()
                                       throws IOException
Description copied from interface: IRemoteEncoder
Query the current busy status of the recorder.

If the encoder is busy the response includes informations about the busy encoder input device (since 37).

Specified by:
getBusyStatus in interface IRemoteEncoder
Returns:
the current busy status, including informations about the busy input device.
Throws:
IOException
See Also:
IRemoteEncoder.getBusyStatus(Integer), QUERY_REMOTEENCODER_IS_BUSY

getBusyStatus

public IRemoteEncoderBusyStatus getBusyStatus(Integer timeBuffer)
                                       throws IOException
Description copied from interface: IRemoteEncoder

Query the current busy status of the recorder.

Specified by:
getBusyStatus in interface IRemoteEncoder
Parameters:
timeBuffer - in seconds (Since 37)
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_IS_BUSY

getBusyInput

public IInputInfoTuned getBusyInput()
                             throws IOException
Description copied from interface: IRemoteEncoder
Queries the currently used input of a busy encoder.

This function internally uses IRemoteEncoder.getBusyStatus() to determine the current encoder status.

Specified by:
getBusyInput in interface IRemoteEncoder
Returns:
the busy input or null if the encoder is not busy
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_IS_BUSY

getBusyInput

public IInputInfoTuned getBusyInput(Integer timeBuffer)
                             throws IOException
Description copied from interface: IRemoteEncoder
Queries the input that will be used by the encoder in the given amount of seconds.

This function internally uses IRemoteEncoder.getBusyStatus(Integer) to determine the encoder status.

Specified by:
getBusyInput in interface IRemoteEncoder
Parameters:
timeBuffer - in seconds (Since 37)
Returns:
the busy input or null if the encoder is not busy
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_IS_BUSY

getInputs

public List<IInputInfo> getInputs()
                           throws IOException
Description copied from interface: IRemoteEncoder
Gets a list of all inputs of the encoder.

This method internally uses IRemoteEncoder.getFreeInputs() to determine all free inputs and IRemoteEncoder.getBusyInput() to get the currently used input.

Usage Example:


 IRemoteEncoder encoder = ...; // an already connected encoder
  
 List<IInputInfo> allInputs = encoder.getInputs();
 for(IInputInfo input : allInputs) {
    System.out.println(String.format(
       "Input %d (name: %s, source: %d, card: %d, multiplex: %d) is %s.",
       input.getInputID(),
       input.getInputName(),
       input.getSourceID(),
       input.getCardID(),
       input.getMultiplexID(),
       input.isBusy()?"busy":"idle"
    ));
  }
  
  

Specified by:
getInputs in interface IRemoteEncoder
Returns:
a list of all inputs of this encoder.
Throws:
IOException - on communication errors.
See Also:
IRemoteEncoder.getFreeInputs(), IRemoteEncoder.getBusyInput(), QUERY_REMOTEENCODER_GET_FREE_INPUTS, QUERY_REMOTEENCODER_IS_BUSY

getFreeInputs

public IFreeInputList getFreeInputs()
                             throws IOException
Description copied from interface: IRemoteEncoder
Gets the free inputs of the encoder.

Specified by:
getFreeInputs in interface IRemoteEncoder
Returns:
a list of free inputs or null if there is no free input.
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_GET_FREE_INPUTS

matchesRecording

public boolean matchesRecording(IProgramInfo programInfo)
                         throws IOException
Description copied from interface: IRemoteEncoder
Checks if this encoder is currently recording the given recording.

Specified by:
matchesRecording in interface IRemoteEncoder
Parameters:
programInfo - the recording to check.
Returns:
true if the encoder is currently recording the given program.
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_MATCHES_RECORDING, IRemoteEncoder.matchesRecording(IProgramInfo)

matchesRecording

public boolean matchesRecording(List<String> programInfoArgs)
                         throws IOException
Throws:
IOException

startRecording

public boolean startRecording(IProgramInfo programInfo)
                       throws IOException
Description copied from interface: IRemoteEncoder
TODO: is it possible to pass in a Nextrecorderproiinfo here?

Specified by:
startRecording in interface IRemoteEncoder
Parameters:
programInfo - the recording to start
Returns:
true on success
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_START_RECORDING

startRecording

public boolean startRecording(List<String> programInfoArgs)
                       throws IOException
Throws:
IOException

stopRecording

public boolean stopRecording()
                      throws IOException
Description copied from interface: IRemoteEncoder
Stop a currently active recording on the given recorder.

Specified by:
stopRecording in interface IRemoteEncoder
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_STOP_RECORDING

getCurrentRecording

public IProgramInfo getCurrentRecording()
                                 throws IOException
Description copied from interface: IRemoteEncoder
Returns the encoders current recording.

Usage Note:

According to the MythTV Player homepage the backend may crash if this function is called on an idle encoder. Therefore this function first checks via a call to IRemoteEncoder.isBusy() if this encoder is busy and if it is not, it just returns null.

Specified by:
getCurrentRecording in interface IRemoteEncoder
Returns:
the current recording, or null if the encoder is currently not recording.
Throws:
IOException - on communication errors
See Also:
QUERY_REMOTEENCODER_GET_CURRENT_RECORDING

getRecordingStatus

public IProgramRecordingStatus getRecordingStatus()
                                           throws IOException
Description copied from interface: IRemoteEncoder
Gets the current recording status of the tuner.

Protocol Version Hint:

If this function is called prior to protocol-version 63, this function uses IRemoteEncoder.getCurrentRecording() to get the current recording and calls IProgramInfo.getRecordingStatus() afterwards, to determine the current recording status. If there is no current recording, null is returned.

Specified by:
getRecordingStatus in interface IRemoteEncoder
Returns:
the recording status or null if unknown.
Throws:
IOException - on communication errors.
See Also:
QUERY_REMOTEENCODER_GET_RECORDING_STATUS

cancelNextRecording

public boolean cancelNextRecording(Boolean cancel)
                            throws IOException
Description copied from interface: IRemoteEncoder
Tells the encoder to cancel the next recording.

This is used when the user is watching "Live TV" and does not want to allow the recorder to be taken for a pending recording.

Specified by:
cancelNextRecording in interface IRemoteEncoder
Parameters:
cancel - if the next recording should be canceled or continued.
Throws:
IOException - on communication errors
See Also:
QUERY_REMOTEENCODER_CANCEL_NEXT_RECORDING

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2013. All Rights Reserved.