Difference between revisions of "Myth Protocol"

From MythTV Official Wiki
Jump to: navigation, search
(adds version 47 updates)
m (keeping as a redirect for the revision history)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
There is wiki entry started, [[Using the Myth protocol]], which describes how to use the Myth Protocol for watching Live TV.
+
#REDIRECT [[:Category:Myth Protocol]]
 
 
== List of proto bumps ==
 
Note: This is merely here to hold the current protocol changes while I take my time to reverse engineer as was done with [[Myth Protocol 14]].
 
<center>
 
{| border=1 cellspacing=0 cellpadding=5
 
| MYTH_PROTO_VERSION, Myth Release
 
| Changeset
 
| Description
 
|-
 
| 1
 
| {{changeset|3021}}
 
| <code><font color="green">+MYTH_PROTO_VERSION</font></code>
 
|-
 
| 2
 
| {{changeset|3078}}
 
|
 
|-
 
| 3
 
| {{changeset|3112}}
 
| <code><font color="green">+GET_NEXT_FREE_RECORDER</font></code>
 
|-
 
| 4
 
| {{changeset|3308}}
 
|
 
|-
 
| 5
 
| {{changeset|3503}}
 
| <code><font color="green">+REACTIVATE_RECORDING, +REFRESH_BACKEND</font></code>
 
|-
 
| 6
 
| {{changeset|3589}}
 
|
 
|-
 
| 7
 
| {{changeset|3617}}
 
|
 
|-
 
| 8
 
| {{changeset|3621}}
 
|
 
|-
 
| 9
 
| {{changeset|3838}}
 
| <code><font color="green">+GET_FREE_RECORDER_COUNT</font></code>
 
|-
 
| 10
 
| {{changeset|3966}}
 
|
 
|-
 
| 11
 
| {{changeset|3973}}
 
|
 
|-
 
| 12
 
| {{changeset|3988}}
 
|
 
|-
 
| 13
 
| {{changeset|4122}}
 
|
 
|-
 
| 14
 
| {{changeset|4508}}
 
|
 
|-
 
| 15, 0.18
 
| {{changeset|5833}}
 
| <code><font color="green">+QUERY_LOAD, +QUERY_UPTIME, +QUERY_MEMSTATS, +QUERY_GUIDEDATATHROUGH, +RESCHEDULE_RECORDINGS</font></code>
 
|-
 
| 16
 
| {{changeset|6284}}
 
| <code><font color="green">+FORCE_DELETE_RECORDING, +OK, +UNKNOWN_COMMAND</font></code>
 
|-
 
| 17
 
| {{changeset|6482}}
 
| <code><font color="red">-QUERY_FREESPACE, </font><font color="green">+QUERY_FREE_SPACE, +QUERY_FREE_SPACE_LIST, +GET_FREE_RECORDER_LIST, +QUERY_PIXMAP_LASTMODIFIED, +QUERY_COMMBREAK, +QUERY_CUTLIST, +QUERY_BOOKMARK, +SET_BOOKMARK, +QUERY_SETTING, +SET_SETTING, +QUERY_REMOTEENCODER GET_MAX_BITRATE, +QUERY_RECORDER GET_MAX_BITRATE, +QUERY_RECORDER SHOULD_SWITCH_CARD</font></code>
 
|-
 
| 18
 
| {{changeset|6865}}
 
| <code><font color="green">+QUERY_RECORDER SET_SIGNAL_MONITORING_RATE</font></code>
 
|-
 
| 19
 
| {{changeset|7427}}
 
| <code><font color="red">-REACTIVATE_RECORDING, </font><font color="green">+ALLOW_SHUTDOWN, +BLOCK_SHUTDOWN, +QUERY_RECORDER GET_CURRENT_RECORDING</font></code>
 
|-
 
| 20
 
| {{changeset|7739}}
 
| <code><font color="red">-ANN RingBuffer, -QUERY_RECORDER GET_FREE_SPACE, -QUERY_RECORDER SETUP_RING_BUFFER, -QUERY_RECORDER STOP_PLAYING, -QUERY_RECORDER REQUEST_BLOCK_RINGBUF, -QUERY_RECORDER SEEK_RINGBUF, -QUERY_RECORDER DONE_RINGBUF</font></code>
 
|-
 
| 21
 
| {{changeset|7826}}
 
| <code><font color="red">-GET_PROGRAM_INFO, -GET_INPUT_NAME</font></code>
 
|-
 
| 22
 
| {{changeset|7883}}
 
| <code><font color="green">+ANN Monitor, +LIVETV_EXITED (event)</font></code>
 
|-
 
| 23
 
| {{changeset|8553}}
 
| <code><font color="red">-QUEUE_TRANSCODE, -QUEUE_TRANSCODE_CUTLIST, -QUEUE_TRANSCODE_STOP, </font><font color="green">+QUERY_GETEXPIRING, +SCHEDULER_ADD_RECORDING (event), +CLEAR_SETTINGS_CACHE (event)</font></code>
 
|-
 
| 24
 
| {{changeset|8617}}
 
|
 
|-
 
| 25
 
| {{changeset|8628}}
 
|
 
|-
 
| 26, 0.19
 
| {{changeset|8754}}
 
| <code><font color="green">+SET_LIVE_RECORDING</font></code>
 
|-
 
| 27
 
| {{changeset|8973}}
 
| Unification of the ChannelBase class???<br/><code><font color="red">-SCHEDULER_ADD_RECORDING (event), -TOGGLE_INPUTS, </font><font color="green">+GET_CONNECTED_INPUTS, +GET_INPUT, +SET_INPUT</font></code>
 
|-
 
| 28
 
| {{changeset|9524}}
 
| Backend portion of Channel Editing patch.<br/><code><font color="green">+GET_CHANNEL_INFO, +SET_CHANNEL_INFO, +SET_TIMEOUT</font></code>
 
|-
 
| 29
 
| {{changeset|9592}}
 
| Increments protocol to deal with new FileTransfer params<br/><code>*ANN</code>
 
|-
 
| 30, 0.20
 
| {{changeset|9968}}
 
| Adds recorder keyed picture attribute adjustments<br/><code><font color="green">+GET_COLOUR, +GET_CONTRAST, +GET_BRIGHTNESS, +GET_HUE</font>, *CHANGE_COLOUR, *CHANGE_CONTRAST, *CHANGE_BRIGHTNESS, *CHANGE_HUE</code>
 
|-
 
| 31, some 0.20-fixes
 
| {{changeset|11278}}
 
| Add parentid to the proginfo StringLists.
 
|-
 
| 32
 
| {{changeset|12151}}
 
| Introduction of StorageGroups<br/><code><font color="green">+QUERY_RECORDING, +QUERY_FREE_SPACE_SUMMARY, +SET_NEXT_LIVETV_DIR</font></code>
 
|-
 
| 33
 
| {{changeset|12904}}
 
| Changes the format of the original airdate field in the ProgramInfo stringlist
 
|-
 
| 34
 
| {{changeset|13230}}
 
| Sends the start channel as additional parameter in SpawnLiveTV<br/><code>*SPAWN_LIVETV</code>
 
|-
 
| 35
 
| {{changeset|13952}}
 
| Replaces the current hdtv, stereo and closecaptioned flags with videoproperties, audioproperties and subtitletype vars
 
|-
 
| 36
 
| {{changeset|14483}}
 
| <code><font color="green">+UNDELETE_RECORDING</font></code>
 
|-
 
| 37
 
| {{changeset|15437}}
 
| <code><font color="red">-GET_CONNECTED_INPUTS,</font> <font color="green">+GET_FREE_INPUTS, +GET_FLAGS, +CANCEL_NEXT_RECORDING, +STOP_RECORDING</font></code>
 
|-
 
| 38
 
| {{changeset|15550}}
 
| <code><font color="green">+DELETE_FAILED_RECORDING</font></code>
 
|-
 
| 39, 0.21
 
| {{changeset|15701}}
 
| Revert [15549], because the scheduler (starting with [15566]) now uses its own temporary copy of the record table during the BUSQ.<br/><code><font color="red">-DELETE_FAILED_RECORDING</font></code>
 
|-
 
| 40, some 0.21-fixes
 
| {{changeset|16090}}
 
| Patch from #4583, along with corresponding fixes in mythweb and the perl bindings. Switches QUERY_PIXMAP_LASTMODIFIED to send a unix timestamp instead of a localized string that would be affected by LANG settings.<br/><code>*QUERY_PIXMAP_LASTMODIFIED</code>
 
|-
 
| 41
 
| {{changeset|18419}}
 
| Adds the production year to the programinfo sent via the protocol.
 
|-
 
| 42
 
| {{changeset|18574}}
 
| <code><font color="green">+QUERY_TIME_ZONE</font></code>
 
|-
 
|43
 
| {{changeset|19417}} (warning: huge changeset)
 
| Associated with the merging of the mythtv-vid branch to trunk.<br/><code><font color="black">*FILL_POSITION_MAP</font></code> and possibly GetChainWithRecording. 
 
|-
 
| 44
 
| {{changeset|19978}}
 
| Adds <code>Videos</code> storage group<br/><code><font color="green">+QUERY_SG_GETFILELIST</font></code>, <code><font color="green">+QUERY_SG_FILEQUERY</font></code>
 
|-
 
| 45
 
| {{changeset|20523}}
 
| Add channel grouping feature<br/><code><font color="black">*TOGGLE_CHANNEL_FAVORITE</font></code>
 
|-
 
| 46
 
| {{changeset|21158}}
 
| Adds ability to delete remote files<br/><code><font color="green">+DELETE_FILE</font><br><font color="black">*ANN FILETRANSFER<br>*QUERY_FILETRANSFER</font></code>
 
|-
 
| 47
 
| {{changeset|21298}}
 
| Adds filesystem block size to the FileSystemInfo structure<br><code><font color="black">*QUERY_FREE_SPACE<br>*QUERY_FREE_SPACE_LIST</font></code>
 
|}
 
