org.jmythapi.protocol.impl
Class Recorder

java.lang.Object
  extended by org.jmythapi.protocol.impl.Recorder
All Implemented Interfaces:
Closeable, IVersionable, IRecorder

public class Recorder
extends Object
implements IVersionable, IRecorder

An implementation of IRecorder.


Constructor Summary
Recorder(IBackendConnection mythtvConnection, int recorderId)
           
 
Method Summary
 IRingBuffer annotateRingBuffer()
          Deprecated. 20
 boolean cancelNextRecording(Boolean cancel)
          Tells the recorder to cancel or continue the next recording.
 Integer changeBrightness(boolean up)
          Changes the brightness of a recording.
 Integer changeBrightness(EPictureAdjustmentType adjustmentType, boolean up)
          Changes the brightness value.
 boolean changeChannel(EChannelChangeDirection direction)
          Changes to the next or previous channel.
 boolean changeChannel(int direction)
          Changes to the next or previous channel.
 Integer changeColour(boolean up)
          Changes the colour of a recording.
 Integer changeColour(EPictureAdjustmentType adjustmentType, boolean up)
          Changes the colour value.
 Integer changeContrast(boolean up)
          Changes the contrast of a recording.
 Integer changeContrast(EPictureAdjustmentType adjustmentType, boolean up)
          Changes the contrast value.
 Integer changeHue(boolean up)
          Changes the hue value of a recording.
 Integer changeHue(EPictureAdjustmentType adjustmentType, boolean up)
          Changes the hue value.
 boolean checkChannel(String channelNumber)
          Checks if named channel exists on current tuner.
 IRecorderChannelPrefixStatus checkChannelPrefix(String channelNumberPrefix)
          Checks a channel-number prefix against the channels in the MythTV-DB.
protected  Object clone()
          Creates a copy of this recorder.
 void close()
          Closes the current recorder connection.
 Map<Long,Long> fillDurationMap(long start, long end)
           
 Map<Long,Long> fillPositionMap(long startFrameNr, long endFrameNr)
          Returns the keyframe position map.
 boolean finishRecording()
          Tells the recorder to stop recording, but only after "overrecord" seconds.
<C extends IBasicChannelInfo>
List<C>
getBasicChannelInfos()
          Gets a list of all known channels.
 Integer getBrightness()
          Gets the brightness of a recording.
 RecorderChannelInfo getChannelInfo(IBasicChannelInfo channelInfo)
          Gets detailed informations about the given channel.
 RecorderChannelInfo getChannelInfo(Integer chanID)
          Gets informations about the given channel.
 List<IRecorderChannelInfo> getChannelInfos()
          Gets a list of all known channels.
 Map<Integer,IRecorderNextProgramInfo> getChannelsNextProgramInfoMap(Date startTime)
          Gets a map containing the next programs of all channels.
 Integer getColour()
          Gets the colour of a recording.
 List<String> getConnectedInputs()
          Deprecated. 37
 Integer getContrast()
          Gets the contrast of a recording.
<C extends IBasicChannelInfo>
C
getCurrentChannel()
          Gets the currently active channel of the recorder.
 IProgramInfo getCurrentRecording()
          Returns the recorders current recording.
 long getFilePosition()
          Returns the total number of bytes written by the recorder.
 float getFrameRate()
          Returns the recording frame rate.
 long getFramesWritten()
          Returns the number of frames written to disk.
 IFreeInputList getFreeInputs()
          Gets all free inputs of the recorder.
 Integer getHue()
          Gets the hue of a recording.
 String getInput()
          Gets the name of the current recorder input.
 String getInputName()
          Deprecated. 21
 long getKeyframePosition(long frameNumber)
          Returs the byte position for the given frame number.
 long getMaxBitrate()
          Gets the maximum bitrate a recorder can output.
 IRecorderNextProgramInfo getNextProgramInfo(IBasicChannelInfo channelInfo, EChannelBrowseDirection direction, Date startTime)
          Gets the next program on the specified channel.
 RecorderNextProgramInfo getNextProgramInfo(String channelNumber, Integer channelID, EChannelBrowseDirection direction, Date startTime)
          Gets the next program on the specified channel.
 List<IRecorderNextProgramInfo> getNextProgramInfos(Date startTime)
          Gets a list containing the next programs of all channels.
 IRecorderProgramInfo getProgramInfo()
          Deprecated. 21
 int getRecorderID()
          Gets the id of this recorder
 ProgramInfo getRecording()
          Returns the recorders current recording.
 IRemoteEncoder getRemoteEncoder()
          Gets the remote-encoder object.
 ProtocolVersion getVersionNr()
          Gets the protocol-version of an object.
 boolean isRecording()
          Checks if the recorder is actually recording.
 boolean pause()
          Tells the recorder to pause a recorder.
 boolean setChannel(String channelNumber)
          Changes to a named channel on the current tuner.
 boolean setInput(String inputName)
          Tells the recorder to change to the specified input.
 boolean setLiveTvRecording()
          Tells the recorder to keep a LiveTV recording.
 boolean setNextLiveTvDirectory(String path)
          Changes LiveTV recording directory.
 int setSignalMonitoringRate(int rate, boolean notifyFrontend)
          Sets the signal monitoring rate.
 boolean setupRingBuffer(boolean pictureInPicture)
          Deprecated. 20
 boolean shouldSwitchCard(Integer channelID)
          Checks if named channel exists on current tuner, or another tuner.
 boolean signalFrontendReady()
          Tells the recorder that the frontend is up and ready.
 boolean spawnLiveTV()
          Tells the recorder to start a "Live TV" recording.
 boolean spawnLiveTV(boolean pictureInPicture, IRecorderChannelInfo recorderChannelInfo)
          Tells the recorder to start a "Live TV" recording.
 boolean spawnLiveTV(boolean pictureInPicture, String channelNumber)
          Tells the recorder to start a "Live TV" recording.
 boolean stopLiveTv()
          Tells the recorder to stop a "Live TV" recording.
 boolean stopPlaying()
          Deprecated. 20
 String switchToNextInput()
          Tells the recorder to switch to the next input.
 boolean toggleChannelFavorite()
          Adds or removes the current channel from the favorite channel list.
 boolean toggleChannelFavorite(String channelGroup)
          Adds or removes the current channel to or from the given channel group.
 boolean toggleInputs()
          Tells the recorder to change to the next input.
 String toString()
           
 long waitForFramesWritten(long desiredFrames)
          Wait for number of frames written.
 boolean waitForIsRecording(long timeoutMs)
          Wait for recording.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Recorder

