=====================================================

ffdshow源代码分析系列文章列表:

ffdshow 源代码分析 1: 整体结构

ffdshow 源代码分析 2: 位图覆盖滤镜(对话框部分Dialog)

ffdshow 源代码分析 3: 位图覆盖滤镜(设置部分Settings)

ffdshow 源代码分析 4: 位图覆盖滤镜(滤镜部分Filter)

ffdshow 源代码分析 5: 位图覆盖滤镜(总结)

ffdshow 源代码分析 6: 对解码器的dll的封装(libavcodec)

ffdshow 源代码分析 7: libavcodec视频解码器类(TvideoCodecLibavcodec)

ffdshow 源代码分析 8: 视频解码器类(TvideoCodecDec)

ffdshow 源代码分析 9: 编解码器有关类的总结

=====================================================

上一篇文章介绍了ffdshow的位图覆盖滤镜的对话框(Dialog)部分:ffdshow 源代码分析2 : 位图覆盖滤镜(对话框部分Dialog)

在这里再介绍一下设置部分(Settings),此外还有一个滤镜部分(Filter)。这三个部分就可以组成一个ffdshow的滤镜功能了。

设置部分(Settings)

在ffdshow中滤镜的设置部分(Settings)主要用于存储滤镜运行过程中需要用到的各种变量。一般情况下通过读取注册表变量并赋值给该类当中的变量从而达到操作相应滤镜的功能。

与位图覆盖(Bitmap)滤镜的设置有关的类位于settings->filters->video目录下(隐藏的很深啊)的TbitmapSettings.cpp和TbitmapSettings.h文件中。

先来看看TbitmapSettings.h

该类的名字叫TbitmapSettings,从类的定义我们可以看出,

flnm[]存储了打开的位图的路径

posx,posy存储了位图在屏幕上显示的位置

mode存储了显示的方式

等等,所有跟该滤镜(Filter)相关的数据都存储在该类之中。

该类包含一个TfilterIDFF类型的结构体idffs,用于存储该滤镜的一些属性信息(名称,ID,属性对话框ID等等)

此外,有两个函数至关重要。createFilters()用于创建滤镜(Filter)。 createPages()用于创建滤镜的配置对话框(Dialog)。

#ifndef _TBITMAPSETTINGS_H_
#define _TBITMAPSETTINGS_H_
//各个Filter预设值
#include "TfilterSettings.h"
#include "Tfont.h"
//Bitmap的配置信息
struct TbitmapSettings : TfilterSettingsVideo {
private:static const TfilterIDFF idffs;
protected:virtual const int *getResets(unsigned int pageId);
public:TbitmapSettings(TintStrColl *Icoll = NULL, TfilterIDFFs *filters = NULL);//Bitmap文件路径char_t flnm[MAX_PATH];//x,y坐标,以及坐标的模式int posx, posy, posmode;int align;//叠加方式enum {MODE_BLEND = 0,MODE_DARKEN = 1,MODE_LIGHTEN = 2,MODE_ADD = 3,MODE_SOFTLIGHT = 4,MODE_EXCLUSION = 5};int mode;static const char_t *modes[];int strength;//创建Filtervirtual void createFilters(size_t filtersorder, Tfilters *filters, TfilterQueue &queue) const;//创建属性页面virtual void createPages(TffdshowPageDec *parent) const;virtual bool getTip(unsigned int pageId, char_t *buf, size_t buflen);
};#endif

再来看看TbitmapSettings.cpp

该类包含了TbitmapSettings类中函数方法的具体实现。首先看一下构造函数TbitmapSettings()。从构造函数中可以看出,绑定了类中的变量和注册表变量,使它们形成一一对应的关系。其他的函数就不再细说了,比较简单,理解起来比较容易。

