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

Contents of /tivocom/trunk/CTivoFile.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: 2795 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 // CTivoFile.h : Declaration of the CTivoFile
2
3 #pragma once
4 #include "resource.h" // main symbols
5
6 #include "tivocom.h"
7 #include "DTivoFileEvents_CP.h"
8
9
10 #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
11 #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."
12 #endif
13
14
15
16 // CTivoFile
17
18 class ATL_NO_VTABLE CTivoFile :
19 public CComObjectRootEx<CComSingleThreadModel>,
20 public CComCoClass<CTivoFile, &CLSID_TivoFile>,
21 public IConnectionPointContainerImpl<CTivoFile>,
22 public CProxy_DTivoFileEvents<CTivoFile>,
23 public ISupportErrorInfoImpl<&IID_ITivoFile>,
24 public IProvideClassInfo2Impl<&CLSID_TivoFile, &DIID_DTivoFileEvents, &LIBID_tivocomLib, /*wMajor =*/ 1, /*wMinor =*/ 1>,
25 public IDispatchImpl<ITivoFile, &IID_ITivoFile, &LIBID_tivocomLib, /*wMajor =*/ 1, /*wMinor =*/ 1>
26 {
27 CComPtr<IStream> m_pStm;
28 std::string m_mak;
29 tivo_stream_header m_fileheader;
30 turing_state m_mpeg_turing;
31 bool m_mpeg_turing_inited;
32 ULARGE_INTEGER m_endoffileheader;
33 CComPtr<IChunkCollection> m_chunkcoll;
34 public:
35 CTivoFile()
36 : m_mpeg_turing_inited(false)
37 {
38 memset(&m_mpeg_turing, 0, sizeof(turing_state));
39 }
40
41 DECLARE_REGISTRY_RESOURCEID(IDR_TIVOFILE)
42
43
44 BEGIN_COM_MAP(CTivoFile)
45 COM_INTERFACE_ENTRY(ITivoFile)
46 COM_INTERFACE_ENTRY(IProvideClassInfo)
47 COM_INTERFACE_ENTRY(IProvideClassInfo2)
48 COM_INTERFACE_ENTRY(ISupportErrorInfo)
49 COM_INTERFACE_ENTRY(IDispatch)
50 COM_INTERFACE_ENTRY(IConnectionPointContainer)
51 END_COM_MAP()
52
53 BEGIN_CONNECTION_POINT_MAP(CTivoFile)
54 CONNECTION_POINT_ENTRY(__uuidof(DTivoFileEvents))
55 END_CONNECTION_POINT_MAP()
56
57
58 DECLARE_PROTECT_FINAL_CONSTRUCT()
59
60 HRESULT FinalConstruct()
61 {
62 return S_OK;
63 }
64
65 void FinalRelease();
66
67 STDMETHOD(Init)(BSTR mak, IStream* stream);
68 STDMETHOD(get_stream)(IStream** stream)
69 {
70 return m_pStm.CopyTo(stream);
71 }
72
73 public:
74
75 STDMETHOD(get_filename)(BSTR* pVal);
76 STDMETHOD(get_filetype)(BSTR* pVal);
77 STDMETHOD(get_dummy_4)(USHORT* pVal);
78 STDMETHOD(get_dummy_6)(USHORT* pVal);
79 STDMETHOD(get_dummy_8)(USHORT* pVal);
80 STDMETHOD(get_mpeg_offset)(UINT* pVal);
81 STDMETHOD(get_chunk_count)(USHORT* pVal);
82 STDMETHOD(get_chunks)(IChunkCollection** pVal);
83 STDMETHOD(get_mak)(BSTR* pVal);
84 STDMETHOD(put_mak)(BSTR newVal);
85 STDMETHOD(DecryptMPEGToFile)(BSTR bstrFileName);
86 STDMETHOD(DecryptMPEGToStream)(IStream* pStm);
87 };
88
89 OBJECT_ENTRY_AUTO(__uuidof(TivoFile), CTivoFile)

cvs@jdrake.com
ViewVC Help
Powered by ViewVC 1.1.13