public Recorder(IBackendConnection mythtvConnection,
                int recorderId)
Method Detail

clone

protected Object clone()
                throws CloneNotSupportedException
Creates a copy of this recorder. Currently the same connection is used as the old recorder.

Overrides:
clone in class Object
Throws:
CloneNotSupportedException

close

public void close()
           throws IOException
Description copied from interface: IRecorder
Closes the current recorder connection.

Specified by:
close in interface Closeable
Specified by:
close in interface IRecorder
Throws:
IOException - on communication errors

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.

getRecorderID

public int getRecorderID()
Description copied from interface: IRecorder
Gets the id of this recorder

Specified by:
getRecorderID in interface IRecorder
Returns:
the recorder id

getRemoteEncoder

public IRemoteEncoder getRemoteEncoder()
Description copied from interface: IRecorder
Gets the remote-encoder object.

Specified by:
getRemoteEncoder in interface IRecorder
Returns:
the remote encoder object.

signalFrontendReady

public boolean signalFrontendReady()
                            throws IOException
Description copied from interface: IRecorder
Tells the recorder that the frontend is up and ready.

This is required e.g. if the backend needs to transmit the ASK_RECORDING message to the frontend.

Specified by:
signalFrontendReady in interface IRecorder
Returns:
true if the recorder respond with OK
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_FRONTEND_READY

stopPlaying

public boolean stopPlaying()
                    throws IOException
Deprecated. 20

Description copied from interface: IRecorder
Tells the recorder to stop streaming a recording to the frontend.

Usage Hint:

Use IRecorder.stopLiveTv() to stop streaming live TV.

Specified by:
stopPlaying in interface IRecorder
Returns:
true on success.
Throws:
IOException - on communication errors.
See Also:
QUERY_RECORDER_STOP_PLAYING

spawnLiveTV

public boolean spawnLiveTV()
                    throws IOException
Description copied from interface: IRecorder
Tells the recorder to start a "Live TV" recording.

Usage Hint:

Use IRecorder.stopLiveTv() to stop streaming live TV.

Specified by:
spawnLiveTV in interface IRecorder
Returns:
true if the recorder respond with OK
Throws:
IOException - on communication errors
See Also:
IRecorder.spawnLiveTV(boolean, String), QUERY_RECORDER_SPAWN_LIVETV

spawnLiveTV

public boolean spawnLiveTV(boolean pictureInPicture,
                           IRecorderChannelInfo recorderChannelInfo)
                    throws IOException
Description copied from interface: IRecorder
Tells the recorder to start a "Live TV" recording.

Usage Hint:

Use IRecorder.stopLiveTv() to stop streaming live TV.

Specified by:
spawnLiveTV in interface IRecorder
Parameters:
pictureInPicture - specifies if picture in picture should be used. (Since 20).
recorderChannelInfo - the channel to swith the recorder to. (Since 34).
Returns:
true if the backend returned OK.
Throws:
IOException - on communication errors.
See Also:
IRecorder.spawnLiveTV(boolean, String)

spawnLiveTV

public boolean spawnLiveTV(boolean pictureInPicture,
                           String channelNumber)
                    throws IOException
Description copied from interface: IRecorder
Tells the recorder to start a "Live TV" recording.

Protocol Version Hint:

For protocols prior to 20, this function also initializes a ringbuffer, required for LiveTV streaming.
See IRecorder.annotateRingBuffer() to get access to this ringbuffer.

If this function is called prior to 34, IRecorder.setChannel(String) is used to switch to the desired channel.

