Increase ParseScript cache from 30 to 90 seconds
[xy_vsfilter.git] / docs / vsfilter_note.txt
blob9f63e1696e383ead8a7229efc362386814cc6ddd
1 vsfilter±Ê¼Ç\r
2 1.CSimpleTextSubtitle¶ÁÈ¡Îı¾Îļþ²¢¶ÔÆä×ö¼òµ¥·ÖÎö¡£¶ÁÈ¡ssa/assʱ£¬¶Ô³ýдÔÚtextÖеÄÌØЧ֮ÍâµÄtag½øÐзÖÎö£¬»á´¦ÀíÄÚǶ×ÖÌ壬²»´¦ÀíÄÚǶͼƬ¡£\r
3 ¶ÁÈ¡·ÖÎöÎı¾ÎļþµÄµ÷ÓÃ˳Ðò\r
4         CSimpleTextSubtitle.open\r
5         Í¨¹ýº¯ÊýÖ¸ÕëÊý×éOpenFunctsµ÷Óú¯ÊýOpenSubStationAlpha\r
6         OpenSubStationAlpha¶Ôssa/ass½øÐзÖÎö\r
7 \r
8 2.CRenderedTextSubtitle¼Ì³ÐCSimpleTextSubtitle£¬CRenderedTextSubtitle.ParseSSATag¶ÔassÌØЧ½øÐзÖÎö\r
9 3.·ÖÎöassÌØЧµÄµ÷ÓÃ˳Ðò\r
10         CRenderedTextSubtitle::Renderµ÷ÓÃ\r
11         CRenderedTextSubtitle::GetSubtitleµ÷ÓÃ\r
12         CRenderedTextSubtitle.ParseSSATag\r
13 CRenderedTextSubtitle::ParseSSATag½ö±»Æä×ÔÉí¼°º¯ÊýCRenderedTextSubtitle::GetSubtitleµ÷ÓÃ\r
14 CRenderedTextSubtitle::GetSubtitle½ö±»CRenderedTextSubtitle::Renderµ÷ÓÃ\r
15 4.äÖȾ×ÖÄ»µÄµ÷ÓÃ˳Ðò\r
16         CRenderedTextSubtitle::Renderµ÷ÓÃ\r
17         CRect CLine::PaintBody¡¢CRect CLine::PaintOutline¡¢CLine::PaintShadowµ÷ÓÃ\r
18         CWord::Draw»òCWord.m_pOpaqueBox::Draw\r
19 5.ass×ÖÄ»ÌØЧ֮ÍâµÄ·ÖÎöÔÚopenʱһ´Î×öÍ꣬ЧÂʲ»ÖØÒª¡£ÌØЧ·ÖÎöÿһ´ÎÒ»ÐÐ(?)£¬·ÖÎö´úÂ븴ÔÓ£¬¿ÉÄÜÊÇЧÂʵÄÆ¿¾±¡£\r
20 6.ÎÞÍ·ÆïÊ¿opÌØЧΪÀý£¬Á½ÐÐ×ÖÄ»£¬Ò»ÐÐÔÚ×óÉÏ£¬Ò»ÐÐÔÚÓÒÏ£¬Í¬Ê±ÏÔʾ£¨Èô²»»º³å×ÖĻͼÏñ£©£¬vsfilter´¦ÀíЧÂʺܵͣ¨±ÈÆð½«Á½ÐкÍΪһÐУ©£¬¿ÉÄÜÊÇ·Ö³ÉÁ½´ÎäÖȾ£¬´Ë´¦¿Ï¶¨ÓеøĽø¡£\r
21 7.CTextFileÓÃÓÚ´¦ÀíÎı¾Îļþ£¬CWebTextFileÔÚCTextFile»ù´¡ÉÏÔö¼ÓÁË´¦ÀíWebÎı¾µÄ¹¦ÄÜ\r
22 8.CVobSubFile´¦Àí.idx¡¢.ifo¡¢.subÎļþ£¬openµÄʱºòÒ»´Î½«ËùÓÐÄÚÈݶÁÈëÄÚ´æ¡£CVobSubFile.Renderµ÷ÓÃStretchBlt½«m_imgÖеÄͼÏñÊä³ö£¬StretchBlt±êʶ·ûÒâÒå¡°copies a bitmap from a source rectangle into a destination rectangle¡±¡£\r
23 ------------------------------------\r
24 CHtmlColorMap Ö» ÊÇ ¼Ì³ÐCAtlMap<CString, DWORD, CStringElementTraits<CString>>²¢Ìṩ¹¹Ô캯Êý\r
25 STSStyle±£´æ×ÖÌåstyle£¬²¢Ìṩ½«STSStyleת»¯ÎªLOGFONT(A/W)µÄ²Ù×÷·ûº¯Êý<<=\r
27 LOGFONTA¡¢LOGFONTW£¨=LOGFONT£©:LOGical FONT, defined in wingdi.h. The two is differed for one use a ansi facename(fontname) string while the other use a widechar version.\r
28 in wingdi.h, LOGFONTW=LOGFONT. Similarly TEXTMETRIC=TEXTMETRICW.\r
30 ----------------------\r
31 CMyFont inherits from CFont and privids a constructor which has a parameter of type STSStyle&.\r
32         ascent: units above the baseline\r
33         descent: units below the baseline\r
34         µ±Ó¦ÓóÌÐòÒªÇó½«×Ö·û·ÅÖÃÔÚ (x, y) Î»ÖÃʱ£¬·ÅÖÃ×Ö·ûµÄ·½Ê½ÊÇʹÆäÒýÓõ㣨¸½Í¼ÖÐÏÔʾµÄµã£©·ÅÖÃÔÚ¸ÃλÖá£ÒýÓõãÖ¸¶¨Ò»ÌõˮƽÏߣ¬³ÆΪ×Ö·ûµÄ»ùÏß (baseline)¡£ÔÚÕý³£µÄ´òÓ¡ÖУ¬×Ö·ûµÄ»ùÏßÓ¦¸Ã¶ÔÆë¡£\r
36 ´ËÍ⣬×ÖÌåÖеÄÿ¸ö×Ö·û¶¼¾ßÓРascent¡¢descent ºÍ advance width ÊôÐÔ¡£ascent ÊÇ×Ö·û³¬³ö»ùÏßÖ®ÉϵľàÀë¡£descent ÊÇ×Ö·û³¬³ö»ùÏßÒÔϵľàÀë¡£advance width Ö¸Ê¾ AWT Ó¦¸Ã·ÅÖÃÏÂÒ»¸ö×Ö·ûµÄλÖá£\r
38 ×Ö·ûÊý×é»ò×Ö·û´®Ò²¿ÉÒÔ¾ßÓРascent¡¢descent ºÍ advance width ÊôÐÔ¡£Êý×éµÄ ascent ÊÇÊý×éÖÐËùÓÐ×Ö·ûµÄ×î´ó ascent¡£descent ÊÇÊý×éÖÐËùÓÐ×Ö·ûµÄ×î´ó descent¡£advance width ÊÇ×Ö·ûÊý×éÖÐÿ¸ö×Ö·ûµÄ advance width Ö®ºÍ¡£String µÄ advance ÊÇ String ÑØ»ùÏߵľàÀë¡£´Ë¾àÀëÊÇ String ¾ÓÖлòÓÒ¶ÔÆëÓ¦¸ÃʹÓõĠwidth¡£ \r
39 ----------------------\r
40 enum eftype: effect type, ¶¨ÒåÁ˼¸ÖÖÌØЧ£¬¶ÔÓ¦ass×ÖÄ»ÌØЧÓòµÄ¼¸¸öÑ¡Ïî¡£\r
41 CWord inherits Rasterizer\r
42 CLine inherits CAtlList<CWord*>\r
43 CSubtitile inherits CAtlList<CLine*>\r
44 Õ⼸ÀàÓ¦¸ÃÊÇÓÃäÖȾÓõÄ\r
45 ----------------------\r
46 STSStyleÑùʽ\r
47 CSTStypleMap Ñùʽ±í\r
48 STSEntry ¶ÔÓ¦ass×ÖÄ»ÀïµÄÒ»ÐÐ×ÖÄ»\r
49 STSSegment Ö¸¶¨Ò»¸ö(ʱ)¶Î[start,end],STSSegment´æ´¢ÁËËùÓпªÊ¼µ½½áÊø°üº¬ÁË[start,end](ʱ)¶ÎµÄ×ÖÄ»\r
50 CSimpleTextSubtitle ¶ÔÓ¦Ò»¸öÎı¾×ÖÄ»\r
51 CSimpleTextSubtitle¼Ì³ÐCAtlArray<STSEntry>\r
52 CSimpleTextSubtitle.CreateSegments()¸ù¾ÝËùÓÐSTSEntry´´½¨STSegment£¬¸ù¾ÝSTSEntry½«Ê±¼ä·Ö¶Î£¬Ã¿¶ÎÐèÒªÏÔʾµÄSTSEntryÓÃÒ»¸öSTSSegment´æ´¢£¨ÊÂʵÉϴ˺¯ÊýʵÏֵŦÄÜÓëËùÓÐSTSEntryµÄ˳ÐòÎ޹أ©\r
53 CSimpleTextSubtitle.Sort(bool)¶ÔËùÓÐSTSEntryÅÅÐò£¬¸ù¾Ý²ÎÊýÑ¡ÔñÅÅÐò·½Ê½£¬Ä¬ÈϲÎÊýfalse:ÒÀSTSEntryµÄ(start,layer,reorder)ÉýÐòÅÅÐò;²ÎÊýtrue:ÒÀreorderÅÅÐò¡£ÅÅÐòºóµ÷ÓÃCreateSegmentsº¯Êý¸üÐÂm_segments£¨Æäʵ²¢ÎÞ±ØÒª£¬Òò²»ÐÞ¸ÄSTSEntry£¬Ö»¸Ä±äÆä˳ÐòµÄ»°£¬¶ÔÓ¦µÄSTSSegment²¢ÎÞÐë¸üУ©\r
54 void CSimpleTextSubtitle::Append(CSimpleTextSubtitle& sts, int timeoff) É¾È¥ËùÓеÄSTSEntryÖÐstart´óÓÚtimeoffµÄ£¬½«stsÖÐËùÓеÄSTSEntryƽÒÆtimeoff¸öµ¥Î»ºó¿½±´¡£timeoffСÓÚ0£¬½«ÉèΪËùÓÐSTSEntryµÄ½áÊøʱ¼ä¡£\r
55 void CSimpleTextSubtitle::TranslateStart(i,fps) ½«µÚi¸öSTSEntryµÄstart»»Ë㣨Èç¹ûÐèÒªµÄ»°£©³Éʱ¼äÊä³ö\r
56 void CSimpleTextSubtitle::TranslateEnd(i,fps)   Í¬ÉÏ\r
57 void CSimpleTextSubtitle::TranslateSegmentStart(i,fps) Í¬ÉÏ\r
58 void CSimpleTextSubtitle::TranslateSegmentStart(i,fps) Í¬ÉÏ\r
60 int CSimpleTextSubtitle::SearchSub(int t, double fps) \r
61     Èôt´óÓÚ»òµÈÓÚËùÓÐSTSEntryµÄstart£¬·µ»Ø×îºóÒ»¸öSTSEntry\r
62     ·ñÔò¶þ·Ö¶¨Î»µ½µÚÒ»¸östart==tµÄSTSEntry\r
63     ÈôδÕÒµ½start==tµÄSTSEntry£¬·µ»Ø-1\r
64 const STSSegment* CSimpleTextSubtitle::SearchSubs(int t, double fps, /*[out]*/ int* iSegment, int* nSegments)\r
65     ËÑË÷ʹt´¦ÓÚstartºÍendÖ®¼äµÄSTSSegment£¬±£´æÓÚiSegment·µ»Ø£¬nSegments±£´æËùÓÐSegments¸öÊý£¬·µ»ØֵΪSTSSegmentÊý×é\r
67 È«ÆÁ±äÁ¿Êý×éCharSetList¡¢CharSetNames¡¢CharSetLen: ×Ö·û¼¯\r
69 ÎÊÌ⣺\r
70 1.CSimpleTextSubtitle¼Ì³ÐCAtlArray<STSEntry>£¬Æäʵ²»Í×£¬ÌرðÊǵ±Ò»¸ö×ÖÄ»±»µ±×÷Ò»¸öCAltArray¶ÔÏó´¦Àíʱ£¬¿ÉÄܵ¼ÖºܶàÎÊÌâ¡£\r
71 2.sortÖв»±Øµ÷ÓÃcreateSegment\r
72 3.openÖбéÀú¼¸ÖÖopenUSFµÈ¼¸ÖÖº¯ÊýµÄ×ö·¨ÓдýÉÌȶ£¬¸ù¾ÝÎļþºó׺ֱ½ÓÑ¡ÏàÓ¦µÄº¯ÊýÈçºÎ£¿\r
73 4.appendСÓÐЧÂÊÎÊÌâ\r
74 5.SearchSub¶þ·Ö¶¨Î»ÊµÏֵúÜÀÃ...ÇÒ·µ»ØÖµÒâÒå²»Ò»Ö£¬bug£¿\r
75 6.CharSetList¡¢CharSetNames¡¢CharSetLenÄܸijɳ£Á¿(?)\r
77 -----------------------------------\r
78 This is indeed the problem. The DirectX Include directory contains an early version of BaseTsd.h which does not include the definition for POINTER_64. You should instead use the version of BaseTsd.h in the Platform SDK, either the one that ships with Visual Studio 2005 (C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include\BaseTsd.h) or in an updated Microsoft SDK installation. In order to get the compiler to use the right file, just remove BaseTsd.h from the DirectX Include directory.\r
80 Simple enough?\r
81 -----------------------------------\r
82 CDirectVobSubFilter->CBaseVideoFilter->CTransformFilter£¬CTransformFilter "uses separate allocators for the input pin and the output pin. To create a filter that processes data in place, use the CTransInPlaceFilter class". ÕâÊÇvsfilterЧÂʵ͵ÄÔ­Òò(?)\r
83 -----------------------------------\r
84 DirectShow baseclassÖÐCTransformInputPin.Receiveµ÷ÓÃCTransformFiler.Receiveµ÷ÓÃCTransformFile.Transform(pIn,pOut)Íê³Éת»»Êý¾ÝÈÎÎñ\r
85 vsfilterÖÐCBaseVideoFilterÖØдÁËreceive£¬ÔÚreceiveÖе÷ÓÃÁËÁíÒ»¸öTransform(pIn)£¬CDirectVobSubFilterÖØдÁËTransform(pIn)£¬×ÖĻдÈëµ½ÊÓƵµÄ²½ÖèÓÉISubPic.AlphaBltº¯ÊýÍê³É(BltÒâΪbit-block transform£¬²Î¼ûwikiµÄbit blit´ÊÌõ)\r
86 CAMThread£º The CAMThread class is an abstract class for managing worker threads.\r
87 ------------------------------------\r
88 CBasePin::CurrentRate()·µ»ØÖµµÄÒâÒ壿\r
89 ------------------------------------\r
90 CheckInputType\r
91 CDirectVobSubFilterδÖØдCheckInputType\r
92 CDirectVobSubFilter2ÖØдCheckInputType£¬µ«Ö»Ôö¼ÓÁËauto loadingµÄ²âÊÔ\r
93 CDirectVobSubFilter¡¢CDirectVobSubFilter2µÄ»ùÀàCBaseVideoFilterÖØдCheckInputTypeΪ\r
95 HRESULT CBaseVideoFilter::CheckInputType(const CMediaType* mtIn)\r
96 {\r
97         BITMAPINFOHEADER bih;\r
98         ExtractBIH(mtIn, &bih);\r
100         return mtIn->majortype == MEDIATYPE_Video \r
101                 && (mtIn->subtype == MEDIASUBTYPE_YV12 \r
102                  || mtIn->subtype == MEDIASUBTYPE_I420 \r
103                  || mtIn->subtype == MEDIASUBTYPE_IYUV\r
104                  || mtIn->subtype == MEDIASUBTYPE_YUY2\r
105                  || mtIn->subtype == MEDIASUBTYPE_ARGB32\r
106                  || mtIn->subtype == MEDIASUBTYPE_RGB32\r
107                  || mtIn->subtype == MEDIASUBTYPE_RGB24\r
108                  || mtIn->subtype == MEDIASUBTYPE_RGB565)\r
109                 && (mtIn->formattype == FORMAT_VideoInfo \r
110                  || mtIn->formattype == FORMAT_VideoInfo2)\r
111                 && bih.biHeight > 0\r
112                 ? S_OK\r
113                 : VFW_E_TYPE_NOT_ACCEPTED;\r
116 ------------------------------------\r
117 InitSubPicQueue\r
118 ¶Ô×ÖĻͼƬ¶ÓÁнøÐгõʼ»¯£¬Áîm_spd.bits = (void*)m_pTempPicBuff\r
119 Ϊm_pSubPicQueueÉèÖÃÁËÒ»¸öCMemSubPicAllocator\r
120 ------------------------------------\r
121 CComPtrµÄ¸³Öµ²Ù×÷·ûµ÷ÓÃÁËAddRef£¬Attach²»µ÷ÓÃAddRef\r
122 ---------------\r
123 ATLINLINE ATLAPI_(IUnknown*) AtlComPtrAssign(IUnknown** pp, IUnknown* lp)\r
125         if (lp != NULL)\r
126                 lp->AddRef();\r
127         if (*pp)\r
128                 (*pp)->Release();\r
129         *pp = lp;\r
130         return lp;\r
132 ---------------\r
133 template <class T>\r
134 class CComPtr\r
136 public:\r
137         ...\r
139         T* operator=(T* lp)\r
140         {\r
141                 return (T*)AtlComPtrAssign((IUnknown**)&p, lp);\r
142         }\r
143 ---------------\r
144 void Attach(T* p2)\r
145         {\r
146                 if (p)\r
147                         p->Release();\r
148                 p = p2;\r
149         }\r
150 ------------------------------------\r
151 bool ExtractDim(const AM_MEDIA_TYPE* pmt, int& w, int& h, int& arx, int& ary)\r
152 input pmt£ºmedia type;\r
153 output:\r
154         w£ºthe width of the video, in pixels;\r
155         h: the height of the video, in pixels;\r
156         arx, ary: the aspect ratio of the video.\r
157         @return: true if succeed.\r
158 ÆäÖдúÂëƬ¶Î£º\r
159 ¡­¡­\r
160     DWORD a = arx, b = ary;\r
161     while(a) {int tmp = a; a = b % tmp; b = tmp;}\r
162 ¡­¡­\r
163 ΪշתÏà³ý·¨Çó×î´ó¹«Ô¼Êý\r
164 ------------------------------------\r
165 class CBaseVideoFilter : public CTransformFilter\r
167 ¡­¡­\r
168 protected:\r
169 int m_w,                //the width of the video, in pixels;\r
170     m_h,                //the height of the video, in pixels;\r
171     m_arx, m_ary;       //the aspect ratio of the video.\r
172 ¡­¡­\r
174 ------------------------------------\r
175 CSubPicQueue²»ÄܱíÏÖ¶¯»­ÌØЧµÄÔ­Òò£º\r
176 »º´æµÄ×ÖĻͼƬʱ¼äΪ¶ÔÓ¦µÄSTSEntryµÄ¿ªÊ¼¡¢½áÊøʱ¼ä¡£¶ÔÓж¯»­ÌØЧµÄSTSEntry£¬µÚÒ»´ÎÉú³É´ËSTSEntry¶ÔÓ¦µÄ×ÖĻͼƬ´æÈë¶ÓÁкó£¬Ã¿´ÎÔÙÉú³É×ÖĻͼƬ£¬¶¼»áÌø¹ý´ËSTSEntry¶ÔÓ¦µÄʱ¼ä¶Î£¬Ö±½ÓÉú³ÉºóÃæµÄʱ¼ä¶ÔÓ¦µÄ×ÖĻͼƬ£¬´Ó¶øÒ»¸öSTSEntryÖ»»á¶ÔÓ¦Ò»¸ö×ÖĻͼƬ£¬Ò²¾Í²»»áÓж¯»­ÌØЧ¡£\r
177 ------------------------------------\r
178 Ị̈߳º\r
179 Ö÷ÒªµÄḬ̈߳üÀ¨ÁË£º\r
180 Ö÷Ị̈߳º                ¸ºÔðÊÓƵµÄ²¥·Å£»\r
181 Éú³É×ÖĻͼƬµÄỊ̈߳º    Éú³É×ÖĻͼƬ¼ÓÈë¶ÓÁУ»\r
182 ½çÃæÏìÓ¦µÄỊ̈߳º        ´´½¨´°¿Ú£¬ÏìÓ¦½çÃæʼþ¡£\r
183 CDirectVobSubFilterÖØдÁËCTransformFilter::CompleteConnect·½·¨£¬ÔÚ´Ë·½·¨Öд´½¨½çÃæÏìÓ¦µÄỊ̈߳¬Ïß³ÌÖ´ÐдúÂëΪSystrayThreadProc£¬´ËÏß³ÌÖд´½¨ÁËvsfilterµÄsystray´°¿Ú(´´½¨ÁËÒ»¸öCSystrayWindowµÄ¶ÔÏó)£¬²¢¿ªÊ¼ÁËÖ÷ÏûϢѭ»·¡£½çÃæÏìÓ¦µÄÏ̵߳ÄÏú»ÙÓÉCDirectVobSubFilter::JoinFilterGraphº¯Êý´¥·¢£¬µ±filterÀ뿪graphʱ£¬CDirectVobSubFilter::JoinFilterGraphÏò½çÃæÏìÓ¦µÄÏ̵߳Ĵ°¿Ú·¢ËÍWM_CLOSEÏûÏ¢£¬Ê¹µÃ½çÃæÏìÓ¦µÄÏß³ÌÍ˳ö¡£\r
184 ------------------------------------\r
185 ĬÈÏÑùʽ\r
186 CDirectVobSubFilterµÄº¯Êý\r
187         put_AspectRatioSettings\r
188         put_TextSettings\r
189         put_Placement\r
190 Ôڳɹ¦¶Ô²ÎÊý×öÁËÐ޸ĺ󣬻Ὣ×ÖÄ»ÎļþÀïµÄdefaultÑùʽ¸ÄΪvsfilterÉ趨µÄĬÈÏÑùʽ¡£ÆäÖÐput_TextSettingsput_Placement¶¼ÓÐÇ¡µ±µÄÅжϱ£Ö¤µ±²ÎÊýûÓз¢Éú±ä»¯Ê±·µ»ØÒ»¸öS_FALSEÖµ£»µ«put_AspectRatioSettingsÿ´Î¶¼·µ»ØS_OK£¬¼´Ê¹²ÎÊýδ·¢Éú±ä»¯£¬´Ó¶øµ¼Ö´ò¿ªvsfilterµÄproperty pageÉèÖòÎÊýºó£¬×ÖÄ»ÎļþÖ¸¶¨µÄdefaultÑùʽ±Ø¶¨»á±»vsfilterµÄĬÈÏÑùʽÌæ´ú¡£