最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(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)遵守國家法律
三原县| 房产| 镇赉县| 邛崃市| 纳雍县| 南华县| 辽宁省| 乐亭县| 新安县| 墨玉县| 酉阳| 潢川县| 盐池县| 永清县| 门头沟区| 德令哈市| 盈江县| 安陆市| 南昌县| 仁化县| 林州市| 德钦县| 南京市| 台中市| 沭阳县| 镇康县| 湾仔区| 德钦县| 元朗区| 台中市| 巴彦淖尔市| 寿光市| 营山县| 寿阳县| 滦平县| 镇巴县| 西乌| 海宁市| 锡林郭勒盟| 昆明市| 阿克苏市|