Specified by:
spawnLiveTV in interface IRecorder
Parameters:
pictureInPicture - specifies if picture in picture should be used. (Since 20).
channelNumber - the channel number to switch to. (Since 34).
Returns:
true if the backend returned OK.
Throws:
IOException - on communication errors
See Also:
IMythCommand.QUERY_RECORDER_SETUP_RING_BUFFER

stopLiveTv

public boolean stopLiveTv()
                   throws IOException
Description copied from interface: IRecorder
Tells the recorder to stop a "Live TV" recording.

Usage Hints:

Use IRecorder.spawnLiveTV() to start playing Live TV.

Specified by:
stopLiveTv in interface IRecorder
Returns:
true if the recorder returned OK.
Throws:
IOException - on communication errors.

setupRingBuffer

public boolean setupRingBuffer(boolean pictureInPicture)
                        throws IOException
Deprecated. 20

Throws:
IOException

annotateRingBuffer

public IRingBuffer annotateRingBuffer()
                               throws IOException
Deprecated. 20

Description copied from interface: IRecorder
Signals the recorder that we want to use a ring-buffer.

Specified by:
annotateRingBuffer in interface IRecorder
Returns:
true if the recorder respond with OK
Throws:
IOException - on communication errors
See Also:
ANN_RING_BUFFER

waitForIsRecording

public boolean waitForIsRecording(long timeoutMs)
                           throws IOException,
                                  InterruptedException
Description copied from interface: IRecorder
Wait for recording.

Checks if the recorder is actually recording until recording has been started or the timeout has reached.

Specified by:
waitForIsRecording in interface IRecorder
Parameters:
timeoutMs - the timeout in ms
Returns:
true if the recorder is currently recording
Throws:
IOException - on communication errors
InterruptedException - if the thread was interrupted

isRecording

public boolean isRecording()
                    throws IOException
Description copied from interface: IRecorder
Checks if the recorder is actually recording.

Usage Hint:

Use IRecorder.waitForIsRecording(long) if you need to wait till the recorder is recording.

Specified by:
isRecording in interface IRecorder
Returns:
true if the recorder is currently recording.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_IS_RECORDING

finishRecording

public boolean finishRecording()
                        throws IOException
Description copied from interface: IRecorder
Tells the recorder to stop recording, but only after "overrecord" seconds.

Specified by:
finishRecording in interface IRecorder
Returns:
true if the recorder returned OK
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_FINISH_RECORDING

setLiveTvRecording

public boolean setLiveTvRecording()
                           throws IOException
Description copied from interface: IRecorder
Tells the recorder to keep a LiveTV recording.

Specified by:
setLiveTvRecording in interface IRecorder
Returns:
true if the backend returned OK
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_SET_LIVE_RECORDING

getRecording

public ProgramInfo getRecording()
                         throws IOException
Description copied from interface: IRecorder
Returns the recorders current recording.

Protocol Version Hint:

Prior to protocol version 20 this function returns null on live-tv recordings.

Specified by:
getRecording in interface IRecorder
Returns:
the current recording, or null if the recorder is currently not recording.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_RECORDING

getCurrentRecording

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

Usage Note:

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

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

getProgramInfo

public IRecorderProgramInfo getProgramInfo()
                                    throws IOException
Deprecated. 21

Description copied from interface: IRecorder
Gets the current program on the current recorder channel.

This returns information about the program that could be seen on the current channel of the recorder.

Protocol Version Hint:

If you call this function with a protocol version greater than 20, then getNextProgramInfo is used to fetch the information.

Specified by:
getProgramInfo in interface IRecorder
Returns:
information about the current program on the current channel of the recorder.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_PROGRAM_INFO

getNextProgramInfo

public IRecorderNextProgramInfo getNextProgramInfo(IBasicChannelInfo channelInfo,
                                                   EChannelBrowseDirection direction,
                                                   Date startTime)
                                            throws IOException
Description copied from interface: IRecorder
Gets the next program on the specified channel.

This returns information about the program that would be seen, if we changed the channel using the given direction.

Usage Note:

Use SAME to query the program on the given channel. But if SAME is used, the channel-info must not be null, otherwise the backend will fallback to the first available channel.

Specified by:
getNextProgramInfo in interface IRecorder
Parameters:
channelInfo - the channel to start browsing.
direction - the direction to browse.
startTime - the starting time that should be used for the query
Returns:
the found program information.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_NEXT_PROGRAM_INFO

getNextProgramInfo

public RecorderNextProgramInfo getNextProgramInfo(String channelNumber,
                                                  Integer channelID,
                                                  EChannelBrowseDirection direction,
                                                  Date startTime)
                                           throws IOException
Description copied from interface: IRecorder
Gets the next program on the specified channel.

This returns information about the program that would be seen, if we changed the channel using the given direction.

Usage Note:

Use SAME to query the program on the given channel. But if SAME is used, the channel-info must not be null, otherwise the backend will fallback to the first available channel.

Specified by:
getNextProgramInfo in interface IRecorder
Parameters:
channelNumber - the number of the channel to start browsing
channelID - the id of the channel
direction - the direction to browse.
startTime - the starting time that should be used for the query
Returns:
the found program information.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_NEXT_PROGRAM_INFO

