当前位置: 首页>>代码示例>>Python>>正文


Python Settings.getFFmpegSetting方法代码示例

本文整理汇总了Python中settings.Settings.getFFmpegSetting方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.getFFmpegSetting方法的具体用法?Python Settings.getFFmpegSetting怎么用?Python Settings.getFFmpegSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在settings.Settings的用法示例。


在下文中一共展示了Settings.getFFmpegSetting方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getFFmpegSetting [as 别名]
    def __init__(self):
        self.av_register_all = None
        self.avformat_open_input = None
        self.avformat_close_input = None
        self.avformat_find_stream_info = None
        self.av_dict_get = None

        # Get the location of all of the libraries
        libLocation = None
        if Settings.getFFmpegSetting() == Settings.FFMPEG_LIB:
            libLocation = FFMpegLib.getPlatformLibFiles(Settings.getFFmpegLibraryLocation())

        # Make sure we have the libraries expected
        if libLocation in [None, ""]:
            return

        try:
            # Need to load in the following order, otherwise things do not work
            # avutil, avresample, avcodec, avformat
            avutil = CDLL(libLocation['avutil'], mode=RTLD_GLOBAL)
            CDLL(libLocation['swresample'], mode=RTLD_GLOBAL)
            CDLL(libLocation['avcodec'], mode=RTLD_GLOBAL)
            avformat = CDLL(libLocation['avformat'], mode=RTLD_GLOBAL)

            self.av_register_all = avformat.av_register_all
            self.av_register_all.restype = None
            self.av_register_all.argtypes = []

            self.avformat_open_input = avformat.avformat_open_input
            self.avformat_open_input.restype = c_int
            self.avformat_open_input.argtypes = [POINTER(POINTER(AVFormatContext)), c_char_p, POINTER(AVInputFormat), POINTER(POINTER(AVDictionary))]

            self.avformat_close_input = avformat.avformat_close_input
            self.avformat_close_input.restype = None
            self.avformat_close_input.argtypes = [POINTER(POINTER(AVFormatContext))]

            self.avformat_find_stream_info = avformat.avformat_find_stream_info
            self.avformat_find_stream_info.restype = c_int
            self.avformat_find_stream_info.argtypes = [POINTER(AVFormatContext), POINTER(POINTER(AVDictionary))]

            self.av_dict_get = avutil.av_dict_get
            self.av_dict_get.restype = POINTER(AVDictionaryEntry)
            self.av_dict_get.argtypes = [POINTER(AVDictionary), c_char_p, POINTER(AVDictionaryEntry), c_int]

            self.av_log_set_level = avutil.av_log_set_level
            self.av_log_set_level.restype = None
            self.av_log_set_level.argtypes = [c_int]
        except:
            log("FFMpegLib: Failed to load ffmpeg libraries: %s" % traceback.format_exc(), xbmc.LOGERROR)
            self.av_register_all = None
            self.avformat_open_input = None
            self.avformat_close_input = None
            self.avformat_find_stream_info = None
            self.av_dict_get = None
开发者ID:robwebset,项目名称:script.audiobooks,代码行数:56,代码来源:ffmpegLib.py

示例2: createHandler

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getFFmpegSetting [as 别名]
    def createHandler():
        global FFMPEG_INSTANCE
        if FFMPEG_INSTANCE is None:
            # If set to None or Library, then we give the library a go
            # For None, if we are on Windows, then the library files are already there
            if Settings.getFFmpegSetting() == Settings.FFMPEG_LIB:
                log("FfmpegUtils: Loading Audiobook details by library")
                FFMPEG_INSTANCE = FFMpegLib()
                if not FFMPEG_INSTANCE.isSupported():
                    log("FfmpegUtils: Loading by library not supported")
                    FFMPEG_INSTANCE = None

            if FFMPEG_INSTANCE in [None, ""]:
                log("FfmpegUtils: Loading Audiobook details by executable")
                FFMPEG_INSTANCE = FfmpegCmd()
                if not FFMPEG_INSTANCE.isSupported():
                    log("FfmpegUtils: Loading by executable not supported")
                    FFMPEG_INSTANCE = None

        return FFMPEG_INSTANCE
开发者ID:robwebset,项目名称:script.audiobooks,代码行数:22,代码来源:ffmpegLib.py

示例3: getCoverImage

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import getFFmpegSetting [as 别名]
    def getCoverImage(self, tryUtf8=False):
        if self.coverImage is None:
            # Check to see if we already have an image available
            self.coverImage = self._getExistingCoverImage()

        # Before we go checking the actual file, see if we recorded that
        # we have already checked and there was not any
        if self.hasArtwork != 0:
            # If nothing was cached, then see if it can be extracted from the metadata
            if self.coverImage is None:
                self.coverImage = self._saveAlbumArtFromMetadata(self.filePath)

            # Last resort is to try and extract with ffmpeg
            # Only do the ffmpeg check if using the ffmpeg executable as
            # that is the only one that will get the album artwork
            if (self.coverImage is None) and (Settings.getFFmpegSetting() == Settings.FFMPEG_EXEC):
                self._loadDetailsFromFfmpeg()

            # Check if we have now found artwork that we want to store
            audiobookDB = AudioBooksDB()
            self.hasArtwork = 0
            if self.coverImage not in [None, ""]:
                self.hasArtwork = 1
            # Update the database with the artwork status
            audiobookDB.setHasArtwork(self.filePath, self.hasArtwork)
            del audiobookDB

        coverImageValue = self.coverImage
        # Make sure the cover is correctly encoded
        if tryUtf8 and (coverImageValue not in [None, ""]):
            try:
                coverImageValue = coverImageValue.encode("utf-8")
            except:
                pass

        return coverImageValue
开发者ID:robwebset,项目名称:script.audiobooks,代码行数:38,代码来源:audiobook.py


注:本文中的settings.Settings.getFFmpegSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。