Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support for MythTV 0.25 in libcmyth #894

Merged
merged 10 commits into from

4 participants

@dteirney
Collaborator

This is an initial pull request that adds support for the recently released MythTV 0.25.

Still waiting on confirmation from some testers about some areas but wanted to start the ball rolling.

@elupus, would appreciate a review.

These changes will be pushed upstream to libcmyth once the testing has confirmed things are stable enough.

Is there anyway that these changes can be backported to Eden once testing is finished? I'm not sure if there is any sort of Service Pack protocol for released versions of XBMC.

David Teirney Add support for myth protocol 65.
The QUERY_RECORDINGS command needed to be changed to support the new sort API.
3eda5d3
@elupus
Collaborator

Looks pretty good to me. Just wondering, if all 64bit values has changed, wouldn't it cleaner to just change receive_long_long instead of adding that function pointer?

@sandersch

Built xbmc from the myth-0.25 branch of dteirney's repo and it worked against my 0.25 backend. Is there a more formal testing process I should go through?

Regarding the conversion of the cmyth_rcv_long_long functions for protocol version 66, it looks like this was converted everywhere but ringbuf.c.

@dteirney
Collaborator

@sandersch any comments re testing of the Myth 0.25 related protocol can be posted at http://forum.xbmc.org/showthread.php?tid=129021

I couldn't find any concrete Myth Protocol documentation re the RINGBUF related methods. Based on the code pathways Live TV hasn't used RINGBUF since protocol 26, which is ages ago so perhaps it's not even supported anymore (there is no reference to it in the Myth 0.25 source code).

@elupus Good call on the the changes to the single method rather than putting function pointers everywhere. If my git foo was stronger I would have redone the initial protocol 66 commit. Not sure it matters. I can look into that more if you think it necessary. I'll spend a bit more time on it tonight and push a rebased update if I can figure the rebasing stuff out.

@dteirney
Collaborator

Figured out the rebasing. Pretty easy actually and very powerful. Awesome. Protocol 66 changes now look much cleaner.

David Teirney added some commits
David Teirney Add support for myth protocol 66.
All 64 bit integers are now passed and received as a single 64 bit number rather than two 32 bit hi and lo integers.
f0d16e9
David Teirney Added support for myth protocol 67.
Added new proginfo_season, proginfo_episode, proginfo_inetref properties and altered all of the places where the proginfo object is passed or received over the myth protocol.
bc11fbd
David Teirney Added support for myth protocol 68.
No changes required as the VIDEO_LIST_CHANGE event is not used in libcmyth.
d03b4fd
David Teirney Added support for myth protocol 69.
No changes necessary as QUERY FILE HASH is not used by libcmyth.
c7452cf
David Teirney Added support for myth protocol 70.
No changes necessary as the new QUERY_FILETRANSFER REOPEN method is not yet used.
4a45a07
David Teirney Added support for myth protocol 71.
It's not entirely clear what the protocol changes were as it looks like the changes only affected the scheduler. libcmyth isn't using ASK_RECORDER or GET_FREE_INPUTS so assume no changes are necessary.
fc79d7b
David Teirney Added support for myth protocol 72 (Myth 0.25)
No changes necessary as new QUERY_ACTIVE_BACKENDS method is not used yet.
69d55b4
David Teirney Added support for myth protocol 73
Gentoo seems to have already updated to the trunk version of MythTV after the 0.25 release.

No changes necessary as libcmyth doesn't currently have support for RESCHEDULE_RECORDINGS.
e57db29
David Teirney Explicitly set the write mode to be false for ANN FileTransfer.
01cc2a7
@dteirney
Collaborator

@elupus, haven't heard any complaints from the people who have been testing this with a Myth 0.25 backend now. Do you want to review the protocol 66 changes re long_long before I merge it?

@elupus
Collaborator
@dteirney dteirney merged commit f962e40 into from
@hcw70

Hi dteirney. I tried the libcmyth version from frodo-nightly builds for ubuntu with mythbox. It worked quite well but i had playback hickups with both live and recording views. I am viewing over WLAN (no problem with MythFrontend).
Is there an option for buffering ?
Where to report this?

@dteirney
Collaborator