getNextProgramInfos

public List<IRecorderNextProgramInfo> getNextProgramInfos(Date startTime)
                                                   throws IOException
Description copied from interface: IRecorder
Gets a list containing the next programs of all channels.

This function internally uses IRecorder.getChannelsNextProgramInfoMap(Date).

Usage example:


    IRecorder recorder = ...; // an already connected recorder
    
    // query all currently distributed programs
    List<IRecorderNextProgramInfo> nextPrograms = recorder.getNextProgramInfos(null);
    for(IRecorderNextProgramInfo nextProgram : nextPrograms) {
       // skipping invalid programs
       if(!nextProgram.isValid()) continue;
       
       // print program info
       System.out.println(String.format(
          "%1$tF %1$tT | %2$tF %2$tT | %3$3d min | %4$5s | %5$s",
          nextProgram.getStartDateTime(), nextProgram.getEndDateTime(), nextProgram.getDuration(), 
          nextProgram.getChannelSign(), nextProgram.getFullTitle()
       ));
    }
 

The above example will output, e.g.:
 2012-01-01 14:55:01 | 2012-01-01 16:30:01 |  95 min |  PRO7 | Sind wir endlich fertig?
 2012-01-01 15:10:01 | 2012-01-01 16:40:01 |  90 min |   ARD | Sterne über dem Eis
 2012-01-01 13:45:01 | 2012-01-01 17:05:01 | 200 min |   ZDF | ZDF SPORTextra
 2012-01-01 15:10:01 | 2012-01-01 18:45:01 | 215 min |   RTL | Die ultimative Chart Show - Die erfolgreichsten Hits des Jahres 2011
 2012-01-01 14:10:01 | 2012-01-01 15:45:01 |  95 min | SAT.1 | Die Schöne und das Biest
 2012-01-01 14:45:01 | 2012-01-01 15:30:01 |  45 min |   BR3 | Als die Fremden kamen - Vom Winterurlaub in Tirol
 2012-01-01 14:45:01 | 2012-01-01 15:30:01 |  45 min |  SWBW | Neues aus dem Glottertal
 2012-01-01 13:55:01 | 2012-01-01 15:50:01 | 115 min |  ORF1 | FIS Weltcup Skispringen - HS 140 - Das Springen
 2012-01-01 15:15:01 | 2012-01-01 17:00:01 | 105 min |  ORF2 | Die Zürcher Verlobung
 2012-01-01 14:45:01 | 2012-01-01 16:00:01 |  75 min |  3SAT | Willi und die Wunder dieser Welt
 2012-01-01 14:30:01 | 2012-01-01 16:05:01 |  95 min | KABE1 | Legende
 2012-01-01 15:15:01 | 2012-01-01 16:30:01 |  75 min | SUPRT | Cosmo & Wanda - Wenn Elfen helfen: Alltagshelden - Die Alltagshelden
 2012-01-01 14:35:01 | 2012-01-01 16:15:01 | 100 min |   VOX | Nine Months
 2012-01-01 15:15:01 | 2012-01-01 16:55:01 | 100 min |  RTL2 | Der Todes-Twister
 2012-01-01 14:55:01 | 2012-01-01 15:40:01 |  45 min |  ARTE | Naturparadiese Afrikas - Äthiopien - Land der Extreme
 2012-01-01 13:40:01 | 2012-01-01 15:20:01 | 100 min |  ATV+ | Nach Ansage
 2012-01-01 14:45:00 | 2012-01-01 16:30:00 | 105 min | PULS4 | Louis' unheimliche Begegnung mit den Außerirdischen
 

Specified by:
getNextProgramInfos in interface IRecorder
Parameters:
startTime - the start time. if this is null the current date is used.
Returns:
the next programs of all channels.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_NEXT_PROGRAM_INFO

getChannelsNextProgramInfoMap

public Map<Integer,IRecorderNextProgramInfo> getChannelsNextProgramInfoMap(Date startTime)
                                                                    throws IOException
Description copied from interface: IRecorder
Gets a map containing the next programs of all channels.

This returns a map containing the channel-id as key and recorder-next-program info as value.

This method uses IRecorder.getNextProgramInfo(String, Integer, EChannelBrowseDirection, Date) to loop through all channels and to fetch the current channel program.

Specified by:
getChannelsNextProgramInfoMap in interface IRecorder
Returns:
the channel-program map
Throws:
IOException - on communication errors

getBasicChannelInfos

public <C extends IBasicChannelInfo> List<C> getBasicChannelInfos()
                                                       throws IOException
Description copied from interface: IRecorder
Gets a list of all known channels.

Protocol Version Hint:

If the current protocol-version is less than 28 an IBasicChannelInfo object is returned, otherwise an IRecorderChannelInfo object is returned.

Usage example:


    IRecorder recorder = ...; // an already connected recorder
    
    // getting all available channel 
    List<IBasicChannelInfo> channels = recorder.getBasicChannelInfos();
    System.out.println(String.format(
       "Id   |  Nr | Sign "				
    ));
    for(IBasicChannelInfo channel : channels) {
       System.out.println(String.format(
          "%04d | %3s | %s",
          channel.getChannelID(),channel.getChannelNumber(), channel.getChannelSign()
       ));
    }
 