</center>
 
 
 
''Legend:'' <font color="red">'''-'''</font> = removed command, <font color="green">'''+'''</font> = added command, <font color="black">'''*'''</font> = changed command
 
 
 
== Packet Data Format ==
 
''(This information is from reading the code and packet sniffing.  Do not take this information as a specification, as the developers may not have intended some of the following behavior)''
 
 
 
A MythTV protocol packet contains two fields, the size and the payload.
 
The first field is the size, encoded as an 8 byte, UTF8 decimal string padded with spaces.  If you are sending a 20 byte payload, the first 8 bytes should be the characters "20" followed by 6 spaces.
 
The second field is the payload, an arbitrary length UTF8 string made up of a list of one or more strings seperated by a the delimeter "<code>[]:[]</code>". Commands are sent to port 6543.
 
 
 
== Backend Commands ==
 
''(This information is from reading the code and packet sniffing.  Do not take this information as a specification, as the developers may not have intended some of the following behavior)''
 
 
 
Backend commands are sent using the above packet format.  The first string in the payload is the command, possibly with whitespace separated arguments.  There may also be other arguments in successive strings in the list, separated by the delimiter "<code>[]:[]</code>".  The two types of arguments are not interchangeable, each command may require specific whitespace separated arguments as well as specific list arguments.
 
 
 