@hcw70 report as a trac ticket at http://trac.xbmc.org/ and include a full debug log. Cc me in the ticket when it is created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 16, 2012
  1. Add support for myth protocol 65.

    David Teirney authored
    The QUERY_RECORDINGS command needed to be changed to support the new sort API.
Commits on May 1, 2012
  1. Add support for myth protocol 66.

    David Teirney authored
    All 64 bit integers are now passed and received as a single 64 bit number rather than two 32 bit hi and lo integers.
  2. Added support for myth protocol 67.

    David Teirney authored
    Added new proginfo_season, proginfo_episode, proginfo_inetref properties and altered all of the places where the proginfo object is passed or received over the myth protocol.
  3. Added support for myth protocol 68.

    David Teirney authored
    No changes required as the VIDEO_LIST_CHANGE event is not used in libcmyth.
  4. Added support for myth protocol 69.

    David Teirney authored
    No changes necessary as QUERY FILE HASH is not used by libcmyth.
  5. Added support for myth protocol 70.

    David Teirney authored
    No changes necessary as the new QUERY_FILETRANSFER REOPEN method is not yet used.
  6. Added support for myth protocol 71.

    David Teirney authored
    It's not entirely clear what the protocol changes were as it looks like the changes only affected the scheduler. libcmyth isn't using ASK_RECORDER or GET_FREE_INPUTS so assume no changes are necessary.
  7. Added support for myth protocol 72 (Myth 0.25)

    David Teirney authored
    No changes necessary as new QUERY_ACTIVE_BACKENDS method is not used yet.
  8. Added support for myth protocol 73

    David Teirney authored
    Gentoo seems to have already updated to the trunk version of MythTV after the 0.25 release.
    
    No changes necessary as libcmyth doesn't currently have support for RESCHEDULE_RECORDINGS.