The above example will output, e.g.
 Id   |  Nr | Sign 
 1063 |   1 | PRO7
 1064 |   5 | ARD
 1065 |   6 | ZDF
 1066 |   3 | RTL
 1067 |   2 | SAT.1
 1068 |  14 | BR3
 1071 |  16 | SWBW
 1072 |  10 | ORF1
 1073 |  11 | ORF2
 1074 |  18 | A9
 1075 |  12 | 3SAT
 1077 |   7 | KABE1
 1078 |  15 | SUPRT
 1079 |   8 | VOX
 1080 |   4 | RTL2
 1085 |   9 | ARTE
 1091 |  13 | ATV+
 1095 |  17 | PULS4
 

Specified by:
getBasicChannelInfos in interface IRecorder
Returns:
a list of all known channels.
Throws:
IOException - on communication errors

getChannelInfos

public List<IRecorderChannelInfo> getChannelInfos()
                                           throws IOException
Description copied from interface: IRecorder
Gets a list of all known channels.

This function uses IRecorder.getChannelsNextProgramInfoMap(Date) to determine the channel-IDs of all known channels and IRecorder.getChannelInfo(Integer) to fetch the info object for each channel.

Response example:

<0>CHANNEL_ID: 11123 | <1>SOURCE_ID: 1 | <2>CHANNEL_SIGN: PULS 4 | <3>CHANNEL_NUMBER: 10123 | <4>CHANNEL_NAME: PULS 4 | <5>XMLTV_ID:
<0>CHANNEL_ID: 12104 | <1>SOURCE_ID: 1 | <2>CHANNEL_SIGN: ServusTV | <3>CHANNEL_NUMBER: 11104 | <4>CHANNEL_NAME: ServusTV | <5>XMLTV_ID:
<0>CHANNEL_ID: 11120 | <1>SOURCE_ID: 1 | <2>CHANNEL_SIGN: ATV | <3>CHANNEL_NUMBER: 10120 | <4>CHANNEL_NAME: ATV | <5>XMLTV_ID:
<0>CHANNEL_ID: 11101 | <1>SOURCE_ID: 1 | <2>CHANNEL_SIGN: ORF1 | <3>CHANNEL_NUMBER: 10101 | <4>CHANNEL_NAME: ORF1 | <5>XMLTV_ID:
<0>CHANNEL_ID: 12102 | <1>SOURCE_ID: 1 | <2>CHANNEL_SIGN: 3SAT | <3>CHANNEL_NUMBER: 11102 | <4>CHANNEL_NAME: 3SAT | <5>XMLTV_ID:
<0>CHANNEL_ID: 11102 | <1>SOURCE_ID: 1 | <2>CHANNEL_SIGN: ORF2 W | <3>CHANNEL_NUMBER: 10102 | <4>CHANNEL_NAME: ORF2 W | <5>XMLTV_ID:
<0>CHANNEL_ID: 12103 | <1>SOURCE_ID: 1 | <2>CHANNEL_SIGN: ORF Sport Plus | <3>CHANNEL_NUMBER: 11103 | <4>CHANNEL_NAME: ORF Sport Plus | <5>XMLTV_ID:

Specified by:
getChannelInfos in interface IRecorder
Returns:
a list of all available channels.
Throws:
IOException - on communication errors

getChannelInfo

public RecorderChannelInfo getChannelInfo(Integer chanID)
                                   throws IOException
Description copied from interface: IRecorder
Gets informations about the given channel.

Usage Hint:

Use IBackend.setChannelInfo(String, IRecorderChannelInfo) to change the properties of a channel.

Specified by:
getChannelInfo in interface IRecorder
Parameters:
chanID - the id of the desired channel.
Returns:
informations about the given channel
Throws:
IOException - on communication errors

getChannelInfo

public RecorderChannelInfo getChannelInfo(IBasicChannelInfo channelInfo)
                                   throws IOException
Description copied from interface: IRecorder
Gets detailed informations about the given channel.

This uses the channel-id of the basic-channel-info object to fetch additional informations about the channel.

Usage Hint:

Use IBackend.setChannelInfo(String, IRecorderChannelInfo) to change the properties of a channel.

Specified by:
getChannelInfo in interface IRecorder
Parameters:
channelInfo - the desired channel
Returns:
informations about the given channel *
Throws:
IOException - on communication errors
See Also:
IRecorder.getChannelInfo(Integer), QUERY_RECORDER_GET_CHANNEL_INFO

getCurrentChannel

public <C extends IBasicChannelInfo> C getCurrentChannel()
                                              throws IOException
Description copied from interface: IRecorder
Gets the currently active channel of the recorder.

Protocol Version Hint:

If the current protocol-version is less than 28 an IBasicChannelInfo object is returned, otherwise an IRecorderChannelInfo object is returned.

