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

📄 init.cxx

📁 很不错的播放代玛
💻 CXX
📖 第 1 页 / 共 5 页
字号:
        return 1;    case M_PROPERTY_PRINT:        if(!arg) return 0;        *(char**)arg = malloc(64);        (*(char**)arg)[63] = 0;#ifdef USE_SUB        if(subdata) {            char *tmp,*tmp2;            tmp = subdata->filename;            if ((tmp2 = strrchr(tmp, '/')))                tmp = tmp2+1;            snprintf(*(char**)arg, 63, "(%d) %s%s",                     set_of_sub_pos + 1,                     strlen(tmp) < 20 ? "" : "...",                     strlen(tmp) < 20 ? tmp : tmp+strlen(tmp)-19);            return 1;        }#endif        if (demuxer->type == DEMUXER_TYPE_MATROSKA && dvdsub_id >= 0) {            char lang[40] = MSGTR_Unknown;            demux_mkv_get_sub_lang(demuxer, dvdsub_id, lang, 9);            lang[39] = 0;            snprintf(*(char**)arg, 63, "(%d) %s", dvdsub_id, lang);            return 1;        }#ifdef HAVE_OGGVORBIS        if (demuxer->type == DEMUXER_TYPE_OGG && d_dvdsub && dvdsub_id >= 0) {            char *lang = demux_ogg_sub_lang(demuxer, dvdsub_id);            if (!lang) lang = MSGTR_Unknown;            snprintf(*(char**)arg, 63, "(%d) %s",                     dvdsub_id, lang);            return 1;        }#endif        if (vo_vobsub && vobsub_id >= 0) {            const char *language = MSGTR_Unknown;            language = vobsub_get_id(vo_vobsub, (unsigned int) vobsub_id);            snprintf(*(char**)arg, 63, "(%d) %s",                     vobsub_id, language ? language : MSGTR_Unknown);            return 1;        }#ifdef USE_DVDREAD        if (vo_spudec && dvdsub_id >= 0) {            char lang[3] = "\0\0\0";            int code = 0;            code = dvd_lang_from_sid(stream, dvdsub_id);            if (code) {                lang[0] = code >> 8;                lang[1] = code;                lang[2] = 0;            }            snprintf(*(char**)arg, 63, "(%d) %s",                     dvdsub_id, lang);            return 1;        }#endif        snprintf(*(char**)arg, 63, MSGTR_Disabled);        return 1;    case M_PROPERTY_SET:        if(!arg) return 0;        if(*(int*)arg < -1) *(int*)arg = -1;        else if(*(int*)arg >= global_sub_size) *(int*)arg = global_sub_size-1;        global_sub_pos = *(int*)arg;        break;    case M_PROPERTY_STEP_UP:        global_sub_pos += 2;        global_sub_pos = (global_sub_pos % (global_sub_size+1)) - 1;        break;    case M_PROPERTY_STEP_DOWN:        global_sub_pos += global_sub_size+1;        global_sub_pos = (global_sub_pos % (global_sub_size+1)) - 1;        break;    default:        return M_PROPERTY_NOT_IMPLEMENTED;    }    if (global_sub_pos >= 0)        source = sub_source();    mp_msg(MSGT_CPLAYER, MSGL_DBG3,           "subtitles: %d subs, (v@%d s@%d d@%d), @%d, source @%d\n",           global_sub_size, global_sub_indices[SUB_SOURCE_VOBSUB],           global_sub_indices[SUB_SOURCE_SUBS],           global_sub_indices[SUB_SOURCE_DEMUX],           global_sub_pos, source);#ifdef USE_SUB    set_of_sub_pos = -1;    subdata = NULL;    vo_sub_last = vo_sub = NULL;#endif    vobsub_id = -1;    dvdsub_id = -1;    if (d_dvdsub) {        if(d_dvdsub->id > -2) reset_spu = 1;        d_dvdsub->id = -2;    }    if (source == SUB_SOURCE_VOBSUB) {        vobsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_VOBSUB];#ifdef USE_SUB    } else if (source == SUB_SOURCE_SUBS) {        set_of_sub_pos = global_sub_pos - global_sub_indices[SUB_SOURCE_SUBS];        subdata = set_of_subtitles[set_of_sub_pos];        vo_osd_changed(OSDTYPE_SUBTITLE);#endif    } else if (source == SUB_SOURCE_DEMUX) {        dvdsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_DEMUX];        if (d_dvdsub) {#ifdef USE_DVDREAD            if (vo_spudec && stream->type == STREAMTYPE_DVD) {                d_dvdsub->id = dvdsub_id;                spudec_reset(vo_spudec);            }#endif#ifdef HAVE_OGGVORBIS            if (demuxer->type == DEMUXER_TYPE_OGG)                d_dvdsub->id = demux_ogg_sub_id(demuxer, dvdsub_id);#endif            if (demuxer->type == DEMUXER_TYPE_MATROSKA) {                d_dvdsub->id = demux_mkv_change_subs(demuxer, dvdsub_id);                if (d_dvdsub->id >= 0 &&                    ((mkv_sh_sub_t *)d_dvdsub->sh)->type == 'v') {                    mkv_sh_sub_t *mkv_sh_sub = (mkv_sh_sub_t *)d_dvdsub->sh;                    if (vo_spudec != NULL)                        spudec_free(vo_spudec);                    vo_spudec =                        spudec_new_scaled_vobsub(mkv_sh_sub->has_palette ?                                                 mkv_sh_sub->palette :                                                 NULL, mkv_sh_sub->colors,                                                 mkv_sh_sub->custom_colors,                                                 mkv_sh_sub->width,                                                 mkv_sh_sub->height);                    if (!forced_subs_only)                        forced_subs_only = mkv_sh_sub->forced_subs_only;                    if (vo_spudec) {                        spudec_set_forced_subs_only(vo_spudec,                                                    forced_subs_only);                        inited_flags |= INITED_SPUDEC;                    }                }            }        }    } else { // off#ifdef USE_SUB        vo_osd_changed(OSDTYPE_SUBTITLE);#endif        if(vo_spudec) vo_osd_changed(OSDTYPE_SPU);    }#ifdef USE_DVDREAD    if (vo_spudec && stream->type == STREAMTYPE_DVD && dvdsub_id < 0 && reset_spu) {        dvdsub_id = -2;        d_dvdsub->id = dvdsub_id;        spudec_reset(vo_spudec);    }#endif    return 1;}/// Subtitle delay (RW)static int mp_property_sub_delay(m_option_t* prop,int action,void* arg) {    if(!sh_video) return M_PROPERTY_UNAVAILABLE;    return m_property_delay(prop,action,arg,&sub_delay);}/// Alignment of text subtitles (RW) static int mp_property_sub_alignment(m_option_t* prop,int action,void* arg) {#ifdef USE_SUB    char* name[] = { MSGTR_Top, MSGTR_Center, MSGTR_Bottom };    if(!sh_video || global_sub_pos < 0 || sub_source() != SUB_SOURCE_SUBS)        return M_PROPERTY_UNAVAILABLE;    switch(action) {    case M_PROPERTY_PRINT:        if(!arg) return 0;        M_PROPERTY_CLAMP(prop,sub_alignment);        *(char**)arg = strdup(name[sub_alignment]);        return 1;    case M_PROPERTY_SET:        if(!arg) return 0;    case M_PROPERTY_STEP_UP:    case M_PROPERTY_STEP_DOWN:        vo_osd_changed(OSDTYPE_SUBTITLE);    default:        return m_property_choice(prop,action,arg,&sub_alignment);    }#else    return M_PROPERTY_UNAVAILABLE;#endif}/// Subtitle visibility (RW)static int mp_property_sub_visibility(m_option_t* prop,int action,void* arg) {#ifdef USE_SUB    if(!sh_video) return M_PROPERTY_UNAVAILABLE;        switch(action) {    case M_PROPERTY_SET:        if(!arg) return 0;    case M_PROPERTY_STEP_UP:    case M_PROPERTY_STEP_DOWN:        vo_osd_changed(OSDTYPE_SUBTITLE);        if(vo_spudec) vo_osd_changed(OSDTYPE_SPU);    default:        return m_property_flag(prop,action,arg,&sub_visibility);    }#else    return M_PROPERTY_UNAVAILABLE;#endif}/// Show only forced subtitles (RW)static int mp_property_sub_forced_only(m_option_t* prop,int action,void* arg) {    if(!vo_spudec) return M_PROPERTY_UNAVAILABLE;    switch(action) {    case M_PROPERTY_SET:        if(!arg) return 0;    case M_PROPERTY_STEP_UP:    case M_PROPERTY_STEP_DOWN:        m_property_flag(prop,action,arg,&forced_subs_only);        spudec_set_forced_subs_only(vo_spudec,forced_subs_only);        return 1;    default:        return m_property_flag(prop,action,arg,&forced_subs_only);    }}///@}/// \defgroup TVProperties TV properties/// \ingroup Properties///@{#ifdef USE_TV/// TV color settings (RW)static int mp_property_tv_color(m_option_t* prop,int action,void* arg) {    int r,val;    tvi_handle_t* tvh = demuxer->priv;    if(demuxer->type != DEMUXER_TYPE_TV || !tvh) return M_PROPERTY_UNAVAILABLE;        switch(action) {    case M_PROPERTY_SET:        if(!arg) return 0;        M_PROPERTY_CLAMP(prop,*(int*)arg);        return tv_set_color_options(tvh,(int)prop->priv,*(int*)arg);    case M_PROPERTY_GET:        return tv_get_color_options(tvh,(int)prop->priv,arg);    case M_PROPERTY_STEP_UP:    case M_PROPERTY_STEP_DOWN:        if((r = tv_get_color_options(tvh,(int)prop->priv,&val)) >= 0) {            if(!r) return 0;            val += (arg ? *(int*)arg : 1) *                (action == M_PROPERTY_STEP_DOWN ? -1 : 1);            M_PROPERTY_CLAMP(prop,val);            return tv_set_color_options(tvh,(int)prop->priv,val);        }        return 0;    }    return M_PROPERTY_NOT_IMPLEMENTED;}#endif///@}/// All properties available in MPlayer./** \ingroup Properties */static m_option_t mp_properties[] = {    // General    { "osdlevel", mp_property_osdlevel, CONF_TYPE_INT,      M_OPT_RANGE, 0, 3, NULL },    { "speed", mp_property_playback_speed, CONF_TYPE_FLOAT,      M_OPT_RANGE, 0.01, 100.0, NULL },    { "filename", mp_property_filename, CONF_TYPE_STRING,      0, 0, 0, NULL },    { "path", mp_property_path, CONF_TYPE_STRING,      0, 0, 0, NULL },    { "demuxer", mp_property_demuxer, CONF_TYPE_STRING,      0, 0, 0, NULL },    { "stream_pos", mp_property_stream_pos, CONF_TYPE_POSITION,      M_OPT_MIN, 0, 0, NULL },    { "stream_start", mp_property_stream_start, CONF_TYPE_POSITION,      M_OPT_MIN, 0, 0, NULL },    { "stream_end", mp_property_stream_end, CONF_TYPE_POSITION,      M_OPT_MIN, 0, 0, NULL },    { "stream_length", mp_property_stream_length, CONF_TYPE_POSITION,      M_OPT_MIN, 0, 0, NULL },    { "length", mp_property_length, CONF_TYPE_DOUBLE,      0, 0, 0, NULL },    // Audio    { "volume", mp_property_volume, CONF_TYPE_FLOAT,      M_OPT_RANGE, 0, 100, NULL },    { "mute", mp_property_mute, CONF_TYPE_FLAG,      M_OPT_RANGE, 0, 1, NULL },    { "audio_delay", mp_property_audio_delay, CONF_TYPE_FLOAT,      M_OPT_RANGE, -100, 100, NULL },    { "audio_format", mp_property_audio_format, CONF_TYPE_INT,      0, 0, 0, NULL },    { "audio_bitrate", mp_property_audio_bitrate, CONF_TYPE_INT,      0, 0, 0, NULL },    { "samplerate", mp_property_samplerate, CONF_TYPE_INT,      0, 0, 0, NULL },    { "channels", mp_property_channels, CONF_TYPE_INT,      0, 0, 0, NULL },    // Video    { "fullscreen", mp_property_fullscreen, CONF_TYPE_FLAG,      M_OPT_RANGE, 0, 1, NULL },    { "ontop", mp_property_ontop, CONF_TYPE_FLAG,      M_OPT_RANGE, 0, 1, NULL },    { "rootwin", mp_property_rootwin, CONF_TYPE_FLAG,      M_OPT_RANGE, 0, 1, NULL },    { "border", mp_property_border, CONF_TYPE_FLAG,      M_OPT_RANGE, 0, 1, NULL },    { "framedropping", mp_property_framedropping, CONF_TYPE_INT,      M_OPT_RANGE, 0, 2, NULL },    { "gamma", mp_property_gamma, CONF_TYPE_INT,      M_OPT_RANGE, -100, 100, &vo_gamma_gamma },    { "brightness", mp_property_gamma, CONF_TYPE_INT,      M_OPT_RANGE, -100, 100, &vo_gamma_brightness },    { "contrast", mp_property_gamma, CONF_TYPE_INT,      M_OPT_RANGE, -100, 100, &vo_gamma_contrast },    { "saturation", mp_property_gamma, CONF_TYPE_INT,      M_OPT_RANGE, -100, 100, &vo_gamma_saturation },    { "hue", mp_property_gamma, CONF_TYPE_INT,      M_OPT_RANGE, -100, 100, &vo_gamma_hue },    { "panscan", mp_property_panscan, CONF_TYPE_FLOAT,      M_OPT_RANGE, 0, 1, NULL },    { "vsync", mp_property_vsync, CONF_TYPE_FLAG,      M_OPT_RANGE, 0, 1, NULL },    { "video_format", mp_property_video_format, CONF_TYPE_INT,      0, 0, 0, NULL },    { "video_bitrate", mp_property_video_bitrate, CONF_TYPE_INT,      0, 0, 0, NULL },    { "width", mp_property_width, CONF_TYPE_INT,      0, 0, 0, NULL },    { "height", mp_property_height, CONF_TYPE_INT,      0, 0, 0, NULL },    { "fps", mp_property_fps, CONF_TYPE_FLOAT,      0, 0, 0, NULL },    { "aspect", mp_property_aspect, CONF_TYPE_FLOAT,      0, 0, 0, NULL },    // Subs    { "sub", mp_property_sub, CONF_TYPE_INT,      M_OPT_MIN, -1, 0, NULL },    { "sub_delay", mp_property_sub_delay, CONF_TYPE_FLOAT,      0, 0, 0, NULL },    { "sub_pos", mp_property_sub_pos, CONF_TYPE_INT,      M_OPT_RANGE, 0, 100, NULL },    { "sub_alignment", mp_property_sub_alignment, CONF_TYPE_INT,      M_OPT_RANGE, 0, 2, NULL },    { "sub_visibility", mp_property_sub_visibility, CONF_TYPE_FLAG,      M_OPT_RANGE, 0, 1, NULL },    { "sub_forced_only", mp_property_sub_forced_only, CONF_TYPE_FLAG,      M_OPT_RANGE, 0, 1, NULL },    #ifdef USE_TV    { "tv_brightness", mp_property_tv_color, CONF_TYPE_INT,      M_OPT_RANGE, -100, 100, (void*)TV_COLOR_BRIGHTNESS },    { "tv_contrast", mp_property_tv_color, CONF_TYPE_INT,      M_OPT_RANGE, -100, 100, (void*)TV_COLOR_CONTRAST },    { "tv_saturation", mp_property_tv_color, CONF_TYPE_INT,      M_OPT_RANGE, -100, 100, (void*)TV_COLOR_SATURATION },    { "tv_hue", mp_property_tv_color, CONF_TYPE_INT,      M_OPT_RANGE, -100, 100, (void*)TV_COLOR_HUE },#endif    { NULL, NULL, NULL, 0, 0, 0, NULL }};m_option_t*  mp_property_find(char* name) {    return m_option_list_find(mp_properties,name);}int mp_property_do(char* name,int action, void* val) {    m_option_t* p = mp_property_find(name);    if(!p) return M_PROPERTY_UNAVAILABLE;    return m_property_do(p,action,val);}///@}// Properties group/** * \defgroup Command2Property Command to property bridge *  * It is used to handle most commands that just set a property * and optionally display something on the OSD. * Two kinds of commands are handled: adjust or toggle. * * Adjust commands take 1 or 2 parameters: <value> <abs> * If <abs> is non-zero the property is set to the given value * otherwise it is adjusted. * * Toggle commands take 0 or 1 parameters. With no parameter * or a value less than the property minimum it just steps the * property to its next value. Otherwise it sets it to the given * value. * *@{ *//// List of the commands that can be handled by setting a property.static struct  {    /// property name    char* name;    /// cmd id    int cmd;    /// set/adjust or toggle command    int toggle;    /// progressbar type    int osd_progbar;    /// osd msg id if it must be shared    int osd_id;    /// osd msg template    char* osd_msg;} set_prop_cmd[] = {    // audio    { "volume", MP_CMD_VOLUME, 0, OSD_VOLUME, -1, MSGTR_Volume },    { "mute", MP_CMD_MUTE, 1, 0, -1, MSGTR_MuteStatus },    { "audio_delay", MP_CMD_AUDIO_DELAY, 0, 0, -1, MSGTR_AVDelayStatus },    // video    { "fullscreen", MP_CMD_VO_FULLSCREEN, 1, 0, -1, NULL },    { "panscan", MP_CMD_PANSCAN, 0, OSD_PANSCAN, -1, MSGTR_Panscan },    { "ontop", MP_CMD_VO_ONTOP, 1, 0, -1, MSGTR_OnTopStatus },    { "rootwin", MP_CMD_VO_ROOTWIN, 1, 0, -1, MSGTR_RootwinStatus },    { "border", MP_CMD_VO_BORDER, 1, 0, -1, MSGTR_BorderStatus },    { "framedropping", MP_CMD_FRAMEDROPPING, 1, 0, -1, MSGTR_FramedroppingStatus },    { "gamma", MP_CMD_GAMMA, 0, OSD_BRIGHTNESS, -1, MSGTR_Gamma },    { "brightness", MP_CMD_BRIGHTNESS, 0, OSD_BRIGHTNESS, -1, MSGTR_Brightness },    { "contrast", MP_CMD_CONTRAST, 0, OSD_CONTRAST, -1, MSGTR_Contrast },    { "saturation", MP_CMD_SATURATION, 0, OSD_SATURATION, -1, MSGTR_Saturation },    { "hue", MP_CMD_HUE, 0, OSD_HUE, -1, MSGTR_Hue },    { "vsync", MP_CMD_SWITCH_VSYNC, 1, 0, -1, MSGTR_VSyncStatus },    // subs    { "sub", MP_CMD_SUB_SELECT, 1, 0, -1, MSGTR_SubSelectStatus },    { "sub_pos", MP_CMD_SUB_POS, 0, 0, -1, MSGTR_SubPosStatus },    { "sub_alignment", MP_CMD_SUB_ALIGNMENT, 1, 0, -1, MSGTR_SubAlignStatus },    { "sub_delay", MP_CMD_SUB_DELAY, 0, 0, OSD_MSG_SUB_DELAY, MSGTR_SubDelayStatus },    { "sub_visibility", MP_CMD_SUB_VISIBILITY, 1, 0, -1, MSGTR_SubVisibleStatus },    { "sub_

⌨️ 快捷键说明

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