五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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)遵守國家法律
阜阳市| 开阳县| 广安市| 修水县| 曲阜市| 东丽区| 塔河县| 庄浪县| 伽师县| 上蔡县| 定远县| 道孚县| 五寨县| 水富县| 安阳市| 调兵山市| 大厂| 沾化县| 大名县| 大庆市| 洱源县| 镇平县| 于田县| 滁州市| 沭阳县| 美姑县| 清苑县| 高安市| 绥江县| 鞍山市| 新兴县| 北京市| 睢宁县| 沅陵县| 大荔县| 娄烦县| 临江市| 宁化县| 宣武区| 右玉县| 土默特右旗|