Usage example:


    // getting the current input of the recorder
    String recorderInput = recorder.getInput();
    
    // getting the current recorder channel
    IBasicChannelInfo recorderChannel = recorder.getCurrentChannel();
    
    // print infos
    System.out.println(String.format(
       "Recorder %d is using input: %s (channel: %s).",
       recorderId, recorderInput, recorderChannel==null?"-":recorderChannel.getChannelSign()
    ));
 

Specified by:
getCurrentChannel in interface IRecorder
Type Parameters:
C - the type of the channel information. This is either a IRecorderChannelInfo or a IBasicChannelInfo.
Returns:
the information about the current channel or null.
Throws:
IOException - on communication errors.

getInputName

public String getInputName()
                    throws IOException
Deprecated. 21

Description copied from interface: IRecorder
Gets the name of the current recorder input.

Protocol Version Hint:

If this method is called with a protocol-version greater to or equal with 27, then the function IRecorder.getInput() is called instead.

Specified by:
getInputName in interface IRecorder
Returns:
the name of the current input, e.g. DVBInput
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_INPUT_NAME

getInput

public String getInput()
                throws IOException
Description copied from interface: IRecorder
Gets the name of the current recorder input.

Protocol Version Hint:

If this method is called prior to , then IRecorder.getInputName() is called instead.

Specified by:
getInput in interface IRecorder
Returns:
the name of the current recorder input, e.g. DVBInput or Tuner 1. If the recorder is currently not active null is returned.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_INPUT

setInput

public boolean setInput(String inputName)
                 throws IOException
Description copied from interface: IRecorder
Tells the recorder to change to the specified input.

Specified by:
setInput in interface IRecorder
Parameters:
inputName - the name of the input to change to.
Returns:
true if the input was switched successfully.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_SET_INPUT

switchToNextInput

public String switchToNextInput()
                         throws IOException
Description copied from interface: IRecorder
Tells the recorder to switch to the next input.

Protocol Version Hint:

If this function is called for protocols prior to 27, then IRecorder.toggleInputs() is called.

Specified by:
switchToNextInput in interface IRecorder
Returns:
the name of the new input
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_SET_INPUT

toggleInputs

public boolean toggleInputs()
                     throws IOException
Description copied from interface: IRecorder
Tells the recorder to change to the next input.

Protocol Version Hint:

If this method is called with a protocol-version starting with 27, then the function IRecorder.switchToNextInput() is called instead.

Specified by:
toggleInputs in interface IRecorder
Returns:
true if the backend respond with ok.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_TOGGLE_INPUTS

checkChannel

public boolean checkChannel(String channelNumber)
                     throws IOException
Description copied from interface: IRecorder
Checks if named channel exists on current tuner.

Specified by:
checkChannel in interface IRecorder
Parameters:
channelNumber - the channel number
Returns:
true if it succeeds, false otherwise.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_CHECK_CHANNEL

checkChannelPrefix

public IRecorderChannelPrefixStatus checkChannelPrefix(String channelNumberPrefix)
                                                throws IOException
Description copied from interface: IRecorder
Checks a channel-number prefix against the channels in the MythTV-DB.

Specified by:
checkChannelPrefix in interface IRecorder
Parameters:
channelNumberPrefix - the channel number prefix
Returns:
the matching status
Throws:
IOException - on communication errors.
See Also:
QUERY_RECORDER_CHECK_CHANNEL_PREFIX

changeChannel

public boolean changeChannel(EChannelChangeDirection direction)
                      throws IOException
Description copied from interface: IRecorder
Changes to the next or previous channel.

Usage Note:

You must pause the recorder before doing this.

Specified by:
changeChannel in interface IRecorder
Throws:
IOException - on communication errors
See Also:
IRecorder.changeChannel(int), QUERY_RECORDER_CHANGE_CHANNEL

changeChannel

public boolean changeChannel(int direction)
                      throws IOException
Description copied from interface: IRecorder
Changes to the next or previous channel.

Usage Note:

You must pause the recorder before doing this.

Specified by:
changeChannel in interface IRecorder
Parameters:
direction - 0=up, 1=down, 2=favorite, 3=same
Returns:
true if the channel was changed successfully.
Throws:
IOException - on communication errors.
See Also:
QUERY_RECORDER_CHANGE_CHANNEL

setChannel

public boolean setChannel(String channelNumber)
                   throws IOException
Description copied from interface: IRecorder
Changes to a named channel on the current tuner.

Usage Note:

You must pause the recorder before doing this.

Specified by:
setChannel in interface IRecorder
Parameters:
channelNumber - the channel number
Returns:
true if the backend returned OK.
Throws:
IOException - on communication errors.
See Also:
QUERY_RECORDER_SET_CHANNEL

getFramesWritten

public long getFramesWritten()
                      throws IOException
Description copied from interface: IRecorder
Returns the number of frames written to disk.

Usage Hint:

Use IRecorder.waitForFramesWritten(long) if you need to wait for a given amount of frames.

Specified by:
getFramesWritten in interface IRecorder
Returns:
the number of frames written to disk or -1 if the recorder is not recording.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_FRAMES_WRITTEN

waitForFramesWritten

public long waitForFramesWritten(long desiredFrames)
                          throws IOException,
                                 InterruptedException
