FFMS2: Various fixes to haali stuff
Originally committed to SVN as r2837.
This commit is contained in:
parent
ff7ee2e776
commit
e42ae2d19d
6 changed files with 37 additions and 22 deletions
|
@ -185,14 +185,6 @@ FFMS_API(int) FFMS_FindClosestKeyFrame(FrameInfoVector *FIV, int Frame, char *Er
|
|||
}
|
||||
}
|
||||
|
||||
FFMS_API(int) FFMS_FrameFromDTS(FrameInfoVector *FIV, int64_t DTS) {
|
||||
return FIV->FrameFromDTS(DTS);
|
||||
}
|
||||
|
||||
FFMS_API(int) FFMS_ClosestFrameFromDTS(FrameInfoVector *FIV, int64_t DTS) {
|
||||
return FIV->ClosestFrameFromDTS(DTS);
|
||||
}
|
||||
|
||||
FFMS_API(const TrackTimeBase *) FFMS_GetTimeBase(FrameInfoVector *FIV) {
|
||||
return &FIV->TB;
|
||||
}
|
||||
|
|
|
@ -142,8 +142,6 @@ FFMS_API(FrameInfoVector *) FFMS_GetTITrackIndex(FrameIndex *TrackIndices, int T
|
|||
FFMS_API(FrameInfoVector *) FFMS_GetVSTrackIndex(VideoBase *VB);
|
||||
FFMS_API(FrameInfoVector *) FFMS_GetASTrackIndex(AudioBase *AB);
|
||||
FFMS_API(int) FFMS_FindClosestKeyFrame(FrameInfoVector *FIV, int Frame, char *ErrorMsg, unsigned MsgSize);
|
||||
FFMS_API(int) FFMS_FrameFromDTS(FrameInfoVector *FIV, int64_t DTS);
|
||||
FFMS_API(int) FFMS_ClosestFrameFromDTS(FrameInfoVector *FIV, int64_t DTS);
|
||||
FFMS_API(const TrackTimeBase *) FFMS_GetTimeBase(FrameInfoVector *FIV);
|
||||
FFMS_API(int) FFMS_WriteTimecodes(FrameInfoVector *FIV, const char *TimecodeFile, char *ErrorMsg, unsigned MsgSize);
|
||||
FFMS_API(FrameIndex *) FFMS_MakeIndex(const char *SourceFile, int IndexMask, int DumpMask, const char *AudioFile, bool IgnoreDecodeErrors, IndexCallback IP, void *Private, char *ErrorMsg, unsigned MsgSize);
|
||||
|
|
|
@ -233,6 +233,13 @@ Note that --enable-w32threads is required for multithreaded decoding to work.
|
|||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
<li>2.00 beta 7<ul>
|
||||
<li>Fixed the accessing of codecprivate data with Haali's splitters</li>
|
||||
<li>Timecode output should be fixed to include decimals AND not be in scientific format</li>
|
||||
<li>Fixed a memory leak when using Haali's splitters</li>
|
||||
<li>Updated FFmpeg to rev X</li>
|
||||
</ul></li>
|
||||
|
||||
<li>2.00 beta 6<ul>
|
||||
<li>Haali's splitters have been improved for video and now have audio dumping during indexing implemented</li>
|
||||
<li>SeekMode=1 has improved logic which will make it go back and decode more frames if necessary to figure out where it is, in theory SeekMode=0 should now be mostly obsolete</li>
|
||||
|
|
|
@ -591,10 +591,32 @@ AVFrameLite *MatroskaVideoSource::GetFrame(int n, char *ErrorMsg, unsigned MsgSi
|
|||
|
||||
#ifdef HAALISOURCE
|
||||
|
||||
static unsigned vtSize(VARIANT &vt) {
|
||||
if (V_VT(&vt) != (VT_ARRAY | VT_UI1))
|
||||
return 0;
|
||||
long lb,ub;
|
||||
if (FAILED(SafeArrayGetLBound(V_ARRAY(&vt),1,&lb)) ||
|
||||
FAILED(SafeArrayGetUBound(V_ARRAY(&vt),1,&ub)))
|
||||
return 0;
|
||||
return ub - lb + 1;
|
||||
}
|
||||
|
||||
static void vtCopy(VARIANT& vt,void *dest) {
|
||||
unsigned sz = vtSize(vt);
|
||||
if (sz > 0) {
|
||||
void *vp;
|
||||
if (SUCCEEDED(SafeArrayAccessData(V_ARRAY(&vt),&vp))) {
|
||||
memcpy(dest,vp,sz);
|
||||
SafeArrayUnaccessData(V_ARRAY(&vt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HaaliVideoSource::Free(bool CloseCodec) {
|
||||
if (CloseCodec)
|
||||
avcodec_close(CodecContext);
|
||||
av_free(CodecContext);
|
||||
free(CodecPrivate);
|
||||
}
|
||||
|
||||
HaaliVideoSource::HaaliVideoSource(const char *SourceFile, int Track,
|
||||
|
@ -648,7 +670,7 @@ HaaliVideoSource::HaaliVideoSource(const char *SourceFile, int Track,
|
|||
}
|
||||
|
||||
BSTR CodecID = NULL;
|
||||
uint8_t * CodecPrivate = NULL;
|
||||
CodecPrivate = NULL;
|
||||
int CodecPrivateSize = 0;
|
||||
int CurrentTrack = 0;
|
||||
CComPtr<IEnumUnknown> pEU;
|
||||
|
@ -660,16 +682,15 @@ HaaliVideoSource::HaaliVideoSource(const char *SourceFile, int Track,
|
|||
pBag = pU;
|
||||
|
||||
if (pBag) {
|
||||
VARIANT pV;
|
||||
CComVariant pV;
|
||||
|
||||
pV.vt = VT_EMPTY;
|
||||
if (pBag->Read(L"CodecID", &pV, NULL) == S_OK)
|
||||
CodecID = pV.bstrVal;
|
||||
|
||||
pV.vt = VT_EMPTY;
|
||||
if (pBag->Read(L"CodecPrivate", &pV, NULL) == S_OK) {
|
||||
CodecPrivate = (uint8_t *)pV.parray->pvData;
|
||||
CodecPrivateSize = pV.parray->cbElements;
|
||||
CodecPrivateSize = vtSize(pV);
|
||||
CodecPrivate = static_cast<uint8_t*>(malloc(CodecPrivateSize));
|
||||
vtCopy(pV, CodecPrivate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -737,7 +758,7 @@ HaaliVideoSource::HaaliVideoSource(const char *SourceFile, int Track,
|
|||
LastFrameNum = 0;
|
||||
|
||||
// Set AR variables
|
||||
VARIANT pV;
|
||||
CComVariant pV;
|
||||
if (pBag->Read(L"Video.DisplayWidth", &pV, NULL) == S_OK)
|
||||
VP.SARNum = pV.uiVal;
|
||||
if (pBag->Read(L"Video.DisplayHeight", &pV, NULL) == S_OK)
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
class HaaliVideoSource : public VideoBase {
|
||||
private:
|
||||
CComPtr<IMMContainer> pMMC;
|
||||
|
||||
uint8_t * CodecPrivate;
|
||||
void Free(bool CloseCodec);
|
||||
int DecodeNextFrame(AVFrame *AFrame, int64_t *AFirstStartTime, char *ErrorMsg, unsigned MsgSize);
|
||||
public:
|
||||
|
|
|
@ -275,17 +275,14 @@ static FrameIndex *MakeHaaliIndex(const char *SourceFile, int IndexMask, int Dum
|
|||
int CodecPrivateSize = 0;
|
||||
|
||||
if (pBag) {
|
||||
VARIANT pV;
|
||||
CComVariant pV;
|
||||
|
||||
pV.vt = VT_EMPTY;
|
||||
if (pBag->Read(L"CodecID", &pV, NULL) == S_OK)
|
||||
CodecID = pV.bstrVal;
|
||||
|
||||
pV.vt = VT_EMPTY;
|
||||
if (pBag->Read(L"Type", &pV, NULL) == S_OK)
|
||||
TrackTypes[CurrentTrack] = pV.uintVal;
|
||||
|
||||
pV.vt = VT_EMPTY;
|
||||
if (pBag->Read(L"CodecPrivate", &pV, NULL) == S_OK) {
|
||||
CodecPrivate = (uint8_t *)pV.parray->pvData;
|
||||
CodecPrivateSize = pV.parray->cbElements;
|
||||
|
|
Loading…
Reference in a new issue