From 1dfb7d0bc0394eaf9152bd6363033a2ac3db5967 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Sun, 28 May 2006 08:45:44 +0000 Subject: [PATCH] add ogg metainfo parsing, and ogg playback. fix problems with not recognizing when to transcode on rsp --- src/ff-plugins.h | 1 + src/mp3-scanner.c | 2 +- src/plugin.c | 1 + src/plugins/rsp.c | 38 ++++++++++++++++++++---------------- win32/mt-daapd.vcproj | 19 ++++++++++-------- win32/nsi/mt-daapd.nsi.templ | 2 ++ 6 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/ff-plugins.h b/src/ff-plugins.h index 7ecaafbe..d9558e63 100644 --- a/src/ff-plugins.h +++ b/src/ff-plugins.h @@ -130,6 +130,7 @@ typedef struct tag_plugin_input_fn { char* (*server_ver)(void); int (*server_name)(char *, int *); void (*log)(int, char *, ...); + int (*can_transcode)(char *); int (*db_count)(void); int (*db_enum_start)(char **, DB_QUERY *); diff --git a/src/mp3-scanner.c b/src/mp3-scanner.c index 9870677b..c1cc511c 100644 --- a/src/mp3-scanner.c +++ b/src/mp3-scanner.c @@ -203,7 +203,7 @@ void scan_process_playlistlist(void) { while(scan_playlistlist.next) { pnext=scan_playlistlist.next; - DPRINTF(E_DBG,L_SCAN,"About to scan %S\n",pnext->path); + DPRINTF(E_DBG,L_SCAN,"About to scan %s\n",pnext->path); ext=pnext->path; if(strrchr(pnext->path,'.')) { ext = strrchr(pnext->path,'.'); diff --git a/src/plugin.c b/src/plugin.c index 58b5aa4e..c6573c21 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -108,6 +108,7 @@ PLUGIN_INPUT_FN pi = { pi_server_ver, pi_server_name, pi_log, + plugin_ssc_can_transcode, pi_db_count, pi_db_enum_start, diff --git a/src/plugins/rsp.c b/src/plugins/rsp.c index daeaca03..02a3a77b 100644 --- a/src/plugins/rsp.c +++ b/src/plugins/rsp.c @@ -339,23 +339,25 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) { int returned; char *browse_type; int type; - char *transcode_codecs; int transcode; int samplerate; - // char *user_agent; - /* - user_agent = _ppi->ws_getrequestheader(pwsc,"user-agent"); - if(user_agent) { - if(strncmp(user_agent,"iTunes",6)==0) { - trancode_codecs = "wma,ogg,flac,mpc"; - } else if(strncmp(user_agent,"Roku",4)==0) { - transcode_codecs = "ogg,flac,mpc,alac"; - } else { - transcode_codecs = "wma,ogg,flac,mpc,alac"; + char *user_agent; + char *native_codecs; + + native_codecs = _ppi->ws_getrequestheader(pwsc,"accept-codecs"); + if(!native_codecs) { + user_agent = _ppi->ws_getrequestheader(pwsc,"user-agent"); + if(user_agent) { + if(strncmp(user_agent,"iTunes",6)==0) { + native_codecs = "mpeg,mp4a,wav,mp4v"; + } else if(strncmp(user_agent,"Roku",4)==0) { + native_codecs = "mpeg,mp4a,wav,wma"; + } else { + native_codecs = "mpeg,mp4a,wav"; + } } } - */ ppi->dq.filter = _ppi->ws_getvar(pwsc,"query"); ppi->dq.filter_type = FILTER_TYPE_FIREFLY; @@ -397,8 +399,6 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) { returned = ppi->dq.totalcount - ppi->dq.offset; } - transcode_codecs = _ppi->conf_alloc_string("general","ssc_codectypes",""); - xml_push(pxml,"response"); xml_push(pxml,"status"); xml_output(pxml,"errorcode","0"); @@ -413,8 +413,12 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) { xml_push(pxml,"item"); rowindex=0; transcode = 0; - if(strstr(transcode_codecs,row[37])) /* FIXME: ticket #21 */ - transcode = 1; + + if(!strstr(native_codecs,row[37])) { + if(_ppi->can_transcode(row[37])) { + transcode = 1; + } + } while(rsp_fields[rowindex].name) { if((rsp_fields[rowindex].flags & type) && @@ -438,6 +442,7 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) { break; case 37: xml_output(pxml,rsp_fields[rowindex].name,"%s","wav"); + xml_output(pxml,"original_codec","%s",row[37]); break; default: xml_output(pxml,rsp_fields[rowindex].name,"%s", @@ -456,7 +461,6 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) { } _ppi->db_enum_end(NULL); - _ppi->conf_dispose_string(transcode_codecs); xml_pop(pxml); /* items */ xml_pop(pxml); /* response */ diff --git a/win32/mt-daapd.vcproj b/win32/mt-daapd.vcproj index a6e4e2b2..06aff689 100644 --- a/win32/mt-daapd.vcproj +++ b/win32/mt-daapd.vcproj @@ -21,10 +21,10 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="$(InputDir),..\src,.,.." - PreprocessorDefinitions="HAVE_CONFIG_H;ZLIB_DLL;_WINDOWS;FLAC" + PreprocessorDefinitions="HAVE_CONFIG_H;ZLIB_DLL;_WINDOWS;FLAC;OGGVORBIS" MinimalRebuild="TRUE" BasicRuntimeChecks="3" - RuntimeLibrary="5" + RuntimeLibrary="1" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" @@ -33,11 +33,11 @@ Name="VCCustomBuildTool"/> + + diff --git a/win32/nsi/mt-daapd.nsi.templ b/win32/nsi/mt-daapd.nsi.templ index 71ed1367..59378643 100644 --- a/win32/nsi/mt-daapd.nsi.templ +++ b/win32/nsi/mt-daapd.nsi.templ @@ -160,6 +160,7 @@ Section "MainSection" SEC01 File "${ADMIN_ROOT}\applet.html" File "${ADMIN_ROOT}\spinner.gif" File "${ADMIN_ROOT}\util.js" + File "${ADMIN_ROOT}\pngfix.js" SetOutPath "$2\admin-root\lib-js" File "${ADMIN_ROOT}\lib-js\prototype.js" File "${ADMIN_ROOT}\lib-js\rico.js" @@ -443,6 +444,7 @@ Section Uninstall Delete "$INSTDIR\admin-root\smart.js" Delete "$INSTDIR\admin-root\spinner.gif" Delete "$INSTDIR\admin-root\util.js" + Delete "$INSTDIR\admin-root\pngfix.js" Delete "$INSTDIR\admin-root\smartpopup.html" Delete "$INSTDIR\admin-root\status.html" Delete "$INSTDIR\admin-root\status.js"