MPC-HC 1.7.8 arrow mouse pointer version
MPC-HC (Media Player Classic Home Cinema) has an annoying problem that confused me for years. So I used the old Media Player Classic 6.4 which was released in 2006 all the time.

But now, due to the 64-bit version of Win 7 and Win 8.1 operating system, it's time to replace the old media player.

Referring to a bug reported on MPC-HC's website, I searched through the source code of MPC-HC and made some modifications. Eventually, all the 4 places need to modify was fixed to the default style of old MPC 6.4.

Below is the mouse pointer assigment from original version:



Below is the modified version, same to MPC 6.4:



Modified version's about dialog (1.7.8-arrow):



Download the modified version:

Dropbox: MPC-HC.1.7.8-arrow.x86.zip (32-bit)
Dropbox: MPC-HC.1.7.8-arrow.x64.zip (64-bit)

Sina Vdisk: MPC-HC.1.7.8-arrow.x86.zip (32-bit)
Sina Vdisk: MPC-HC.1.7.8-arrow.x64.zip (64-bit)

Below is the contents of diff file:

  1. deab46f52abe74b76317dadb7db5d8db3d7b1248
  2.  src/mpc-hc/MouseTouch.cpp    | 2 +-
  3.  src/mpc-hc/PlayerSeekBar.cpp | 2 +-
  4.  src/mpc-hc/PlayerToolBar.cpp | 2 +-
  5.  src/mpc-hc/VolumeCtrl.cpp    | 2 +-
  6.  4 files changed, 4 insertions(+), 4 deletions(-)
  7.  
  8. diff --git a/src/mpc-hc/MouseTouch.cpp b/src/mpc-hc/MouseTouch.cpp
  9. index 0162ec5..9fd0b93 100644
  10. --- a/src/mpc-hc/MouseTouch.cpp
  11. +++ b/src/mpc-hc/MouseTouch.cpp
  12. @@ -433,7 +433,7 @@ bool CMouse::SelectCursor(const CPoint& screenPoint, const CPoint& clientPoint,
  13.      }
  14.  
  15.      if (!bHidden || bHiddenAndMoved || !bCanHide) {
  16. -        m_cursor = Cursor::ARROW;
  17. +        m_cursor = Cursor::HAND;
  18.          if (bCanHide) {
  19.              if (!m_bMouseHiderStarted || screenPoint != m_mouseHiderStartScreenPoint) {
  20.                  StartMouseHider(screenPoint);
  21. diff --git a/src/mpc-hc/PlayerSeekBar.cpp b/src/mpc-hc/PlayerSeekBar.cpp
  22. index 9a57246..86ac612 100644
  23. --- a/src/mpc-hc/PlayerSeekBar.cpp
  24. +++ b/src/mpc-hc/PlayerSeekBar.cpp
  25. @@ -39,7 +39,7 @@ CPlayerSeekBar::CPlayerSeekBar(CMainFrame* pMainFrame)
  26.      , m_bHasDuration(false)
  27.      , m_rtHoverPos(0)
  28.      , m_bHovered(false)
  29. -    , m_cursor(AfxGetApp()->LoadStandardCursor(IDC_HAND))
  30. +    , m_cursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW))
  31.      , m_bDraggingThumb(false)
  32.      , m_tooltipState(TOOLTIP_HIDDEN)
  33.      , m_bIgnoreLastTooltipPoint(true)
  34. diff --git a/src/mpc-hc/PlayerToolBar.cpp b/src/mpc-hc/PlayerToolBar.cpp
  35. index 9dfa476..586049b 100644
  36. --- a/src/mpc-hc/PlayerToolBar.cpp
  37. +++ b/src/mpc-hc/PlayerToolBar.cpp
  38. @@ -332,7 +332,7 @@ BOOL CPlayerToolBar::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
  39.  
  40.          int i = getHitButtonIdx(point);
  41.          if (i >= 0 && !(GetButtonStyle(i) & (TBBS_SEPARATOR | TBBS_DISABLED))) {
  42. -            ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_HAND));
  43. +            ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
  44.              ret = TRUE;
  45.          }
  46.      }
  47. diff --git a/src/mpc-hc/VolumeCtrl.cpp b/src/mpc-hc/VolumeCtrl.cpp
  48. index bd41188..592f4c8 100644
  49. --- a/src/mpc-hc/VolumeCtrl.cpp
  50. +++ b/src/mpc-hc/VolumeCtrl.cpp
  51. @@ -194,7 +194,7 @@ void CVolumeCtrl::HScroll(UINT nSBCode, UINT nPos)
  52.  
  53.  BOOL CVolumeCtrl::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
  54.  {
  55. -    ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_HAND));
  56. +    ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
  57.      return TRUE;
  58.  }
Current language: English · 其他语言: 中文 (简体)
Gender Guesser v0.10.0 has been released
Download from PHP Classes:
http://www.phpclasses.org/package/2701-PHP-Guess-the-gender-of-Chinese-names.html

Changelog:
  • Removed getOffset(), getTendencyByOffset() and getTendency() methods
  • Added getMaleProbability() method by which to get the calculated probability
  • Replaced getLexiconName() method by getLexiconComment()
  • The default lexicon came from 17 million name-gender records (20 thousand records in previous version).
  • The default lexicon has two versions, full and essential, containing different number of characters.

Demo:
http://demo.wudilabs.org/lab/gender_guesser/