Description copied from interface: IRecorder
Wait for number of frames written.

This function uses IRecorder.getFramesWritten() to determine the current amount of frames written and waits till the requested amount of frames was writte.

Specified by:
waitForFramesWritten in interface IRecorder
Parameters:
desiredFrames - the amount of frames that should be written
Returns:
the actual amount of frames written
Throws:
IOException - on communication errors
InterruptedException - if the thread was interrupted
See Also:
QUERY_RECORDER_GET_FRAMES_WRITTEN

getFrameRate

public float getFrameRate()
                   throws IOException
Description copied from interface: IRecorder
Returns the recording frame rate.

Specified by:
getFrameRate in interface IRecorder
Returns:
the recording frame rate
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_FRAMERATE

getFilePosition

public long getFilePosition()
                     throws IOException
Description copied from interface: IRecorder
Returns the total number of bytes written by the recorder.

Specified by:
getFilePosition in interface IRecorder
Returns:
the total number of bytes written.
Throws:
IOException
See Also:
QUERY_RECORDER_GET_FILE_POSITION

getFreeInputs

public IFreeInputList getFreeInputs()
                             throws IOException
Description copied from interface: IRecorder
Gets all free inputs of the recorder.

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

getConnectedInputs

public List<String> getConnectedInputs()
                                throws IOException
Deprecated. 37

Description copied from interface: IRecorder
Get all inputs configured for the recorder.

Protocol Version Hint:

If this function is called with protocol versions greater than 37, IRecorder.getFreeInputs() and IRecorder.getInput() are used to determine the input names.

Specified by:
getConnectedInputs in interface IRecorder
Returns:
the names of all known inputs
Throws:
IOException
Since:
27
See Also:
QUERY_RECORDER_GET_CONNECTED_INPUTS

getColour

public Integer getColour()
                  throws IOException
Description copied from interface: IRecorder

Gets the colour of a recording.

Specified by:
getColour in interface IRecorder
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_COLOUR

getContrast

public Integer getContrast()
                    throws IOException
Description copied from interface: IRecorder

Gets the contrast of a recording.

Specified by:
getContrast in interface IRecorder
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_CONTRAST

getBrightness

public Integer getBrightness()
                      throws IOException
Description copied from interface: IRecorder

Gets the brightness of a recording.

Specified by:
getBrightness in interface IRecorder
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_BRIGHTNESS

getHue

public Integer getHue()
               throws IOException
Description copied from interface: IRecorder

Gets the hue of a recording.

Specified by:
getHue in interface IRecorder
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_HUE

changeColour

public Integer changeColour(boolean up)
                     throws IOException
Description copied from interface: IRecorder
Changes the colour of a recording.

Specified by:
changeColour in interface IRecorder
Parameters:
up - the direction, true means increase.
Returns:
the new value
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_CHANGE_COLOUR

changeColour

public Integer changeColour(EPictureAdjustmentType adjustmentType,
                            boolean up)
                     throws IOException
Description copied from interface: IRecorder
Changes the colour value.

Specified by:
changeColour in interface IRecorder
Parameters:
adjustmentType - the adjustment type (Since 30)
up - the direction, true means increase.
Returns:
the new value
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_CHANGE_COLOUR

changeContrast

public Integer changeContrast(boolean up)
                       throws IOException
Description copied from interface: IRecorder
Changes the contrast of a recording.

Specified by:
changeContrast in interface IRecorder
Parameters:
up - the direction, true means increase.
Returns:
the new value
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_CHANGE_CONTRAST

changeContrast

public Integer changeContrast(EPictureAdjustmentType adjustmentType,
                              boolean up)
                       throws IOException
Description copied from interface: IRecorder
Changes the contrast value.

Specified by:
changeContrast in interface IRecorder
Parameters:
adjustmentType - the adjustment type (Since 30)
up - the direction, true means increase.
Returns:
the new value
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_CHANGE_CONTRAST

changeBrightness

public Integer changeBrightness(boolean up)
                         throws IOException
Description copied from interface: IRecorder
Changes the brightness of a recording.

Specified by:
changeBrightness in interface IRecorder
Parameters:
up - the direction, true means increase.
Returns:
the new value
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_CHANGE_BRIGHTNESS

changeBrightness

public Integer changeBrightness(EPictureAdjustmentType adjustmentType,
                                boolean up)
                         throws IOException
Description copied from interface: IRecorder
Changes the brightness value.

Specified by:
changeBrightness in interface IRecorder
Parameters:
adjustmentType - the adjustment type (Since 30)
up - the direction, true means increase.
Returns:
the new value
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_CHANGE_BRIGHTNESS

changeHue

public Integer changeHue(boolean up)
                  throws IOException
Description copied from interface: IRecorder
Changes the hue value of a recording.

Specified by:
changeHue in interface IRecorder
Parameters:
up - the direction, true means increase.
Returns:
the new value
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_CHANGE_HUE

changeHue

public Integer changeHue(EPictureAdjustmentType adjustmentType,
                         boolean up)
                  throws IOException
Description copied from interface: IRecorder
Changes the hue value.

