无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

vsfiltermod濾鏡源代碼學(xué)習(xí)注釋【一】

2021-11-06 23:50 作者:hanlia  | 我要投稿

VSFilterMod是一款特效插件,可以給播放器配置,也可以用來壓制特效字幕視頻。它能提供比一般字幕所依賴的外部庫libass更豐富的效果,如漸變、抖動(dòng)等,一半壓制默認(rèn)就是用這款濾鏡插件做。濾鏡據(jù)說來源于英文單詞filter,所以與征文好像有一點(diǎn)關(guān)系,試著投了一下。年輕人要多學(xué)習(xí)。

本文先看一個(gè)簡短的源代碼,加入一點(diǎn)注釋。語言:C++

文件(視頻濾鏡基類):vsfiltermod/BaseVideoFilter.h at master · MewX/vsfiltermod · GitHub

#pragma once

//定義視頻輸出類型的結(jié)構(gòu)體

typedef struct

{

? ? const GUID* subtype;

? ? WORD biPlanes;

? ? WORD biBitCount;

? ? DWORD biCompression;

} VIDEO_OUTPUT_FORMATS;

//父類 :CTransformFilter

class CBaseVideoFilter : public CTransformFilter

{

private:

? ? HRESULT Receive(IMediaSample* pIn);


? ? // 原注釋:由于某種原因設(shè)置為私有成員,不能修改,是什么原因?

? ? DWORD m_win, m_hin, m_arxin, m_aryin;

? ? DWORD m_wout, m_hout, m_arxout, m_aryout;


? ? long m_cBuffers;


protected:

? ? CCritSec m_csReceive;


? ? int m_w, m_h, m_arx, m_ary;

//獲取輸出的方法

? ? HRESULT GetDeliveryBuffer(int w, int h, IMediaSample** ppOut);

//復(fù)制緩沖區(qū),具有兩種形式

? ? HRESULT CopyBuffer(BYTE* pOut, BYTE* pIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced = false);

? ? HRESULT CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced = false);

//虛擬方法,獲取輸出大小

? ? virtual void GetOutputSize(int& w, int& h, int& arx, int& ary, int &RealWidth, int &RealHeight) {}

? ? virtual HRESULT Transform(IMediaSample* pIn) = 0;

? ? virtual bool IsVideoInterlaced()

? ? {

? ? ? ? return false;

? ? }

? ? virtual void GetOutputFormats(int& nNumber, VIDEO_OUTPUT_FORMATS** ppFormats);


public:

? ? CBaseVideoFilter(TCHAR* pName, LPUNKNOWN lpunk, HRESULT* phr, REFCLSID clsid, long cBuffers = 1);

? ? virtual ~CBaseVideoFilter();


? ? HRESULT ReconnectOutput(int w, int h, bool bSendSample = true, int realWidth = -1, int realHeight = -1);

? ? int GetPinCount();

? ? CBasePin* GetPin(int n);


? ? HRESULT CheckInputType(const CMediaType* mtIn);

? ? HRESULT CheckOutputType(const CMediaType& mtOut);

? ? HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);

? ? HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);

? ? HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);

? ? HRESULT SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt);


? ? void SetAspect(CSize aspect);

};

//視頻輸入分配基類

class CBaseVideoInputAllocator : public CMemAllocator

{

? ? CMediaType m_mt;


public:

? ? CBaseVideoInputAllocator(HRESULT* phr);

? ? void SetMediaType(const CMediaType& mt);

? ? STDMETHODIMP GetBuffer(IMediaSample** ppBuffer, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags);

};

//定義視頻輸入標(biāo)記基類

class CBaseVideoInputPin : public CTransformInputPin

{

? ? CBaseVideoInputAllocator* m_pAllocator;


public:

? ? CBaseVideoInputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);

? ? ~CBaseVideoInputPin();


? ? STDMETHODIMP GetAllocator(IMemAllocator** ppAllocator);

? ? STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);

};

//定義視頻輸出標(biāo)記基類

class CBaseVideoOutputPin : public CTransformOutputPin

{

public:

? ? CBaseVideoOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);


? ? HRESULT CheckMediaType(const CMediaType* mtOut);

};


完。代碼作者M(jìn)ewX,整個(gè)project似乎是vs stutio開發(fā),C++實(shí)在是太過于笨重了。



vsfiltermod濾鏡源代碼學(xué)習(xí)注釋【一】的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
平乐县| 永吉县| 红河县| 晋城| 宿州市| 罗平县| 永德县| 通榆县| 高唐县| 周口市| 乐平市| 漳州市| 双鸭山市| 宿松县| 海城市| 社会| 萨嘎县| 竹山县| 凤阳县| 华宁县| 玉屏| 桦川县| 涟水县| 枣强县| 长武县| 西平县| 阳原县| 西林县| 大庆市| 洱源县| 锡林郭勒盟| 乌审旗| 波密县| 伊春市| 长乐市| 华亭县| 木兰县| 万州区| 刚察县| 扎鲁特旗| 海南省|