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

Contents of /tivocom/trunk/CTivoChunk.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 254 - (show annotations) (download)
Sun Sep 9 23:26:20 2007 UTC (14 years, 4 months ago) by jeremyd2019
File MIME type: text/plain
File size: 1812 byte(s)
rework interfaces (bumped typelib version to 1.1).  Add support for decoding the MPEG stream.  Added support to read and write from streams (implementing IStream) and make the versions which take filenames use a stream implementation that wraps file access.  Make OpenTivoFile take the MAK as a parameter.  It has a default value of "" (empty string), which means try to get the MAK from the registry, so either omit that param (for those languages which permit that) or specify it as empty string to use the MAK from the registry.  Added progress reporting of MPEG stream decoding via a connection point.  Progress is updated every 100 frames, and percent complete is provided if the tivo file stream supports Seek and Stat functions

1 // CTivoChunk.h : Declaration of the CTivoChunk
2
3 #pragma once
4 #include "resource.h" // main symbols
5
6 #include "tivocom.h"
7
8
9 #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
10 #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
11 #endif
12
13 // CTivoChunk
14
15 class ATL_NO_VTABLE CTivoChunk :
16 public CComObjectRootEx<CComSingleThreadModel>,
17 // public CComCoClass<CTivoChunk, &CLSID_TivoChunk>,
18 public IDispatchImpl<ITivoChunk, &IID_ITivoChunk, &LIBID_tivocomLib, /*wMajor =*/ 1, /*wMinor =*/ 1>
19 {
20 friend class CTivoFile;
21 tivo_stream_chunk* m_chunk;
22 ULARGE_INTEGER m_chunkstart;
23 CComPtr<ITivoChunk> m_chunk0;
24 std::string m_mak;
25 bool m_decrypted;
26 public:
27 CTivoChunk()
28 : m_chunk (NULL)
29 , m_decrypted (false)
30 {
31 }
32
33
34 BEGIN_COM_MAP(CTivoChunk)
35 COM_INTERFACE_ENTRY(ITivoChunk)
36 COM_INTERFACE_ENTRY(IDispatch)
37 END_COM_MAP()
38
39
40
41 DECLARE_PROTECT_FINAL_CONSTRUCT()
42
43 HRESULT FinalConstruct()
44 {
45 return S_OK;
46 }
47
48 void FinalRelease()
49 {
50 if (m_chunk)
51 free(m_chunk);
52 }
53
54 STDMETHOD(Init)(const std::string & mak, ITivoChunk* chunk0, IStream* pStm, ULARGE_INTEGER* pChunkPos);
55
56 public:
57
58 STDMETHOD(get_chunk_size)(UINT* pVal);
59 STDMETHOD(get_data_size)(UINT* pVal);
60 STDMETHOD(get_chunk_id)(USHORT* pVal);
61 STDMETHOD(get_chunk_type)(USHORT* pVal);
62 STDMETHOD(get_data)(BSTR* pVal);
63 };
64
65 //OBJECT_ENTRY_AUTO(__uuidof(TivoChunk), CTivoChunk)

cvs@jdrake.com
ViewVC Help
Powered by ViewVC 1.1.13