Specified by:
changeHue in interface IRecorder
Parameters:
adjustmentType - the adjustment type (Since 30)
up - the direction, true means increase.
Returns:
the new value
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_CHANGE_HUE

getMaxBitrate

public long getMaxBitrate()
                   throws IOException
Description copied from interface: IRecorder
Gets the maximum bitrate a recorder can output.

Specified by:
getMaxBitrate in interface IRecorder
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_MAX_BITRATE

shouldSwitchCard

public boolean shouldSwitchCard(Integer channelID)
                         throws IOException
Description copied from interface: IRecorder
Checks if named channel exists on current tuner, or another tuner.

Specified by:
shouldSwitchCard in interface IRecorder
Parameters:
channelID - the id of the channel
Returns:
true rue if the channel on another tuner and not current tuner, false otherwise. This also returns false if the channel id is unknown.
Throws:
IOException - on communication errors.
See Also:
QUERY_RECORDER_SHOULD_SWITCH_CARD

toggleChannelFavorite

public boolean toggleChannelFavorite()
                              throws IOException
Description copied from interface: IRecorder
Adds or removes the current channel from the favorite channel list.

Specified by:
toggleChannelFavorite in interface IRecorder
Returns:
true if the recorder respond with OK.
Throws:
IOException - on communication errors.
See Also:
QUERY_RECORDER_TOGGLE_CHANNEL_FAVORITE

toggleChannelFavorite

public boolean toggleChannelFavorite(String channelGroup)
                              throws IOException
Description copied from interface: IRecorder
Adds or removes the current channel to or from the given channel group.

Specified by:
toggleChannelFavorite in interface IRecorder
Parameters:
channelGroup - the name of the channel group (since 45). If this is null, ProtocolConstants.CHANNEL_GROUP_DEFAULT is used as group.
Returns:
true if the recorder respond with OK.
Throws:
IOException - on communication errors.
See Also:
QUERY_RECORDER_TOGGLE_CHANNEL_FAVORITE

setSignalMonitoringRate

public int setSignalMonitoringRate(int rate,
                                   boolean notifyFrontend)
                            throws IOException
Description copied from interface: IRecorder
Sets the signal monitoring rate.

Usage Note:

ATTENTION: this can only be set in LiveTV Mode. You also need to IRecorder.pause() the recorder before calling this function.

Specified by:
setSignalMonitoringRate in interface IRecorder
Parameters:
rate - Milliseconds between each signal check, 0 to disable, -1 to preserve old value.
notifyFrontend - If 1 SIGNAL messages are sent to the frontend, if 0 SIGNAL messages will not be sent, and if -1 the old value is preserved.
Returns:
Old rate if it succeeds, -1 if it fails.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_SET_SIGNAL_MONITORING_RATE

pause

public boolean pause()
              throws IOException
Description copied from interface: IRecorder
Tells the recorder to pause a recorder.

Specified by:
pause in interface IRecorder
Returns:
true if the recorder respond with OK.
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_PAUSE

cancelNextRecording

public boolean cancelNextRecording(Boolean cancel)
                            throws IOException
Description copied from interface: IRecorder
Tells the recorder to cancel or continue 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 IRecorder
Parameters:
cancel - if the next recording should be canceled or continued (Since 23).
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_CANCEL_NEXT_RECORDING

setNextLiveTvDirectory

public boolean setNextLiveTvDirectory(String path)
                               throws IOException
Description copied from interface: IRecorder
Changes LiveTV recording directory.

Specified by:
setNextLiveTvDirectory in interface IRecorder
Parameters:
path - the new path
Returns:
true on success
Throws:
IOException - on communication errors
See Also:
SET_NEXT_LIVETV_DIR

getKeyframePosition

public long getKeyframePosition(long frameNumber)
                         throws IOException
Description copied from interface: IRecorder
Returs the byte position for the given frame number.

Specified by:
getKeyframePosition in interface IRecorder
Parameters:
frameNumber - the desired frame number.
Returns:
the frame pisition in bytes or -1
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_GET_KEYFRAME_POS

fillPositionMap

public Map<Long,Long> fillPositionMap(long startFrameNr,
                                      long endFrameNr)
                               throws IOException
Description copied from interface: IRecorder
Returns the keyframe position map.

Protocol Version Hint:

For protocol version prior to 43, only 32 bit integer values are supported as frame-numbers.
If this fuction is valled with larger frame numbers IRecorder.getKeyframePosition(long) is used instead, if no more than 1000 frames should be tested, otherwise this function call returns an empty list.

Specified by:
fillPositionMap in interface IRecorder
Parameters:
startFrameNr - the starting frame number
endFrameNr - the ending frame number
Returns:
a map containing the keyframe number as key and the byte position of the key frame as value
Throws:
IOException - on communication errors
See Also:
QUERY_RECORDER_FILL_POSITION_MAP

fillDurationMap

public Map<Long,Long> fillDurationMap(long start,
                                      long end)
                               throws IOException
Specified by:
fillDurationMap in interface IRecorder
Throws:
IOException
See Also:
QUERY_RECORDER_FILL_DURATION_MAP

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2013. All Rights Reserved.