/** Copyright (c) 2004-2006 Milan Cutka** This program is free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* GNU General Public License for more details.** You should have received a copy of the GNU General Public License* along with this program; if not, write to the Free Software* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA*/#include "stdafx.h"
#include "TbitmapSettings.h"
#include "TimgFilterBitmap.h"
#include "Cbitmap.h"
#include "TffdshowPageDec.h"
#include "TsubtitlesSettings.h"
//几种叠加方式
const char_t* TbitmapSettings::modes[] = {_l("blend"),_l("darken"),_l("lighten"),_l("add"),_l("softlight"),_l("exclusion"),NULL
};
//Filter属性
const TfilterIDFF TbitmapSettings::idffs = {/*name*/      _l("Bitmap overlay"),/*id*/        IDFF_filterBitmap,/*is*/        IDFF_isBitmap,/*order*/     IDFF_orderBitmap,/*show*/      IDFF_showBitmap,/*full*/      IDFF_fullBitmap,/*half*/      0,/*dlgId*/     IDD_BITMAP,
};
//构造函数
TbitmapSettings::TbitmapSettings(TintStrColl *Icoll, TfilterIDFFs *filters): TfilterSettingsVideo(sizeof(*this), Icoll, filters, &idffs)
{half = 0;memset(flnm, 0, sizeof(flnm));//绑定变量static const TintOptionT<TbitmapSettings> iopts[] = {IDFF_isBitmap       , &TbitmapSettings::is        , 0, 0, _l(""), 1,_l("isBitmap"), 0,IDFF_showBitmap     , &TbitmapSettings::show      , 0, 0, _l(""), 1,_l("showBitmap"), 1,IDFF_orderBitmap    , &TbitmapSettings::order     , 1, 1, _l(""), 1,_l("orderBitmap"), 0,IDFF_fullBitmap     , &TbitmapSettings::full      , 0, 0, _l(""), 1,_l("fullBitmap"), 0,IDFF_bitmapPosx     , &TbitmapSettings::posx      , -4096, 4096, _l(""), 1,_l("bitmapPosX"), 50,IDFF_bitmapPosy     , &TbitmapSettings::posy      , -4096, 4096, _l(""), 1,_l("bitmapPosY"), 50,IDFF_bitmapPosmode  , &TbitmapSettings::posmode   , 0, 1, _l(""), 1,_l("bitmapPosMode"), 0,IDFF_bitmapAlign    , &TbitmapSettings::align     , 0, 3, _l(""), 1,_l("bitmapAlign"), ALIGN_CENTER,IDFF_bitmapMode     , &TbitmapSettings::mode      , 0, 5, _l(""), 1,_l("bitmapMode"), 0,IDFF_bitmapStrength , &TbitmapSettings::strength  , 0, 256, _l(""), 1,_l("bitmapStrength"), 128,0};addOptions(iopts);static const TstrOption sopts[] = {IDFF_bitmapFlnm     , (TstrVal)&TbitmapSettings::flnm  , MAX_PATH, 0, _l(""), 1,_l("bitmapFlnm"), _l(""),0};addOptions(sopts);static const TcreateParamList1 listMode(modes);setParamList(IDFF_bitmapMode, &listMode);static const TcreateParamList1 listAlign(TsubtitlesSettings::alignments);setParamList(IDFF_bitmapAlign, &listAlign);
}
//创建Filter
void TbitmapSettings::createFilters(size_t filtersorder, Tfilters *filters, TfilterQueue &queue) const
{idffOnChange(idffs, filters, queue.temporary);if (is && show) {queueFilter<TimgFilterBitmap>(filtersorder, filters, queue);}
}
//创建属性页面
void TbitmapSettings::createPages(TffdshowPageDec *parent) const
{parent->addFilterPage<TbitmapPage>(&idffs);
}const int* TbitmapSettings::getResets(unsigned int pageId)
{static const int idResets[] = {IDFF_bitmapPosx, IDFF_bitmapPosy, IDFF_bitmapPosmode, IDFF_bitmapAlign, IDFF_bitmapMode, IDFF_bitmapStrength,0};return idResets;
}bool TbitmapSettings::getTip(unsigned int pageId, char_t *tipS, size_t len)
{if (flnm[0]) {tsnprintf_s(tipS, len, _TRUNCATE, _l("%s %s"), modes[mode], flnm);tipS[len - 1] = '\0';} else {tipS[0] = '\0';}return true;
}