Whitespace is spaces, tabs, carriage returns, linefeeds, etc.  Multiple whitespace characters are treated as a single whitespace.
 
 
 
In general, commands and arguments are case sensitive.
 
 
 
When testing your code with the protocol, be warned that all commands except <code>MYTH_PROTO_VERSION</code>, <code>ANN</code>, and <code>DONE</code> will silently fail until a successful <code>ANN</code> command has been received by the backend.  This includes non-existent commands.
 
 
 
For a list of all Myth protocol commands, see [[Myth Protocol Command List]].
 
 
 
Some example MythTV protocol exchanges, taken from a packet sniffing capture of a 0.19 frontend to backend exchange:
 
{| border=1 cellspacing=0 cellpadding=5
 
| Frontend sends
 
| Backend responds with
 
|-
 
| <pre>23      ANN Playback sycamore 0</pre>
 
| <pre>2      OK</pre>
 
|-
 
| <pre>48      QUERY_FILETRANSFER 32[]:[]REQUEST_BLOCK[]:[]2048</pre>
 
| <pre>4      2048</pre>
 
|-
 
| <pre>63      QUERY_FILETRANSFER 32[]:[]SEEK[]:[]0[]:[]0[]:[]0[]:[]0[]:[]2048</pre>
 
| <pre>7      0[]:[]0</pre>
 
|}
 
 
 
== Third Party Code that implements the Myth Protocol ==
 
*[http://www.mvpmc.org/builds/doxygen/cmyth_8h.html libcmyth] from [[Choosing Frontend Hardware#MediaMVP|mvpmc]] is a lightweight C client library which is also used by [[XBMC]]. It features livetv with epg, watching recordings and managing recordings.
 
*[[GMyth]] is a library based on the Glib/GObject APIs. It is used in MobileMythtv, GMythStream and others.
 
*[http://sourceforge.net/projects/mythtvj/ MythtvJ] is a high-level Java client library. It currently supports the version 40 of the protocol. Currently streaming a file from the backend, reading the EPG and tuning a recorder is supported.
 
[[Category:Developer Documentation]]
 

Latest revision as of 09:55, 6 March 2010