2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
25 #include "..\decss\VobFile.h"
26 #include "VobSubFile.h"
48 DWORD tTime
, tOffset
, tTotal
;
57 CAtlArray
<vc_t
> angles
[10];
63 typedef struct VSFRipperData_t
69 bool fResetTime
, fClosedCaption
, fForcedOnly
;
71 bool fClose
, fBeep
, fAuto
; // only used by the UI externally, but may be set through the parameter file
72 bool fCloseIgnoreError
;
74 CAtlArray
<UINT
> selvcs
;
75 CAtlMap
<BYTE
, bool> selids
;
78 void Copy(struct VSFRipperData_t
& rd
);
82 typedef struct {__int64 start
, end
; DWORD vc
;} vcchunk
;
86 // note: these interfaces only meant to be used internally with static linking
92 [uuid("9E2EBB5C-AD7C-452f-A48B-38685716AC46")]
93 interface IVSFRipperCallback
: public IUnknown
95 STDMETHOD (OnMessage
) (LPCTSTR msg
) PURE
;
96 STDMETHOD (OnProgress
) (double progress
/*0->1*/) PURE
;
97 STDMETHOD (OnFinished
) (bool fSucceeded
) PURE
;
100 // IVSFRipperCallbackImpl
103 #define QI(i) (riid == __uuidof(i)) ? GetInterface((i*)this, ppv) :
106 class IVSFRipperCallbackImpl
: public CUnknown
, public IVSFRipperCallback
110 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
)
113 QI(IVSFRipperCallback
)
114 __super::NonDelegatingQueryInterface(riid
, ppv
);
117 // IVSFRipperCallback
118 STDMETHODIMP
OnMessage(LPCTSTR msg
) {return S_FALSE
;}
119 STDMETHODIMP
OnProgress(double progress
/*0->1*/) {return S_FALSE
;}
120 STDMETHODIMP
OnFinished(bool fSucceeded
) {return S_FALSE
;}
123 IVSFRipperCallbackImpl() : CUnknown(NAME("IVSFRipperCallbackImpl"), NULL
) {}
130 [uuid("69F935BB-B8D0-43f5-AA2E-BBD0851CC9A6")]
131 interface IVSFRipper
: public IUnknown
133 STDMETHOD (SetCallBack
) (IVSFRipperCallback
* pCallback
) PURE
;
134 STDMETHOD (LoadParamFile
) (CString fn
) PURE
;
135 STDMETHOD (SetInput
) (CString infn
) PURE
;
136 STDMETHOD (SetOutput
) (CString outfn
) PURE
;
137 STDMETHOD (GetRipperData
) (VSFRipperData
& rd
) PURE
;
138 STDMETHOD (UpdateRipperData
) (VSFRipperData
& rd
) PURE
;
139 STDMETHOD (Index
) () PURE
;
140 STDMETHOD (IsIndexing
) () PURE
;
141 STDMETHOD (Abort
) (bool fSavePartial
) PURE
;
144 class CVobSubFileRipper
: public CVobSubFile
, protected CAMThread
, public IVSFRipper
147 bool m_fThreadActive
, m_fBreakThread
, m_fIndexing
;
148 enum {CMD_EXIT
, CMD_INDEX
};
154 typedef enum {LOG_INFO
, LOG_WARNING
, LOG_ERROR
} log_t
;
155 void Log(log_t type
, LPCTSTR lpszFormat
, ...);
156 void Progress(double progress
);
157 void Finished(bool fSucceeded
);
161 CCritSec m_csAccessLock
;
162 CString m_infn
, m_outfn
;
166 bool LoadIfo(CString fn
);
167 bool LoadVob(CString fn
);
168 bool LoadChunks(CAtlArray
<vcchunk
>& chunks
);
169 bool SaveChunks(CAtlArray
<vcchunk
>& chunks
);
173 CCritSec m_csCallback
;
174 CComPtr
<IVSFRipperCallback
> m_pCallback
;
178 virtual ~CVobSubFileRipper();
181 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
);
184 STDMETHODIMP
SetCallBack(IVSFRipperCallback
* pCallback
);
185 STDMETHODIMP
LoadParamFile(CString fn
);
186 STDMETHODIMP
SetInput(CString infn
);
187 STDMETHODIMP
SetOutput(CString outfn
);
188 STDMETHODIMP
GetRipperData(VSFRipperData
& rd
);
189 STDMETHODIMP
UpdateRipperData(VSFRipperData
& rd
);
190 STDMETHODIMP
Index();
191 STDMETHODIMP
IsIndexing();
192 STDMETHODIMP
Abort(bool fSavePartial
);