How to caculate the OGG encoding complete percent correctly?
Hi, gentalmen:
I am not sure where to post my question, may I post it here?
I am wondering how to caculate the OGG encoding complete percent.
Looked into the source of OggMuxFilter.h. [http://www.xiph.org/dshow/uploads/docs/OggMuxFilter_8h-source.html] It implements the IOggMuxProgress and IMediaSeeking interface.
The IOggMuxProgress exposes two methods to retrieve the bytes written and the progress time.
The IMediaSeeking exposes the methods to retrieve the current position. In the header file, it says:
00135 //IMediaSeeking Override to give progress. - This is unreliable !!
00136 virtual STDMETHODIMP GetPositions(LONGLONG *pCurrent, LONGLONG *pStop);
00137 virtual STDMETHODIMP GetCurrentPosition(LONGLONG *pCurrent);
Upon my test, they are always unreliable. the getRate() method always return 1.0 and the position is always far far smaller than the truth.
After looked into the OggMuxFilter.cpp, the IOggMuxProgress and IMediaSeeking both use the mInterleaver->progressTime() to do progress caculation.
00417 STDMETHODIMP OggMuxFilter::GetPositions(LONGLONG *pCurrent, LONGLONG *pStop) {
00418 HRESULT locHR = BasicSeekPassThrough::GetPositions(pCurrent, pStop);
00419 debugLog<<"GetPos Before : "<<*pCurrent<<" - "<<*pStop<<endl;
00420 *pCurrent = mInterleaver->progressTime();
00421 debugLog<<"GetPos After : "<<*pCurrent<<" - "<<*pStop<<endl;
00422 return locHR;
00423 }
00112 STDMETHODIMP_(LONGLONG) OggMuxFilter::getProgressTime()
00113 {
00114 if (mInterleaver != NULL) {
00115 return mInterleaver->progressTime();
00116 } else {
00117 return -1;
00118 }
00119
00120 }
I can not get the correct complete percent by IOggMuxProgress or IMediaSeeking.
How to get the correct OGG encoding complete percent?
-
Any other interface I can use to do this stuff?
-
How to estimate the whole output file size? If I can know the final output ogg file size, I can get the percent by IOggMuxProgress::getBytesWritten