PPT Download:
http://blog.wudilabs.org/uploads/gender_guesser_ppt_by_wudi.pdf
Current language: English · 其他语言: 中文 (简体)
Pushed a few local Git repositories to GitHub
https://github.com/wudicgi?tab=repositories
Current language: English · 其他语言: 中文 (简体)
Gender Guesser v0.05.0 has been released
Download from PHP Classes:
http://www.phpclasses.org/package/2701-PHP-Guess-the-gender-of-Chinese-names.html

Changelog:
  • Supports PHP 5 environment only, and the mbstring extension need to be enabled.
  • Lexicon data stores in PHP serialization format now.
  • The default lexicon came from 20,933 name-gender records (5,561 records in previous version).
  • The default lexicon contains characters of both Simplified Chinese and Tranditional Chinese.

Demo:
http://demo.wudilabs.org/lab/gender_guesser/
Current language: English · 其他语言: 中文 (简体)
Algorithm for finding nearby places - Geohash
Geohash is a well-known algorithm for searching nearby places. Today, on the regular meeting of laboratory, I talked about the idea and C implementation of this algorithm. Now, I shared the slideshow here for reference.

Download: http://blog.wudilabs.org/uploads/geohash_ppt_by_wudi.pdf (Chinese)





If you have looked at it, you may found there is an C implementation for geohash. Now, the basic functions of this library have been completed. After I clean it up, I will publish it together with a NMEA parser library which do not use malloc dynamic memory allocation.
Current language: English · 其他语言: 中文 (简体)
Getting the audio waveform data of media file using ffmpeg.exe in C#
Previously, I use the NAudio library to implement this function. It needs to extract the audio track of a media file to a separate WAV file to deal with. Even with the help of RAM disk, the processing speed is still very slow.

Yesterday, I searched again for the usable audio processing library in C#. But there is still no better choice. Finally, the popular cross-platform command line tools mencoder, ffmpeg and so on came into my head. The ffmpeg seems to work because it support stdout output.

At first, I tried to output the binary stream in WAV format to stdout. But I found that in this situation, ffmpeg will write a placeholder for size information in head, and seek back to rewrite it after the whole stream is outputed (source). When the output target is the stdout stream instead of a file, this rewriting operation will fail, which causes the obtained WAV stream to have wrong head information and cannot be used.

The reason that I use WAV format is just because it is the most familiar audio format that storing raw waveform data. But after read the documentation of ffmpeg, I found that it supports a great many formats. It can output integers or floats directly, without head information. At last I selected the little endian 32-bit float format.

The complete code is as follows:

  1. using System.Diagnostics;
  2. using System.IO;
  3.  
  4. // ...
  5.  
  6. static void Main(string[] args)
  7. {
  8.     // ...
  9.     string path = @"E:\Media\test.mp4";
  10.  
  11.     Process proc = new Process();
  12.     proc.StartInfo.FileName = @"E:\ffmpeg\ffmpeg.exe";
  13.     proc.StartInfo.Arguments = "-i \"" + path + "\" -vn -ar 44100 -ac 1 -f f32le -";
  14.     proc.StartInfo.CreateNoWindow = true;
  15.     proc.StartInfo.UseShellExecute = false;
  16.     proc.StartInfo.RedirectStandardOutput = true;
  17.     proc.StartInfo.RedirectStandardError = true;
  18.     proc.ErrorDataReceived += new DataReceivedEventHandler(proc_ErrorDataReceived);
  19.     proc.Start();
  20.     proc.BeginErrorReadLine();
  21.     ProcessStream(proc.StandardOutput.BaseStream);
  22.  
  23.     proc.WaitForExit(10000); // 10s
  24.     if (!proc.HasExited)
  25.     {
  26.         proc.Kill();
  27.         Environment.Exit(1);
  28.     }
  29.     // ...
  30. }
  31.  
  32. static void proc_ErrorDataReceived(object sender, DataReceivedEventArgs e)
  33. {
  34.     if (e.Data != null)
  35.     {
  36.         // Console.WriteLine(e.Data);
  37.         // do nothing
  38.     }
  39. }
  40.  
  41. static void ProcessStream(Stream stream)
  42. {
  43.     int didread;
  44.     int offset = 0;
  45.     byte[] buffer = new byte[sizeof(Single) * (1024 + 1)];
  46.  
  47.     int length, residual_length;
  48.  
  49.     while ((didread = stream.Read(buffer, offset, sizeof(Single) * 1024)) != 0)
  50.     {
  51.         length = offset + didread;
  52.         residual_length = length % sizeof(Single);
  53.  
  54.         if (residual_length == 0) {
  55.             ProcessBuffer(buffer, length);
  56.             offset = 0;
  57.         } else {
  58.             length -= residual_length;
  59.             ProcessBuffer(buffer, length);
  60.             Array.Copy(buffer, length, buffer, 0, residual_length);
  61.             offset = residual_length;
  62.         }
  63.     }
  64. }
  65.  
  66. static void ProcessBuffer(byte[] buffer, int length)
  67. {
  68.     int index = 0;
  69.     float sample_value;
  70.  
  71.     while (index < length)
  72.     {
  73.         sample_value = BitConverter.ToSingle(buffer, index);
  74.         index += sizeof(Single);
  75.         // to deal with sample_value
  76.     }
  77. }
  78.  
  79. // ...
Current language: English · 其他语言: 中文 (简体)
More entries: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] ... [25]
« Previous page · Next page »