diff options
author | Casimir666 <casimir666@users.sourceforge.net> | 2009-12-05 11:27:07 +0300 |
---|---|---|
committer | Casimir666 <casimir666@users.sourceforge.net> | 2009-12-05 11:27:07 +0300 |
commit | 124f69849a8a917deea6543eeae21f6464d15a7f (patch) | |
tree | 6182d0571cf19fa0719244cf0eedf37963993478 /src/subtitles/DVBSub.cpp | |
parent | 7ee261016254b880b83f50488392d07cf3739f17 (diff) |
Added : BDA capture card support (experimental)
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1383 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/subtitles/DVBSub.cpp')
-rw-r--r-- | src/subtitles/DVBSub.cpp | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/src/subtitles/DVBSub.cpp b/src/subtitles/DVBSub.cpp index 79f77c066..ff0b1123a 100644 --- a/src/subtitles/DVBSub.cpp +++ b/src/subtitles/DVBSub.cpp @@ -164,56 +164,58 @@ HRESULT CDVBSub::ParseSample (IMediaSample* pSample) if(FAILED(hr) || pData == NULL) return hr;
nSize = pSample->GetActualDataLength();
- //if (*((LONG*)pData) == 0xBD010000)
- //{
- // CGolombBuffer gb (pData, nSize);
-
- // gb.SkipBytes(4);
- // WORD wLength = (WORD)gb.BitRead(16);
- //
- // if (gb.BitRead(2) != 2) return E_FAIL; // type
-
- // gb.BitRead(2); // scrambling
- // gb.BitRead(1); // priority
- // gb.BitRead(1); // alignment
- // gb.BitRead(1); // copyright
- // gb.BitRead(1); // original
- // BYTE fpts = (BYTE)gb.BitRead(1); // fpts
- // BYTE fdts = (BYTE)gb.BitRead(1); // fdts
- // gb.BitRead(1); // escr
- // gb.BitRead(1); // esrate
- // gb.BitRead(1); // dsmtrickmode
- // gb.BitRead(1); // morecopyright
- // gb.BitRead(1); // crc
- // gb.BitRead(1); // extension
- // gb.BitRead(8); // hdrlen
-
- // if(fpts)
- // {
- // BYTE b = (BYTE)gb.BitRead(4);
- // if(!(fdts && b == 3 || !fdts && b == 2)) {ASSERT(0); return(E_FAIL);}
-
- // REFERENCE_TIME pts = 0;
- // pts |= gb.BitRead(3) << 30; MARKER; // 32..30
- // pts |= gb.BitRead(15) << 15; MARKER; // 29..15
- // pts |= gb.BitRead(15); MARKER; // 14..0
- // pts = 10000*pts/90;
-
- // m_rtStart = pts;
- // m_rtStop = pts+1;
- // }
- // else
- // {
- // m_rtStart = INVALID_TIME;
- // m_rtStop = INVALID_TIME;
- // }
-
- // nSize -= 14;
- // pData += 14;
- //}
- //else
- pSample->GetTime(&m_rtStart, &m_rtStop);
+ if (*((LONG*)pData) == 0xBD010000)
+ {
+ CGolombBuffer gb (pData, nSize);
+
+ gb.SkipBytes(4);
+ WORD wLength = (WORD)gb.BitRead(16);
+
+ if (gb.BitRead(2) != 2) return E_FAIL; // type
+
+ gb.BitRead(2); // scrambling
+ gb.BitRead(1); // priority
+ gb.BitRead(1); // alignment
+ gb.BitRead(1); // copyright
+ gb.BitRead(1); // original
+ BYTE fpts = (BYTE)gb.BitRead(1); // fpts
+ BYTE fdts = (BYTE)gb.BitRead(1); // fdts
+ gb.BitRead(1); // escr
+ gb.BitRead(1); // esrate
+ gb.BitRead(1); // dsmtrickmode
+ gb.BitRead(1); // morecopyright
+ gb.BitRead(1); // crc
+ gb.BitRead(1); // extension
+ gb.BitRead(8); // hdrlen
+
+ if(fpts)
+ {
+ BYTE b = (BYTE)gb.BitRead(4);
+ if(!(fdts && b == 3 || !fdts && b == 2)) {ASSERT(0); return(E_FAIL);}
+
+ REFERENCE_TIME pts = 0;
+ pts |= gb.BitRead(3) << 30; MARKER; // 32..30
+ pts |= gb.BitRead(15) << 15; MARKER; // 29..15
+ pts |= gb.BitRead(15); MARKER; // 14..0
+ pts = 10000*pts/90;
+ m_rtStart = pts;
+ m_rtStop = pts+1;
+ }
+ else
+ {
+ m_rtStart = INVALID_TIME;
+ m_rtStop = INVALID_TIME;
+ }
+
+ nSize -= 14;
+ pData += 14;
+ pSample->GetTime(&m_rtStart, &m_rtStop);
+ pSample->GetMediaTime(&m_rtStart, &m_rtStop);
+ }
+ else
+ if (SUCCEEDED (pSample->GetTime(&m_rtStart, &m_rtStop)))
+ pSample->SetTime(&m_rtStart, &m_rtStop);
//FILE* hFile = fopen ("D:\\Sources\\mpc-hc\\A garder\\TestSubRip\\dvbsub.dat", "ab");
//if(hFile != NULL)
|