Package: gmediaserver Version: 0.13.0-6 Severity: normal Tags: patch Hi!
Attached is a patch with few cherry-picked fixes from upstream CVS, to enable gmediaserver to work correctly with a PS3. The relevant patch is debian/patches/00_cvs_fixes.diff, but it conflicted with debian/patches/06_fix_noxon_sort.diff, so I've rebased that one, and just included a patch against the debian packaging. thanks, guillem
diff -Nru gmediaserver-0.13.0/debian/patches/00_cvs_fixes.diff gmediaserver-0.13.0/debian/patches/00_cvs_fixes.diff --- gmediaserver-0.13.0/debian/patches/00_cvs_fixes.diff 1970-01-01 01:00:00.000000000 +0100 +++ gmediaserver-0.13.0/debian/patches/00_cvs_fixes.diff 2011-01-22 06:50:26.000000000 +0100 @@ -0,0 +1,184 @@ +Description: Fix several things from upstream CVS +Origin: upstream + +diff -Naur -x CVS gmediaserver-orig/src/connectmgr.c gmediaserver/src/connectmgr.c +--- gmediaserver-orig/src/connectmgr.c 2007-10-18 18:30:04.000000000 +0200 ++++ gmediaserver/src/connectmgr.c 2008-05-06 20:39:30.000000000 +0200 +@@ -32,8 +32,8 @@ + * this: "http-get:*:audio/mpeg:*,http-get:*:audio/m3u:*,..") we use + * this generic string which is accepted according to the standard. + */ +- upnp_add_response(event, "SOURCE", "http-get:*:*:*"); +- upnp_add_response(event, "SINK", ""); ++ upnp_add_response(event, "Source", "http-get:*:*:*"); ++ upnp_add_response(event, "Sink", ""); + return event->status; + } + +diff -Naur -x CVS gmediaserver-orig/src/contentdir.c gmediaserver/src/contentdir.c +--- gmediaserver-orig/src/contentdir.c 2007-10-20 09:59:38.000000000 +0200 ++++ gmediaserver/src/contentdir.c 2007-11-29 21:06:53.000000000 +0100 +@@ -141,22 +141,21 @@ + sort_criteria_comparision(const void *k1, const void *k2, void *data) + { + SortCriteria *criteria = data; +- SortCriteriaEntry *sort_entry; ++ SortCriteriaEntry *se; + const Entry *e1 = k1; + const Entry *e2 = k2; + +- sort_entry = criteria->first; +- while (sort_entry != NULL) { +- char *p1 = get_entry_property(e1, sort_entry->property); +- char *p2 = get_entry_property(e2, sort_entry->property); ++ for (se = criteria->first; se != NULL; se = se->next) { ++ char *p1 = get_entry_property(e1, se->property); ++ char *p2 = get_entry_property(e2, se->property); + + if (p1 == NULL && p2 != NULL) { + free(p2); +- return (sort_entry->ascending ? -1 : 1); ++ return (se->ascending ? -1 : 1); + } + if (p1 != NULL && p2 == NULL) { + free(p1); +- return (sort_entry->ascending ? 1 : -1); ++ return (se->ascending ? 1 : -1); + } + if (p1 != NULL && p2 != NULL) { + int compare; +@@ -165,11 +164,11 @@ + free(p1); + free(p2); + if (compare != 0) +- return (sort_entry->ascending ? compare : -compare); ++ return (se->ascending ? compare : -compare); + } + } + +- return e1-e2; ++ return e1-e2; /* Just some arbitrary sort criteria? */ + } + + void +diff -Naur -x CVS gmediaserver-orig/src/metadata.c gmediaserver/src/metadata.c +--- gmediaserver-orig/src/metadata.c 2007-10-20 11:41:32.000000000 +0200 ++++ gmediaserver/src/metadata.c 2010-02-14 20:23:36.000000000 +0100 +@@ -66,7 +66,7 @@ + #define MAX_INVALID_EXTM3U_FILES 16 + #define MAX_INVALID_PLS_FILES 16 + #define MAX_INVALID_PLS_LINES 16 +-#define EXT_INFO_DEFAULT "DLNA.ORG_PS=1;DLNA.ORG_CI=0;DLNA.ORG_OP=00;DLNA.ORG_FLAGS=00000000000000000000000000000000" ++#define EXT_INFO_DEFAULT "DLNA.ORG_PS=1;DLNA.ORG_CI=0;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=00000000000000000000000000000000" + #define EXT_INFO_PN ";DLNA.ORG_PN=" + + typedef enum { +@@ -109,7 +109,7 @@ + [FILE_MP3] = "MP3", + [FILE_MP3_ID3] = "MP3", + [FILE_WMA] = "WMAFULL", +- [FILE_RIFF_WAVE] = NULL, ++ [FILE_RIFF_WAVE] = "LPCM", + [FILE_M4A] = NULL, + [FILE_OGG] = NULL, + [FILE_MPG] = NULL, +@@ -129,11 +129,11 @@ + [FILE_MP3] = "audio/mpeg", + [FILE_MP3_ID3] = "audio/mpeg", + [FILE_WMA] = "audio/x-ms-wma", +- [FILE_RIFF_WAVE] = "audio/x-wav", ++ [FILE_RIFF_WAVE] = "audio/x-wav", /* DMS: was x-wav */ + [FILE_M4A] = "audio/mp4", +- [FILE_OGG] = "audio/vorbis", ++ [FILE_OGG] = "application/ogg", + [FILE_MPG] = "video/mpeg", +- [FILE_MP4] = "video/mp4", ++ [FILE_MP4] = "video/divx", /* DMS: was mp4*/ + [FILE_PLS] = "audio/x-scpls", + [FILE_M3U] = "audio/m3u", + [FILE_EXTM3U] = "audio/m3u", +@@ -153,7 +153,7 @@ + [FILE_M4A] = "m4a", + [FILE_OGG] = "ogg", + [FILE_MPG] = "mpg", +- [FILE_MP4] = "mp4", ++ [FILE_MP4] = "divx", /*DMS: was mp4*/ + [FILE_PLS] = "pls", + [FILE_M3U] = "m3u", + [FILE_EXTM3U] = "m3u", /* possibly extm3u in the future */ +@@ -314,17 +314,26 @@ + static FileType + check_file_content_type(const char *fullpath) + { +- const char *magic; ++ const char *magic_full; ++ char *magic; + int fd; + uint8_t buf[11]; + int c; + +- magic = magic_file(magic_cookie, fullpath); +- if (magic == NULL) { ++ magic_full = magic_file(magic_cookie, fullpath); ++ if (magic_full == NULL) { + warn(_("%s: cannot identify file type: %s\n"), quotearg(conv_filename(fullpath)), magic_error(magic_cookie)); + return FILE_UNKNOWN; + } + ++ magic = strpbrk(magic_full, "; "); ++ if (magic != NULL) { ++ magic = xstrndup(magic_full, magic - magic_full); ++ } else { ++ magic = xstrdup(magic_full); ++ } ++ say(4, _("Got magic for %s '%s'\n"), quote(conv_filename(fullpath)), magic); ++ + if (strcmp(magic, "application/octet-stream") != 0 + && strncmp(magic, "text/plain", 10) != 0) { + struct { +@@ -341,6 +350,7 @@ + { FILE_MPG, "video/mp2p" }, + { FILE_MPG, "video/mp2t" }, + { FILE_MP4, "video/mp4" }, ++ { FILE_MP4, "video/x-msvideo" }, /* DMS: avi */ + { FILE_MP4, "video/mp4v-es" }, + { FILE_MP4, "video/h264" }, + { FILE_MP4, "video/3gpp" }, +@@ -352,10 +362,13 @@ + { 0, }, + }; + for (c = 0; mime_map[c].mime != NULL; c++) { +- if (strcmp(magic, mime_map[c].mime) == 0) ++ if (strcmp(magic, mime_map[c].mime) == 0) { ++ free(magic); + return mime_map[c].id; ++ } + } + } ++ free(magic); + + fd = open(fullpath, O_RDONLY); + if (fd < 0) { +@@ -862,18 +875,21 @@ + } else { + say(4, _("%s Matched type %s - %s\n"), indent, file_type_descs[type], file_type_mime_types[type]); + } ++ ++#ifdef RESTRICT_FILE_TYPES + if (!string_in_csv(file_types, ',', file_type_names[type])) { + say(4, _("%s Skipping (file type excluded)\n"), indent); + free(indent); + return NULL; + } ++#endif + + if (type == FILE_PLS || type == FILE_M3U || type == FILE_EXTM3U) { + free(indent); + return scan_playlist_file(fullpath, name, parent, type, indent_size+1, inl, sb.st_ino); + } + +- /*say(4, _("%s Adding as %s\n"), indent, quote(name));*/ ++ say(4, _("%s Adding %s as '%s'\n"), indent, quote(name), file_type_mime_types[type]); + entry = make_entry(name, parent, false); + + detail = add_entry_detail(entry, DETAIL_FILE); diff -Nru gmediaserver-0.13.0/debian/patches/06_fix_noxon_sort.diff gmediaserver-0.13.0/debian/patches/06_fix_noxon_sort.diff --- gmediaserver-0.13.0/debian/patches/06_fix_noxon_sort.diff 2009-10-20 14:37:14.000000000 +0200 +++ gmediaserver-0.13.0/debian/patches/06_fix_noxon_sort.diff 2011-01-20 22:36:46.000000000 +0100 @@ -1,49 +1,43 @@ -Index: gmediaserver-0.13.0/src/contentdir.c -=================================================================== ---- gmediaserver-0.13.0.orig/src/contentdir.c 2009-10-20 14:36:41.000000000 +0200 -+++ gmediaserver-0.13.0/src/contentdir.c 2009-10-20 14:37:07.000000000 +0200 -@@ -145,8 +145,15 @@ +--- + src/contentdir.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +--- a/src/contentdir.c ++++ b/src/contentdir.c +@@ -145,6 +145,12 @@ sort_criteria_comparision(const void *k1 const Entry *e1 = k1; const Entry *e2 = k2; -+ if ( criteria->first == NULL ) { ++ if (criteria->first == NULL) { + /* default sorting */ + return strcasecmp(e1->name, e2->name); + } + - sort_entry = criteria->first; -- while (sort_entry != NULL) { -+ + /* FIXME: sorting by multiple criterias will never work */ -+ while (sort_entry != NULL) { /* FIXME: sort_entry is never updated! */ - char *p1 = get_entry_property(e1, sort_entry->property); - char *p2 = get_entry_property(e2, sort_entry->property); - -@@ -154,11 +161,11 @@ + for (se = criteria->first; se != NULL; se = se->next) { + char *p1 = get_entry_property(e1, se->property); + char *p2 = get_entry_property(e2, se->property); +@@ -153,11 +159,11 @@ sort_criteria_comparision(const void *k1 free(p2); - return (sort_entry->ascending ? -1 : 1); + return (se->ascending ? -1 : 1); } - if (p1 != NULL && p2 == NULL) { + else if (p1 != NULL && p2 == NULL) { free(p1); - return (sort_entry->ascending ? 1 : -1); + return (se->ascending ? 1 : -1); } - if (p1 != NULL && p2 != NULL) { + else if (p1 != NULL && p2 != NULL) { int compare; compare = strcmp(p1, p2); -@@ -167,9 +174,12 @@ +@@ -166,6 +172,9 @@ sort_criteria_comparision(const void *k1 if (compare != 0) - return (sort_entry->ascending ? compare : -compare); + return (se->ascending ? compare : -compare); } + else { /* both are null - bail out!!! */ -+ return strcasecmp(e1->name, e2->name); -+ } ++ return strcasecmp(e1->name, e2->name); ++ } } -- return e1-e2; -+ return e1-e2; /* FIXME: sorting by pointer compare? */ - } - - void + return e1-e2; /* Just some arbitrary sort criteria? */ diff -Nru gmediaserver-0.13.0/debian/patches/series gmediaserver-0.13.0/debian/patches/series --- gmediaserver-0.13.0/debian/patches/series 2009-11-10 13:33:16.000000000 +0100 +++ gmediaserver-0.13.0/debian/patches/series 2011-01-22 06:53:43.000000000 +0100 @@ -1,3 +1,4 @@ +00_cvs_fixes.diff 03_fix_info_file.diff 04_dont_blog_signals_if_not_processing_them.diff 05_fix_multiple_dirs.diff