/[tivodecode]/tivocom/trunk/CTivoChunk.cpp
ViewVC logotype

Diff of /tivocom/trunk/CTivoChunk.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 253 by jeremyd2019, Wed Aug 15 06:53:07 2007 UTC revision 254 by jeremyd2019, Sun Sep 9 23:26:20 2007 UTC
# Line 4  Line 4 
4  #include "CTivoChunk.h"  #include "CTivoChunk.h"
5    
6  extern "C" {  extern "C" {
7  int fread_wrapper (void* mem, int size, void* fh);  int stream_read_wrapper(void* mem, int size, void* fh);
8  }  }
9    
10  // CTivoChunk  // CTivoChunk
11    
12  STDMETHODIMP CTivoChunk::Init(const std::string & mak, ITivoChunk *chunk0, FILE* fh)  STDMETHODIMP CTivoChunk::Init(const std::string & mak, ITivoChunk *chunk0, IStream* pStm, ULARGE_INTEGER* pChunkPos)
13  {  {
14          m_chunkstart = ftell(fh);          m_chunkstart = *pChunkPos;
15          m_chunk = read_tivo_chunk(fh, fread_wrapper);          m_chunk = read_tivo_chunk(pStm, stream_read_wrapper);
16          if  (!m_chunk)          if  (!m_chunk)
17                  return E_FAIL;                  return E_FAIL;
18          if (m_chunk->type != TIVO_CHUNK_XML)          if (m_chunk->type != TIVO_CHUNK_XML)
# Line 20  STDMETHODIMP CTivoChunk::Init(const std::string & mak, Line 20  STDMETHODIMP CTivoChunk::Init(const std::string & mak,
20    
21          m_mak = mak;          m_mak = mak;
22    
23            pChunkPos->QuadPart += m_chunk->chunk_size;
24    
25          return S_OK;          return S_OK;
26  }  }
27    
# Line 76  STDMETHODIMP CTivoChunk::get_data(BSTR* pVal) Line 78  STDMETHODIMP CTivoChunk::get_data(BSTR* pVal)
78                  turing_state metaturing = {0};                  turing_state metaturing = {0};
79                  setup_metadata_key (&metaturing, dynamic_cast<CTivoChunk*> (m_chunk0.p)->m_chunk, const_cast<char*>(m_mak.c_str()));                  setup_metadata_key (&metaturing, dynamic_cast<CTivoChunk*> (m_chunk0.p)->m_chunk, const_cast<char*>(m_mak.c_str()));
80                  prepare_frame(&metaturing, 0, 0);                  prepare_frame(&metaturing, 0, 0);
81                  skip_turing_data(&metaturing, m_chunkstart + SIZEOF_STREAM_CHUNK);                  skip_turing_data(&metaturing, m_chunkstart.QuadPart + SIZEOF_STREAM_CHUNK);
82                  decrypt_buffer(&metaturing, m_chunk->data, m_chunk->data_size);                  decrypt_buffer(&metaturing, m_chunk->data, m_chunk->data_size);
83                  destruct_turing(&metaturing);                  destruct_turing(&metaturing);
84    

Legend:
Removed from v.253  
changed lines
  Added in v.254

cvs@jdrake.com
ViewVC Help
Powered by ViewVC 1.1.13