Re: a few patches
"Kristian G. Kvilekval" <[email protected]>
| Newsgroups | gmane.comp.audio.zinf.devel |
|---|---|
| Message-ID | <1059698737.22854.51.camel@merrimack> |
Thanks for the patches. I'll try them out this weekend.
Send any and all patches you've got. If they
are really big. Place them on sourceforge
and send a note about what it does to the list.
Thx.
On Thu, 2003-07-31 at 18:16, David Hough wrote:
> Hi,
>
> I've recently been looking to use zinf as my main music player but first
> I've had to fix some bugs and do some customizing, so here are the patches
> i've developed so far
>
> 1. The fastforward and rewind keyboard shortcuts try to go past the
> beggining and end of the files, and crash zinf if playing mp3s, ogg files
> seem fine with this for some reason
>
> --- zinfunpatched/ui/zinf/src/ZinfTheme.cpp 2003-05-18 20:56:17.000000000
> +0000
> +++ zinf/ui/zinf/src/ZinfTheme.cpp 2003-08-01 00:32:14.000000000 +0000
> @@ -1402,22 +1402,26 @@
>
> void ZinfTheme::StepPosition(int iSteps)
> {
> - string oSeek("Seek");
> - //string oName("Info"), oEmpty("");
> +
> + if (m_iFramesSinceSeek > 0) {
> int iValue, iFrame;
> - m_pWindow->ControlIntValue(oSeek, false, iValue);
>
> + if ((m_iCurrentSeconds == m_iTotalSeconds) && (iSteps > 0))
> + return;
>
> - iFrame = (int)(((float)iValue * (float)m_iTotalSeconds) /
> - ((float)100 * m_fSecondsPerFrame));
> + iValue = m_iCurrentSeconds + iSteps;
> + if (iValue > m_iTotalSeconds)
> + iValue = m_iTotalSeconds;
> + if (iValue < 0)
> + iValue = 0;
>
> - iFrame += (int)(iSteps / m_fSecondsPerFrame);
> + iFrame = (int)((float)iValue / m_fSecondsPerFrame);
>
> m_bSeekInProgress = false;
> m_pContext->target->AcceptEvent(
> - new VolumeEvent(CMD_ChangePosition, iFrame + 1));
> + new ChangePositionEvent(iFrame));
> m_iFramesSinceSeek = 0;
> - //m_pWindow->ControlStringValue(oName, true, oEmpty);
> + }
> }
>
>
> 2. Zinf hangs if you press next to quickly while playing ogg files in linux
> This hack seems to work for me, instead of hanging, an error message about
> a corrupted file is printed out and zinf continues as normal
>
> --- zinfunpatched/lmc/vorbis/src/vorbislmc.cpp 2003-03-20
> 22:25:33.000000000 +0000
> +++ zinf/lmc/vorbis/src/vorbislmc.cpp 2003-07-31 23:33:17.000000000 +0000
> @@ -565,9 +565,13 @@
> Err = m_pInputBuffer->BeginRead(ptr, bytes);
> if (Err == kError_NoDataAvail)
> {
> + if (m_bExit)
> + break;
> +
> m_pPmi->Wake();
> +
> if (Sleep())
> - return kError_Interrupt;
> + break;
> continue;
> }
> if (Err == kError_EndOfStream)
>
>
> 3. If you have a long playlist and get an output error, like card busy etc,
> when u click ok on the error message, zinf just goes onto the next file and
> tries again, so you end up having an unending succsession of error
> messages, making zinf unusable
>
> diff -u -r zinfunpatched/base/include/event.h zinf/base/include/event.h
> --- zinfunpatched/base/include/event.h 2003-02-05 17:52:52.000000000 +0000
> +++ zinf/base/include/event.h 2003-07-31 23:29:02.000000000 +0000
> @@ -151,5 +151,6 @@
> #define CMD_EditCurrentPlaylistItemInfo 84 // Used to instruct the info
> editor to edit the current metadata item
> #define INFO_CDNotFound 93 // sent by mbcd plugin to
> musicbrowser
> #define INFO_DatabaseUpgraded 94 // sent by the MB to UIs when it
> wipes the database.
> +#define INFO_DoneOutputtingDueToOutputError 95 //Sent by PMO an error
> occurs
> #endif // _EVENT_H_
>
> diff -u -r zinfunpatched/base/src/player.cpp zinf/base/src/player.cpp
> --- zinfunpatched/base/src/player.cpp 2003-07-22 21:15:38.000000000 +0000
> +++ zinf/base/src/player.cpp 2003-07-31 23:29:02.000000000 +0000
> @@ -1517,6 +1517,12 @@
> return;
> }
>
> + if (pEvent->Type() == INFO_DoneOutputtingDueToOutputError)
> + {
> + delete pEvent;
> + return;
> + }
> +
> if (m_plm->HasAnotherItem())
> {
> //AcceptEvent(new Event(CMD_NextMediaPiece));
> diff -u -r zinfunpatched/io/include/pmo.h zinf/io/include/pmo.h
> --- zinfunpatched/io/include/pmo.h 2003-02-05 17:52:38.000000000 +0000
> +++ zinf/io/include/pmo.h 2003-07-31 23:29:02.000000000 +0000
> @@ -83,6 +83,7 @@
> virtual void SetPMI(PhysicalMediaInput *pPMI);
> virtual Error SetTo(const char *url);
>
> + virtual void ReportError(const char * format, ...);
> virtual const char *GetErrorString(int32_t) { return NULL; };
>
> protected:
> diff -u -r zinfunpatched/io/src/pmo.cpp zinf/io/src/pmo.cpp
> --- zinfunpatched/io/src/pmo.cpp 2003-03-15 01:01:51.000000000 +0000
> +++ zinf/io/src/pmo.cpp 2003-07-31 23:29:02.000000000 +0000
> @@ -30,6 +30,7 @@
> #include <string.h>
> #include <time.h>
> #include <assert.h>
> +#include <stdarg.h>
>
> /* project headers */
> using namespace std;
> @@ -245,3 +246,18 @@
> }
> }
> }
> +
> +void PhysicalMediaOutput::ReportError(const char * format, ...)
> +{
> + assert(m_pTarget);
> +
> + char szBuffer[4096];
> + va_list argptr;
> +
> + va_start(argptr, format);
> + vsprintf(szBuffer, format, argptr);
> + va_end(argptr);
> +
> + m_pTarget->AcceptEvent(new ErrorMessageEvent(szBuffer));
> + m_pTarget->AcceptEvent(new Event(INFO_DoneOutputtingDueToOutputError))
> ;
> +}
>
> 4. The main window no longer remembers its last location
>
> diff -u -r zinfunpatched/ui/zinf/src/ZinfTheme.cpp
> zinf/ui/zinf/src/ZinfTheme.cpp
> --- zinfunpatched/ui/zinf/src/ZinfTheme.cpp 2003-05-18 20:56:17.000000000
> +0000
> +++ zinf/ui/zinf/src/ZinfTheme.cpp 2003-07-31 23:47:29.000000000 +0000
> @@ -44,6 +44,7 @@
> #define STRICT
> #endif
> #include <string>
> +#include <sstream>
>
> using namespace std;
> #include "path_max.h"
> @@ -220,9 +221,9 @@
>
> eRet = Theme::Run(m_oWindowPos);
> if (!IsError(eRet)){
> - szTemp = m_oWindowPos.x;
> - szTemp += ",";
> - szTemp += m_oWindowPos.y;
> + ostringstream ssTemp;
> + ssTemp << m_oWindowPos.x << "," << m_oWindowPos.y;
> + szTemp = ssTemp.str();
> m_pContext->prefs->SetPrefString(kMainWindowPosPref, szTemp);
> m_pContext->prefs->SetPrefString(kWindowModePref, m_oCurrentWindow)
> ;
> } else
>
> 5. The change info displayed keyboard shortcut dosn't update the display
> until the next track, and you get an extra "-" displayed if you have track,
> artist, album displayed
>
> diff -u -r zinfunpatched/ui/zinf/include/ZinfTheme.h
> zinf/ui/zinf/include/ZinfTheme.h
> --- zinfunpatched/ui/zinf/include/ZinfTheme.h 2003-05-18 20:56:17.000000000
> +0000
> +++ zinf/ui/zinf/include/ZinfTheme.h 2003-08-01 00:23:16.000000000 +0000
> @@ -127,6 +127,7 @@
> void SetVolume(int iVolume, int iBalance);
> void UpdateTimeDisplay(int iCurrentTime);
> void UpdateMetaData(const PlaylistItem *pItem);
> + void UpdateTitleDisplay(void);
> void UpdateThread();
> void OptionsThread(uint32_t defaultPage);
>
> diff -u -r zinfunpatched/ui/zinf/src/ZinfTheme.cpp
> zinf/ui/zinf/src/ZinfTheme.cpp
> --- zinfunpatched/ui/zinf/src/ZinfTheme.cpp 2003-05-18 20:56:17.000000000
> +0000
> +++ zinf/ui/zinf/src/ZinfTheme.cpp 2003-08-01 00:23:16.000000000 +0000
> @@ -1497,6 +1497,7 @@
> break;
> }
> m_pWindow->ControlStringValue("Info", true, oText);
> + UpdateTitleDisplay();
> break;
> }
> case 'h':
> @@ -1662,25 +1663,7 @@
> {
> bool bEnable;
>
> - if (pItem->GetMetaData().Title().length() > 0 ||
> - pItem->GetMetaData().Artist().length() > 0 ||
> - pItem->GetMetaData().Album().length() > 0){
> - string oText;
> - m_oTitle = pItem->GetMetaData().Title();
> - if (pItem->GetMetaData().Artist().length() > 0 &&
> - (m_eTitleDisplayState == kNameArtist ||
> - m_eTitleDisplayState == kNameArtistAlbum))
> - m_oTitle += string(" - ") + pItem->GetMetaData().Artist();
>
> - if (pItem->GetMetaData().Album().length() > 0 &&
> - m_eTitleDisplayState == kNameArtistAlbum)
> - m_oTitle += string(" - ") + pItem->GetMetaData().Album() +
> - string(" - ");
> -
> - oText = string(BRANDING": ") + m_oTitle;
> - m_pWindow->SetTitle(oText);
> - } else
> - m_oTitle = "";
> if (pItem->GetMetaData().Title().length() > 0){
> m_oTrackName = pItem->GetMetaData().Title();
> } else
> @@ -1724,7 +1707,7 @@
> m_oFileName = pItem->URL();
> }
> m_pWindow->ControlEnable("BitziLookup", true, bEnable);
> - m_pWindow->ControlStringValue("Title", true, m_oTitle);
> + UpdateTitleDisplay();
> m_pWindow->ControlStringValue("TrackName", true, m_oTrackName);
> m_pWindow->ControlStringValue("TrackNo", true, m_oTrackNo);
> m_pWindow->ControlStringValue("Artist", true, m_oArtist);
> @@ -1905,3 +1888,22 @@
> delete pWindow;
> m_bInOptions = false;
> }
> +
> +void ZinfTheme::UpdateTitleDisplay(void)
> +{
> + string oText;
> +
> + m_oTitle = m_oTrackName;
> + if (m_oArtist != "Unknown" &&
> + (m_eTitleDisplayState == kNameArtist ||
> + m_eTitleDisplayState == kNameArtistAlbum))
> + m_oTitle += string(" - ") + m_oArtist;
> +
> + if (m_oAlbum != "Unknown" &&
> + m_eTitleDisplayState == kNameArtistAlbum)
> + m_oTitle += string(" - ") + m_oAlbum;
> +
> + oText = string(BRANDING": ") + m_oTitle;
> + m_pWindow->SetTitle(oText);
> + m_pWindow->ControlStringValue("Title",true,m_oTitle);
> +}
>
>
> Thats all the fixes i've completed, i'm working on a couple of other more
> complex changes like changing the keyboard shortcuts to make them similar
> to xmms/winamp, so i can actually remember them (i've got it working under
> linux, haven't attempted to fix it to work in windows as well though). I'm
> also working on adding a feature to stop at the end of the track, like the
> repeat one mode, but play one mode as well. If anyone is interested in them
> feel free to email me
>
> David Hough
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
> _______________________________________________
> Zinf-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/zinf-devel
--
email:[email protected] office:(805)893-4276 http://www.cs.ucsb.edu/~kris
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01