Commits on May 6, 2012
This page is out of date. Refresh to see the latest.
View
21 lib/cmyth/include/cmyth/cmyth.h
@@ -749,6 +749,20 @@ extern char *cmyth_proginfo_subtitle(cmyth_proginfo_t prog);
extern char *cmyth_proginfo_description(cmyth_proginfo_t prog);
/**
+ * Retrieve the season of a program.
+ * \param prog proginfo handle
+ * \return season
+ */
+extern unsigned short cmyth_proginfo_season(cmyth_proginfo_t prog);
+
+/**
+ * Retrieve the episode of a program.
+ * \param prog proginfo handle
+ * \return episode
+ */
+extern unsigned short cmyth_proginfo_episode(cmyth_proginfo_t prog);
+
+/**
* Retrieve the category of a program.
* \param prog proginfo handle
* \return null-terminated string
@@ -805,6 +819,13 @@ extern char *cmyth_proginfo_seriesid(cmyth_proginfo_t prog);
extern char *cmyth_proginfo_programid(cmyth_proginfo_t prog);
/**
+ * Retrieve the inetref of a program.
+ * \param prog proginfo handle
+ * \return null-terminated string
+ */
+extern char *cmyth_proginfo_inetref(cmyth_proginfo_t prog);
+
+/**
* Retrieve the critics rating (number of stars) of a program.
* \param prog proginfo handle
* \return null-terminated string
View
19 lib/cmyth/libcmyth/bookmark.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <inttypes.h>
#include <errno.h>
#include <cmyth_local.h>
@@ -59,7 +60,7 @@ long long cmyth_get_bookmark(cmyth_conn_t conn, cmyth_proginfo_t prog)
}
if ((r=cmyth_rcv_long_long(conn, &err, &ll, count)) < 0) {
cmyth_dbg(CMYTH_DBG_ERROR,
- "%s: cmyth_rcv_longlong() failed (%d)\n",
+ "%s: cmyth_rcv_long_long() failed (%d)\n",
__FUNCTION__, r);
ret = err;
goto out;
@@ -74,7 +75,7 @@ long long cmyth_get_bookmark(cmyth_conn_t conn, cmyth_proginfo_t prog)
int cmyth_set_bookmark(cmyth_conn_t conn, cmyth_proginfo_t prog, long long bookmark)
{
char *buf;
- unsigned int len = CMYTH_TIMESTAMP_LEN + CMYTH_LONGLONG_LEN + 18;
+ unsigned int len = CMYTH_TIMESTAMP_LEN + CMYTH_LONGLONG_LEN * 2 + 18;
char resultstr[3];
int r,err;
int ret;
@@ -85,8 +86,18 @@ int cmyth_set_bookmark(cmyth_conn_t conn, cmyth_proginfo_t prog, long long bookm
if (!buf) {
return -ENOMEM;
}
- sprintf(buf,"%s %ld %s %lld %lld","SET_BOOKMARK",prog->proginfo_chanId,
- start_ts_dt, bookmark >> 32,(bookmark & 0xffffffff));
+ if (conn->conn_version >= 66) {
+ /*
+ * Since protocol 66 mythbackend expects a single 64 bit integer rather than two 32 bit
+ * hi and lo integers.
+ */
+ sprintf(buf, "SET_BOOKMARK %ld %s %"PRIu64, prog->proginfo_chanId,
+ start_ts_dt, (int64_t)bookmark);
+ }
+ else {
+ sprintf(buf, "SET_BOOKMARK %ld %s %d %d", prog->proginfo_chanId,
+ start_ts_dt, (int32_t)(bookmark >> 32), (int32_t)(bookmark & 0xffffffff));
+ }
pthread_mutex_lock(&mutex);
if ((err = cmyth_send_message(conn,buf)) < 0) {
cmyth_dbg(CMYTH_DBG_ERROR,
View
3  lib/cmyth/libcmyth/cmyth_local.h
@@ -224,6 +224,8 @@ struct cmyth_proginfo {
char *proginfo_title;
char *proginfo_subtitle;
char *proginfo_description;
+ unsigned short proginfo_season; /* new in V67 */
+ unsigned short proginfo_episode; /* new in V67 */
char *proginfo_category;
long proginfo_chanId;
char *proginfo_chanstr;
@@ -258,6 +260,7 @@ struct cmyth_proginfo {
char *proginfo_chan_output_filters; /* new in V8 */
char *proginfo_seriesid; /* new in V8 */
char *proginfo_programid; /* new in V12 */
+ char *proginfo_inetref; /* new in V67 */
cmyth_timestamp_t proginfo_lastmodified; /* new in V12 */
char *proginfo_stars; /* new in V12 */
cmyth_timestamp_t proginfo_originalairdate; /* new in V12 */
View
33 lib/cmyth/libcmyth/connection.c
@@ -56,6 +56,15 @@ static myth_protomap_t protomap[] = {
{62, "78B5631E"},
{63, "3875641D"},
{64, "8675309J"},
+ {65, "D2BB94C2"},
+ {66, "0C0FFEE0"},
+ {67, "0G0G0G0"},
+ {68, "90094EAD"},
+ {69, "63835135"},
+ {70, "53153836"},
+ {71, "05e82186"},
+ {72, "D78EFD6F"},
+ {73, "D7FE8D6F"},
{0, 0}
};
@@ -527,7 +536,7 @@ cmyth_conn_connect_file(cmyth_proginfo_t prog, cmyth_conn_t control,
int err = 0;
int count = 0;
int r;
- int ann_size = sizeof("ANN FileTransfer []:[][]:[]");
+ int ann_size = sizeof("ANN FileTransfer 0[]:[][]:[]");
cmyth_file_t ret = NULL;
if (!prog) {
@@ -575,6 +584,12 @@ cmyth_conn_connect_file(cmyth_proginfo_t prog, cmyth_conn_t control,
myth_host, prog->proginfo_port, buflen);
goto shut;
}
+ /*
+ * Explicitly set the conn version to the control version as cmyth_connect() doesn't and some of
+ * the cmyth_rcv_* functions expect it to be the same as the protocol version used by mythbackend.
+ */
+ conn->conn_version = control->conn_version;
+
ann_size += strlen(prog->proginfo_pathname) + strlen(my_hostname);
announcement = malloc(ann_size);
if (!announcement) {
@@ -584,7 +599,7 @@ cmyth_conn_connect_file(cmyth_proginfo_t prog, cmyth_conn_t control,
goto shut;
}
if (control->conn_version >= 44) {
- sprintf(announcement, "ANN FileTransfer %s[]:[]%s[]:[]",
+ sprintf(announcement, "ANN FileTransfer %s 0[]:[]%s[]:[]", // write = false
my_hostname, prog->proginfo_pathname);
}
else {
@@ -631,7 +646,7 @@ cmyth_conn_connect_file(cmyth_proginfo_t prog, cmyth_conn_t control,
r = cmyth_rcv_u_long_long(conn, &err, &ret->file_length, count);
if (err) {
cmyth_dbg(CMYTH_DBG_ERROR,
- "%s: (length) cmyth_rcv_longlong() failed (%d)\n",
+ "%s: (length) cmyth_rcv_u_long_long() failed (%d)\n",
__FUNCTION__, err);
goto shut;
}
@@ -683,7 +698,7 @@ cmyth_conn_connect_path(char* path, cmyth_conn_t control,
int err = 0;
int count = 0;
int r, port;
- int ann_size = sizeof("ANN FileTransfer []:[][]:[]");
+ int ann_size = sizeof("ANN FileTransfer 0[]:[][]:[]");
struct sockaddr_in addr;
socklen_t addr_size = sizeof(addr);
cmyth_file_t ret = NULL;
@@ -716,6 +731,12 @@ cmyth_conn_connect_path(char* path, cmyth_conn_t control,
__FUNCTION__, host, port, buflen);
goto shut;
}
+ /*
+ * Explicitly set the conn version to the control version as cmyth_connect() doesn't and some of
+ * the cmyth_rcv_* functions expect it to be the same as the protocol version used by mythbackend.
+ */
+ conn->conn_version = control->conn_version;
+
ann_size += strlen(path) + strlen(my_hostname);
announcement = malloc(ann_size);
if (!announcement) {
@@ -725,7 +746,7 @@ cmyth_conn_connect_path(char* path, cmyth_conn_t control,
goto shut;
}
if (control->conn_version >= 44) {
- sprintf(announcement, "ANN FileTransfer %s[]:[]%s[]:[]",
+ sprintf(announcement, "ANN FileTransfer %s 0[]:[]%s[]:[]", // write = false
my_hostname, path);
}
else {
@@ -771,7 +792,7 @@ cmyth_conn_connect_path(char* path, cmyth_conn_t control,
r = cmyth_rcv_u_long_long(conn, &err, &ret->file_length, count);
if (err) {
cmyth_dbg(CMYTH_DBG_ERROR,
- "%s: (length) cmyth_rcv_longlong() failed (%d)\n",
+ "%s: (length) cmyth_rcv_u_long_long() failed (%d)\n",
__FUNCTION__, err);
goto shut;
}
View
31 lib/cmyth/libcmyth/file.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <inttypes.h>
#ifndef _MSC_VER
#include <sys/socket.h>
#endif
@@ -449,14 +450,28 @@ cmyth_file_seek(cmyth_file_t file, long long offset, int whence)
pthread_mutex_lock(&mutex);
- snprintf(msg, sizeof(msg),
- "QUERY_FILETRANSFER %ld[]:[]SEEK[]:[]%d[]:[]%d[]:[]%d[]:[]%d[]:[]%d",
- file->file_id,
- (int32_t)(offset >> 32),
- (int32_t)(offset & 0xffffffff),
- whence,
- (int32_t)(file->file_pos >> 32),
- (int32_t)(file->file_pos & 0xffffffff));
+ if (file->file_control->conn_version >= 66) {
+ /*
+ * Since protocol 66 mythbackend expects to receive a single 64 bit integer rather than
+ * two 32 bit hi and lo integers.
+ */
+ snprintf(msg, sizeof(msg),
+ "QUERY_FILETRANSFER %ld[]:[]SEEK[]:[]%"PRIu64"[]:[]%d[]:[]%"PRIu64,
+ file->file_id,
+ (int64_t)offset,
+ whence,
+ (int64_t)file->file_pos);
+ }
+ else {
+ snprintf(msg, sizeof(msg),
+ "QUERY_FILETRANSFER %ld[]:[]SEEK[]:[]%d[]:[]%d[]:[]%d[]:[]%d[]:[]%d",
+ file->file_id,
+ (int32_t)(offset >> 32),
+ (int32_t)(offset & 0xffffffff),
+ whence,
+ (int32_t)(file->file_pos >> 32),
+ (int32_t)(file->file_pos & 0xffffffff));
+ }
if ((err = cmyth_send_message(file->file_control, msg)) < 0) {
cmyth_dbg(CMYTH_DBG_ERROR,
View
63 lib/cmyth/libcmyth/proginfo.c
@@ -116,6 +116,9 @@ cmyth_proginfo_destroy(cmyth_proginfo_t p)
if (p->proginfo_programid) {
ref_release(p->proginfo_programid);
}
+ if (p->proginfo_inetref) {
+ ref_release(p->proginfo_inetref);
+ }
if (p->proginfo_stars) {
ref_release(p->proginfo_stars);
}
@@ -217,6 +220,8 @@ cmyth_proginfo_create(void)
ret->proginfo_title = NULL;
ret->proginfo_subtitle = NULL;
ret->proginfo_description = NULL;
+ ret->proginfo_season = 0;
+ ret->proginfo_episode = 0;
ret->proginfo_category = NULL;
ret->proginfo_chanId = 0;
ret->proginfo_chanstr = NULL;
@@ -250,6 +255,7 @@ cmyth_proginfo_create(void)
ret->proginfo_chan_output_filters = NULL;
ret->proginfo_seriesid = NULL;
ret->proginfo_programid = NULL;
+ ret->proginfo_inetref = NULL;
ret->proginfo_stars = NULL;
ret->proginfo_version = 12;
ret->proginfo_hasairdate = 0;
@@ -307,6 +313,8 @@ cmyth_proginfo_dup(cmyth_proginfo_t p)
ret->proginfo_title = ref_hold(p->proginfo_title);
ret->proginfo_subtitle = ref_hold(p->proginfo_subtitle);
ret->proginfo_description = ref_hold(p->proginfo_description);
+ ret->proginfo_season = p->proginfo_season;
+ ret->proginfo_episode = p->proginfo_episode;
ret->proginfo_category = ref_hold(p->proginfo_category);
ret->proginfo_chanId = p->proginfo_chanId;
ret->proginfo_chanstr = ref_hold(p->proginfo_chanstr);
@@ -340,6 +348,7 @@ cmyth_proginfo_dup(cmyth_proginfo_t p)
ret->proginfo_chan_output_filters = ref_hold(p->proginfo_chan_output_filters);
ret->proginfo_seriesid = ref_hold(p->proginfo_seriesid);
ret->proginfo_programid = ref_hold(p->proginfo_programid);
+ ret->proginfo_inetref = ref_hold(p->proginfo_inetref);
ret->proginfo_stars = ref_hold(p->proginfo_stars);
ret->proginfo_version = p->proginfo_version;
ret->proginfo_hasairdate = p->proginfo_hasairdate;
@@ -386,7 +395,7 @@ delete_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
char *buf;
unsigned int len = ((2 * CMYTH_LONGLONG_LEN) +
(6 * CMYTH_TIMESTAMP_LEN) +
- (14 * CMYTH_LONG_LEN));
+ (16 * CMYTH_LONG_LEN));
char start_ts[CMYTH_TIMESTAMP_LEN + 1];
char end_ts[CMYTH_TIMESTAMP_LEN + 1];
char rec_start_ts[CMYTH_TIMESTAMP_LEN + 1];
@@ -415,8 +424,12 @@ delete_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
len += strlen(S(prog->proginfo_url));
len += strlen(S(prog->proginfo_hostname));
len += strlen(S(prog->proginfo_playgroup));
+ len += strlen(S(prog->proginfo_seriesid));
+ len += strlen(S(prog->proginfo_programid));
+ len += strlen(S(prog->proginfo_inetref));
len += strlen(S(prog->proginfo_recpriority_2));
len += strlen(S(prog->proginfo_storagegroup));
+ len += strlen(S(prog->proginfo_prodyear));
buf = alloca(len + 1+2048);
if (!buf) {
@@ -462,6 +475,10 @@ delete_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_title));
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_subtitle));
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_description));
+ if (control->conn_version >= 67) {
+ sprintf(buf + strlen(buf), "%u[]:[]", prog->proginfo_season);
+ sprintf(buf + strlen(buf), "%u[]:[]", prog->proginfo_episode);
+ }
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_category));
sprintf(buf + strlen(buf), "%ld[]:[]", prog->proginfo_chanId);
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_chanstr));
@@ -504,6 +521,9 @@ delete_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_chan_output_filters));
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_seriesid));
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_programid));
+ if (control->conn_version >= 67) {
+ sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_inetref));
+ }
sprintf(buf + strlen(buf), "%s[]:[]", lastmodified);
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_stars));
sprintf(buf + strlen(buf), "%s[]:[]", originalairdate);
@@ -773,6 +793,24 @@ cmyth_proginfo_description(cmyth_proginfo_t prog)
return ref_hold(prog->proginfo_description);
}
+unsigned short
+cmyth_proginfo_season(cmyth_proginfo_t prog)
+{
+ if (!prog) {
+ return 0;
+ }
+ return prog->proginfo_season;
+}
+
+unsigned short
+cmyth_proginfo_episode(cmyth_proginfo_t prog)
+{
+ if (!prog) {
+ return 0;
+ }
+ return prog->proginfo_episode;
+}
+
/*
* cmyth_proginfo_category(cmyth_proginfo_t prog)
*
@@ -827,6 +865,17 @@ cmyth_proginfo_programid(cmyth_proginfo_t prog)
}
char *
+cmyth_proginfo_inetref(cmyth_proginfo_t prog)
+{
+ if (!prog) {
+ cmyth_dbg(CMYTH_DBG_ERROR, "%s: NULL inetref\n",
+ __FUNCTION__);
+ return NULL;
+ }
+ return ref_hold(prog->proginfo_inetref);
+}
+
+char *
cmyth_proginfo_stars(cmyth_proginfo_t prog)
{
if (!prog) {
@@ -1260,7 +1309,7 @@ fill_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
char *buf;
unsigned int len = ((2 * CMYTH_LONGLONG_LEN) +
(6 * CMYTH_TIMESTAMP_LEN) +
- (14 * CMYTH_LONG_LEN));
+ (16 * CMYTH_LONG_LEN));
char start_ts[CMYTH_TIMESTAMP_LEN + 1];
char end_ts[CMYTH_TIMESTAMP_LEN + 1];
char rec_start_ts[CMYTH_TIMESTAMP_LEN + 1];
@@ -1288,6 +1337,9 @@ fill_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
len += strlen(S(prog->proginfo_url));
len += strlen(S(prog->proginfo_hostname));
len += strlen(S(prog->proginfo_playgroup));
+ len += strlen(S(prog->proginfo_seriesid));
+ len += strlen(S(prog->proginfo_programid));
+ len += strlen(S(prog->proginfo_inetref));
len += strlen(S(prog->proginfo_recpriority_2));
len += strlen(S(prog->proginfo_storagegroup));
len += strlen(S(prog->proginfo_prodyear));
@@ -1336,6 +1388,10 @@ fill_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_title));
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_subtitle));
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_description));
+ if (control->conn_version >= 67) {
+ sprintf(buf + strlen(buf), "%u[]:[]", prog->proginfo_season);
+ sprintf(buf + strlen(buf), "%u[]:[]", prog->proginfo_episode);
+ }
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_category));
sprintf(buf + strlen(buf), "%ld[]:[]", prog->proginfo_chanId);
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_chanstr));
@@ -1378,6 +1434,9 @@ fill_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_chan_output_filters));
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_seriesid));
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_programid));
+ if (control->conn_version >= 67) {
+ sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_inetref));
+ }
sprintf(buf + strlen(buf), "%s[]:[]", lastmodified);
sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_stars));
sprintf(buf + strlen(buf), "%s[]:[]", originalairdate);
View
9 lib/cmyth/libcmyth/proglist.c
@@ -315,6 +315,7 @@ cmyth_proglist_get_list(cmyth_conn_t conn,
cmyth_proglist_t
cmyth_proglist_get_all_recorded(cmyth_conn_t control)
{
+ char query[32];
cmyth_proglist_t proglist = cmyth_proglist_create();
if (proglist == NULL) {
@@ -324,8 +325,14 @@ cmyth_proglist_get_all_recorded(cmyth_conn_t control)
return NULL;
}
+ if (control->conn_version < 65) {
+ strcpy(query, "QUERY_RECORDINGS Play");
+ }
+ else {
+ strcpy(query, "QUERY_RECORDINGS Ascending");
+ }
if (cmyth_proglist_get_list(control, proglist,
- "QUERY_RECORDINGS Play",
+ query,
__FUNCTION__) < 0) {
cmyth_dbg(CMYTH_DBG_ERROR,
"%s: cmyth_proglist_get_list() failed\n",
View
143 lib/cmyth/libcmyth/socket.c
@@ -882,23 +882,38 @@ cmyth_rcv_long_long(cmyth_conn_t conn, int *err, long long *buf, int count)
*err = EINVAL;
return 0;
}
- consumed = cmyth_rcv_u_long(conn, err, &hi, count);
- if (*err) {
- cmyth_dbg(CMYTH_DBG_ERROR,
- "%s: cmyth_rcv_long_long() failed (%d)\n",
- __FUNCTION__, consumed);
- return consumed;
+
+ if (conn->conn_version >= 66) {
+ /*
+ * Since protocol 66 mythbackend now sends a single 64 bit integer rather than two hi and lo
+ * 32 bit integers for ALL 64 bit values.
+ */
+ consumed = cmyth_rcv_int64(conn, err, &val, count);
+ if (*err) {
+ cmyth_dbg(CMYTH_DBG_ERROR,
+ "%s: cmyth_rcv_int64() failed (%d)\n",
+ __FUNCTION__, consumed);
+ return consumed;
+ }
}
- consumed += cmyth_rcv_u_long(conn, err, &lo, count-consumed);
- if (*err) {
- cmyth_dbg(CMYTH_DBG_ERROR,
- "%s: cmyth_rcv_long_long() failed (%d)\n",
- __FUNCTION__, consumed);
- return consumed;
+ else {
+ consumed = cmyth_rcv_u_long(conn, err, &hi, count);
+ if (*err) {
+ cmyth_dbg(CMYTH_DBG_ERROR,
+ "%s: cmyth_rcv_u_long_long() failed (%d)\n",
+ __FUNCTION__, consumed);
+ return consumed;
+ }
+ consumed += cmyth_rcv_u_long(conn, err, &lo, count-consumed);
+ if (*err) {
+ cmyth_dbg(CMYTH_DBG_ERROR,
+ "%s: cmyth_rcv_u_long_long() failed (%d)\n",
+ __FUNCTION__, consumed);
+ return consumed;
+ }
+ val = (((long long)hi) << 32) | ((long long)(lo & 0xFFFFFFFF));
}
- val = (((long long)hi) << 32) | ((long long)(lo & 0xFFFFFFFF));
-
*err = 0;
*buf = val;
@@ -1172,6 +1187,7 @@ cmyth_rcv_ulong_long(cmyth_conn_t conn, int *err,
unsigned long long *buf, int count)
{
unsigned long long val;
+ long long val64;
unsigned long hi, lo;
int consumed;
int tmp;
@@ -1186,23 +1202,45 @@ cmyth_rcv_ulong_long(cmyth_conn_t conn, int *err,
*err = EINVAL;
return 0;
}
- consumed = cmyth_rcv_u_long(conn, err, &hi, count);
- if (*err) {
- cmyth_dbg(CMYTH_DBG_ERROR,
- "%s: cmyth_rcv_ulong_long() failed (%d)\n",
- __FUNCTION__, consumed);
- return consumed;
+
+ if (conn->conn_version >= 66) {
+ /*
+ * Since protocol 66 mythbackend now sends a single 64 bit integer rather than two hi and lo
+ * 32 bit integers for ALL 64 bit values.
+ */
+ consumed = cmyth_rcv_int64(conn, err, &val64, count);
+ if (*err) {
+ cmyth_dbg(CMYTH_DBG_ERROR,
+ "%s: cmyth_rcv_int64() failed (%d)\n",
+ __FUNCTION__, consumed);
+ return consumed;
+ }
+ if (val64 < 0) {
+ cmyth_dbg(CMYTH_DBG_ERROR,
+ "%s: cmyth_rcv_int64() failed as signed 64 bit integer received\n",
+ __FUNCTION__, consumed);
+ *err = EINVAL;
+ return consumed;
+ }
+ val = (unsigned long long)val64;
}
- consumed += cmyth_rcv_u_long(conn, err, &lo, count);
- if (*err) {
- cmyth_dbg(CMYTH_DBG_ERROR,
- "%s: cmyth_rcv_ulong_long() failed (%d)\n",
- __FUNCTION__, consumed);
- return consumed;
+ else {
+ consumed = cmyth_rcv_u_long(conn, err, &hi, count);
+ if (*err) {
+ cmyth_dbg(CMYTH_DBG_ERROR,
+ "%s: cmyth_rcv_u_long_long() failed (%d)\n",
+ __FUNCTION__, consumed);
+ return consumed;
+ }
+ consumed += cmyth_rcv_u_long(conn, err, &lo, count);
+ if (*err) {
+ cmyth_dbg(CMYTH_DBG_ERROR,
+ "%s: cmyth_rcv_u_long_long() failed (%d)\n",
+ __FUNCTION__, consumed);
+ return consumed;
+ }
+ val = (((unsigned long long)hi) << 32) | ((unsigned long long)(lo & 0xFFFFFFFF));
}
-
- val = (((unsigned long long)hi) << 32) | ((unsigned long long)(lo & 0xFFFFFFFF));
-
*err = 0;
*buf = val;
@@ -1485,7 +1523,8 @@ cmyth_rcv_proginfo(cmyth_conn_t conn, int *err, cmyth_proginfo_t buf,
if (buf->proginfo_version >= 57) {
/*
- * Myth now sends a single 64bit int, rather than 2 32bit ints
+ * Since protocol 57 mythbackend now sends a single 64 bit integer rather than two 32 bit
+ * hi and lo integers for the proginfo length.
*/
rcv_64 = &cmyth_rcv_int64;
} else {
@@ -1536,6 +1575,29 @@ cmyth_rcv_proginfo(cmyth_conn_t conn, int *err, cmyth_proginfo_t buf,
ref_release(buf->proginfo_description);
buf->proginfo_description = ref_strdup(tmp_str);
+ if (buf->proginfo_version >= 67) {
+ /*
+ * Get season and episode (unsigned int)
+ */
+ consumed = cmyth_rcv_ushort(conn, err,
+ &buf->proginfo_season, count);
+ count -= consumed;
+ total += consumed;
+ if (*err) {
+ failed = "cmyth_rcv_ushort";
+ goto fail;
+ }
+
+ consumed = cmyth_rcv_ushort(conn, err,
+ &buf->proginfo_episode, count);
+ count -= consumed;
+ total += consumed;
+ if (*err) {
+ failed = "cmyth_rcv_ushort";
+ goto fail;
+ }
+ }
+
/*
* Get proginfo_category (string)
*/
@@ -1649,7 +1711,7 @@ cmyth_rcv_proginfo(cmyth_conn_t conn, int *err, cmyth_proginfo_t buf,
count -= consumed;
total += consumed;
if (*err) {
- failed = "cmyth_rcv_long_long";
+ failed = "rcv_64";
goto fail;
}
@@ -2013,7 +2075,7 @@ cmyth_rcv_proginfo(cmyth_conn_t conn, int *err, cmyth_proginfo_t buf,
count -= consumed;
total += consumed;
if (*err) {
- failed = "cmyth_rcv_timestamp";
+ failed = "cmyth_rcv_string";
goto fail;
}
if (buf->proginfo_programid)
@@ -2021,6 +2083,23 @@ cmyth_rcv_proginfo(cmyth_conn_t conn, int *err, cmyth_proginfo_t buf,
buf->proginfo_programid = ref_strdup(tmp_str);
}
+ if (buf->proginfo_version >= 67) {
+ /*
+ * Get inetref (string)
+ */
+ consumed = cmyth_rcv_string(conn, err, tmp_str,
+ sizeof(tmp_str) - 1, count);
+ count -= consumed;
+ total += consumed;
+ if (*err) {
+ failed = "cmyth_rcv_string";
+ goto fail;
+ }
+ if (buf->proginfo_inetref)
+ ref_release(buf->proginfo_inetref);
+ buf->proginfo_inetref = ref_strdup(tmp_str);
+ }
+
if (buf->proginfo_version >= 12) {
/*
* Get lastmodified (string)
Something went wrong with that request. Please try again.