ffdshow 源代码分析 3: 位图覆盖滤镜(设置部分Settings)相关推荐

  1. ffdshow 源代码分析 5: 位图覆盖滤镜(总结)

    ===================================================== ffdshow源代码分析系列文章列表: ffdshow 源代码分析 1: 整体结构 ffds ...

  2. ffdshow 源代码分析 4: 位图覆盖滤镜(滤镜部分Filter)

    ===================================================== ffdshow源代码分析系列文章列表: ffdshow 源代码分析 1: 整体结构 ffds ...

  3. ffdshow 源代码分析 2: 位图覆盖滤镜(对话框部分Dialog)

    ===================================================== ffdshow源代码分析系列文章列表: ffdshow 源代码分析 1: 整体结构 ffds ...

  4. ffdshow 源代码分析 9: 编解码器有关类的总结

    ===================================================== ffdshow源代码分析系列文章列表: ffdshow 源代码分析 1: 整体结构 ffds ...

  5. ffdshow 源代码分析 7: libavcodec视频解码器类(TvideoCodecLibavcodec)

    ===================================================== ffdshow源代码分析系列文章列表: ffdshow 源代码分析 1: 整体结构 ffds ...

  6. ffdshow 源代码分析 6: 对解码器的dll的封装(libavcodec)

    ===================================================== ffdshow源代码分析系列文章列表: ffdshow 源代码分析 1: 整体结构 ffds ...

  7. ffdshow 源代码分析1 : 整体结构

    ===================================================== ffdshow源代码分析系列文章列表: ffdshow 源代码分析 1: 整体结构 ffds ...

  8. Android应用Activity、Dialog、PopWindow、Toast窗体加入机制及源代码分析

    [工匠若水 http://blog.csdn.net/yanbober 转载烦请注明出处.尊重劳动成果] 1 背景 之所以写这一篇博客的原因是由于之前有写过一篇<Android应用setCont ...

  9. Zepto源代码分析之二~三个API

    因为时间关系:本次仅仅对这三个API($.camelCase.$.contains.$.each)方法进行分析 第一个方法变量转驼峰:$.camelCase('hello-world-welcome' ...

最新文章

  1. 云计算将成为金融服务业的主流技术
  2. Linux学习-文件管理(2)
  3. JNDI数据库连接池的配置
  4. 次世代手游美术资源优化干货分享
  5. java原型链_深入总结Javascript原型及原型链
  6. sklearn自学指南(part25)--正交分解
  7. JPA中的@MappedSuperclass
  8. IndexedDB:浏览器里内置的数据库
  9. [webpack] 如何把代码内联进html中?
  10. 力扣-5 最长回文子串
  11. ColorTransform类应用实例:鼠标经过时使图片发光。
  12. 美团员工被指用钓鱼邮件获拼多多薪资;华为回应暂无其它手机厂商接入HarmonyOS;GCC 放弃版权转让政策...
  13. Excel VBA教程之如何在功能区中显示 Excel 开发人员选项卡,启用vba(教程含源码)
  14. Spring quartz插件的使用
  15. 官网下载mysql连接驱动jar包教程
  16. python计算黑白图像像素值
  17. GAN评价指标代码(FID、LPIPS、MS-SSIM)
  18. 试验设计[实验设计]
  19. 史玉柱自述创业历程,我思故我在
  20. ASO优化:影响 APP权重与吸量的五大要素

热门文章

  1. 【人脸识别】解析MS-Celeb-1M人脸数据集及FaceImageCroppedWithAlignment.tsv文件提取
  2. 通过IPMI管理口给浪潮NF5270M4的2U服务器安装centos6.4系统
  3. 三维建模 Cinema 4D
  4. Linux下怎样搜索文件
  5. 字符串(字节)长度计算
  6. python打包加壳_Python用PyInstaller打包笔记
  7. Postman与ApiPost比较区别
  8. 小程序新人领取优惠券
  9. windows10家庭版个人电脑提升网速
  10. ehviewer_ehviewer下载预约_ehviewer免登陆版最新v1.0.30下载预约去广告清爽版_游戏吧...