⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atmo.cpp

📁 VLC Player Source Code
💻 CPP
📖 第 1 页 / 共 5 页
字号:
set_section( N_("Settings for the built-in Live Video Processor only" ), 0 );add_integer_with_range(CFG_PREFIX "EdgeWeightning",   8, 1, 30, NULL,                       EDGE_TEXT, EDGE_LONGTEXT, false);add_integer_with_range(CFG_PREFIX "Brightness",   100, 50, 300, NULL,                       BRIGHTNESS_TEXT, BRIGHTNESS_LONGTEXT, false);add_integer_with_range(CFG_PREFIX "DarknessLimit",   5, 0, 10, NULL,                       DARKNESS_TEXT, DARKNESS_LONGTEXT, false);add_integer_with_range(CFG_PREFIX "HueWinSize",   3, 0, 5, NULL,                       HUEWINSIZE_TEXT, HUEWINSIZE_LONGTEXT, false);add_integer_with_range(CFG_PREFIX "SatWinSize",   3, 0, 5, NULL,                       SATWINSIZE_TEXT, SATWINSIZE_LONGTEXT, false);add_integer(CFG_PREFIX "filtermode", (int)afmCombined, NULL,            FILTERMODE_TEXT, FILTERMODE_LONGTEXT, false );change_integer_list(pi_filtermode_values, ppsz_filtermode_descriptions, NULL );add_integer_with_range(CFG_PREFIX "MeanLength",    300, 300, 5000, NULL,                       MEANLENGTH_TEXT, MEANLENGTH_LONGTEXT, false);add_integer_with_range(CFG_PREFIX "MeanThreshold",  40, 1, 100, NULL,                       MEANTHRESHOLD_TEXT, MEANTHRESHOLD_LONGTEXT, false);add_integer_with_range(CFG_PREFIX "PercentNew", 50, 1, 100, NULL,                      MEANPERCENTNEW_TEXT, MEANPERCENTNEW_LONGTEXT, false);add_integer_with_range(CFG_PREFIX "FrameDelay", 18, 0, 35, NULL,                       FRAMEDELAY_TEXT, FRAMEDELAY_LONGTEXT, false);/*  output channel reordering*/set_section( N_("Change channel assignment (fixes wrong wiring)" ), 0 );add_integer( CFG_PREFIX "channel_0", 0, NULL,            CHANNEL_0_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false );change_integer_list( pi_channel_assignment_values,                     ppsz_channel_assignment_descriptions, 0 );add_integer( CFG_PREFIX "channel_1", 1, NULL,            CHANNEL_1_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false );change_integer_list( pi_channel_assignment_values,                     ppsz_channel_assignment_descriptions, 0 );add_integer( CFG_PREFIX "channel_2", 2, NULL,            CHANNEL_2_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false );change_integer_list( pi_channel_assignment_values,                     ppsz_channel_assignment_descriptions, 0 );add_integer( CFG_PREFIX "channel_3", 3, NULL,            CHANNEL_3_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false );change_integer_list( pi_channel_assignment_values,                     ppsz_channel_assignment_descriptions, 0 );add_integer( CFG_PREFIX "channel_4", 4, NULL,            CHANNEL_4_ASSIGN_TEXT, CHANNELASSIGN_LONGTEXT, false );change_integer_list( pi_channel_assignment_values,                     ppsz_channel_assignment_descriptions, 0 );/*  LED color white calibration*/set_section( N_("Adjust the white light to your LED stripes" ), 0 );add_bool(CFG_PREFIX "whiteadj", true, NULL,         USEWHITEADJ_TEXT, USEWHITEADJ_LONGTEXT, false);add_integer_with_range(CFG_PREFIX "white-red",   255, 0, 255, NULL,                       WHITE_RED_TEXT,   WHITE_RED_LONGTEXT,   false);add_integer_with_range(CFG_PREFIX "white-green", 255, 0, 255, NULL,                       WHITE_GREEN_TEXT, WHITE_GREEN_LONGTEXT, false);add_integer_with_range(CFG_PREFIX "white-blue",  255, 0, 255, NULL,                       WHITE_BLUE_TEXT,  WHITE_BLUE_LONGTEXT,  false);/* end of definition of parameter for the buildin filter ... part 1 *//*only for buildin (external has own definition) per default the calucationused linear gradients for assigning a priority to the pixel - dependinghow near they are to the border ...for changing this you can create 64x48Pixel BMP files - which contain your own grayscale... (you can produce funnyeffects with this...) the images MUST not compressed, should have 24-bit perpixel, or a simple 256 color grayscale palette*/set_section( N_("Change gradients" ), 0 );add_file(CFG_PREFIX "gradient_zone_0", NULL, NULL,         ZONE_0_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true );add_file(CFG_PREFIX "gradient_zone_1", NULL, NULL,         ZONE_1_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true );add_file(CFG_PREFIX "gradient_zone_2", NULL, NULL,         ZONE_2_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true );add_file(CFG_PREFIX "gradient_zone_3", NULL, NULL,         ZONE_3_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true );add_file(CFG_PREFIX "gradient_zone_4", NULL, NULL,         ZONE_4_GRADIENT_TEXT, ZONE_X_GRADIENT_LONG_TEXT, true );#if defined(__ATMO_DEBUG__)add_bool(CFG_PREFIX "saveframes", false, NULL,         SAVEFRAMES_TEXT, SAVEFRAMES_LONGTEXT, false);add_string(CFG_PREFIX "framepath", "", NULL,           FRAMEPATH_TEXT, FRAMEPATH_LONGTEXT, false );#endif/*   may be later if computers gets more power ;-) than now we increase   the samplesize from which we do the stats for output color calculation*/add_integer_with_range(CFG_PREFIX "width",  64, 64, 512, NULL,                       WIDTH_TEXT,  WIDTH_LONGTEXT, true);add_integer_with_range(CFG_PREFIX "height", 48, 48, 384, NULL,                       HEIGHT_TEXT,  HEIGHT_LONGTEXT, true);add_shortcut( "atmo" );set_callbacks( CreateFilter, DestroyFilter  );vlc_module_end();static const char *const ppsz_filter_options[] = {#if defined(WIN32)        "usebuildin",#endif        "serialdev",        "EdgeWeightning",        "Brightness",        "DarknessLimit",        "HueWinSize",        "SatWinSize",        "filtermode",        "MeanLength",        "MeanThreshold",        "PercentNew",        "FrameDelay",        "channel_0",        "channel_1",        "channel_2",        "channel_3",        "channel_4",        "whiteadj",        "white-red",        "white-green",        "white-blue",        "usepausecolor",        "pcolor-red",        "pcolor-green",        "pcolor-blue",        "fadesteps",        "ecolor-red",        "ecolor-green",        "ecolor-blue",        "efadesteps",#if defined(WIN32 )        "usebuildin",        "atmowinexe",#endif#if defined(__ATMO_DEBUG__)        "saveframes" ,        "framepath",#endif        "width",        "height",        "gradient_zone_0",        "gradient_zone_1",        "gradient_zone_2",        "gradient_zone_3",        "gradient_zone_4",        NULL};/****************************************************************************** fadethread_t: Color Fading Thread****************************************************************************** changes slowly the color of the output if videostream gets paused...******************************************************************************/typedef struct{    VLC_COMMON_MEMBERS        filter_t *p_filter;    /* tell the thread which color should be the target of fading */    uint8_t ui_red;    uint8_t ui_green;    uint8_t ui_blue;    /* how many steps should happen until this */    int i_steps;} fadethread_t;static void *FadeToColorThread(vlc_object_t *);/****************************************************************************** filter_sys_t: AtmoLight filter method descriptor****************************************************************************** It describes the AtmoLight specific properties of an video filter.*****************************************************************************/struct filter_sys_t{    /*    special for the access of the p_fadethread member all other members    need no special protection so far!    */    vlc_mutex_t filter_lock;    bool b_enabled;    int32_t i_AtmoOldEffect;    bool b_pause_live;    int32_t i_atmo_width;    int32_t i_atmo_height;#if defined(__ATMO_DEBUG__)    bool  b_saveframes;    int i_framecounter;    char sz_framepath[MAX_PATH];#endif    /* light color durring movie pause ... */    bool  b_usepausecolor;    uint8_t ui_pausecolor_red;    uint8_t ui_pausecolor_green;    uint8_t ui_pausecolor_blue;    int i_fadesteps;    /* light color on movie finish ... */    uint8_t ui_endcolor_red;    uint8_t ui_endcolor_green;    uint8_t ui_endcolor_blue;    int i_endfadesteps;    fadethread_t *p_fadethread;    /* Variables for buildin driver only... */    /* is only present and initialized if the internal driver is used*/    CAtmoConfig *p_atmo_config;    /* storage for temporal settings "volatile" */    CAtmoDynData *p_atmo_dyndata;    /* initialized for buildin driver with AtmoCreateTransferBuffers */    BITMAPINFOHEADER mini_image_format;    /* is only use buildin driver! */    uint8_t *p_atmo_transfer_buffer;    /* end buildin driver */    /*    contains the real output size of the video calculated on    change event of the variable "crop" from vout    */    int32_t i_crop_x_offset;    int32_t i_crop_y_offset;    int32_t i_crop_width;    int32_t i_crop_height;    void (*pf_extract_mini_image) (filter_sys_t *p_sys,        picture_t *p_inpic,        uint8_t *p_transfer_dest);#if defined( WIN32 )    /* External Library as wrapper arround COM Stuff */    HINSTANCE h_AtmoCtrl;    int32_t (*pf_ctrl_atmo_initialize) (void);    void (*pf_ctrl_atmo_finalize) (int32_t what);    int32_t (*pf_ctrl_atmo_switch_effect) (int32_t);    int32_t (*pf_ctrl_atmo_set_live_source) (int32_t);    void (*pf_ctrl_atmo_create_transfer_buffers) (int32_t, int32_t,                                                  int32_t , int32_t);    uint8_t* (*pf_ctrl_atmo_lock_transfer_buffer) (void);    void (*pf_ctrl_atmo_send_pixel_data) (void);#endif};/*initialize previously configured Atmo Light environment- if internal is enabled try to access the device on the serial port- if not internal is enabled and we are on win32 try to initializethe previously loaded DLL ...Return Values may be: -1 (failed for some reason - filter will be disabled)1 Ok. lets rock*/static int32_t AtmoInitialize(filter_t *p_filter, bool b_for_thread){    filter_sys_t *p_sys = p_filter->p_sys;    if(p_sys->p_atmo_config)    {        if(b_for_thread == false)        {            /* open com port */            /* setup Output Threads ... */            msg_Dbg( p_filter, "open serial connection %s",                p_sys->p_atmo_config->getSerialDevice());            if(CAtmoTools::RecreateConnection(p_sys->p_atmo_dyndata) == ATMO_TRUE)            {                msg_Dbg( p_filter, "start live view thread ...");                CAtmoTools::SwitchEffect(p_sys->p_atmo_dyndata, emLivePicture);                msg_Dbg( p_filter, "live view thread launched...");                return 1;            } else {                msg_Err( p_filter,"failed to open serial device? some other software/driver may use it?");            }        }#if defined(WIN32)    } else if(p_sys->pf_ctrl_atmo_initialize)    {        /* on win32 with active ctrl dll */        return p_sys->pf_ctrl_atmo_initialize();#endif    }    return -1;}/*prepare the shutdown of the effect threads,for build in filter - close the serialport after finishing the threads...cleanup possible loaded DLL...*/static void AtmoFinalize(filter_t *p_filter, int32_t what){    filter_sys_t *p_sys = p_filter->p_sys;    if(p_sys->p_atmo_config)    {        if(what == 1)        {            CAtmoDynData *p_atmo_dyndata = p_sys->p_atmo_dyndata;            if(p_atmo_dyndata)            {                p_atmo_dyndata->LockCriticalSection();                CThread *p_effect_thread = p_atmo_dyndata->getEffectThread();                p_atmo_dyndata->setEffectThread(NULL);                if(p_effect_thread != NULL)                {                    /*                    forced the thread to die...                    and wait for termination of the thread                    */                    p_effect_thread->Terminate();                    delete p_effect_thread;                    msg_Dbg( p_filter, "effect thread died peacefully");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -