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


Python mltrefhold.hold_ref函数代码示例

本文整理汇总了Python中mltrefhold.hold_ref函数的典型用法代码示例。如果您正苦于以下问题:Python hold_ref函数的具体用法?Python hold_ref怎么用?Python hold_ref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: create_mlt_producer

 def create_mlt_producer(self, profile):
     producer = mlt.Producer(profile, "frei0r.ising0r")
     producer.set("Temperature", str(self.temp))
     producer.set("Border Growth", str(self.bg))
     producer.set("Spontaneous Growth", str(self.sg))
     mltrefhold.hold_ref(producer)
     return producer
开发者ID:apienk,项目名称:flowblade,代码行数:7,代码来源:patternproducer.py

示例2: add_track_pan_filter

 def add_track_pan_filter(self, track, value):
     # This method is used for master too, and called with tractor then
     pan_filter = mlt.Filter(self.profile, "panner")
     mltrefhold.hold_ref(pan_filter)
     pan_filter.set("start", value)
     track.attach(pan_filter)
     track.pan_filter = pan_filter 
开发者ID:Mermouy,项目名称:flowblade,代码行数:7,代码来源:sequence.py

示例3: create_file_producer_clip

    def create_file_producer_clip(self, path, new_clip_name=None, novalidate=False, ttl=None):
        """
        Creates MLT Producer and adds attributes to it, but does 
        not add it to track/playlist object.
        """        
        producer = mlt.Producer(self.profile, str(path)) # this runs 0.5s+ on some clips
        if novalidate == True:
            producer.set("mlt_service", "avformat-novalidate")
        mltrefhold.hold_ref(producer)
        producer.path = path
        producer.filters = []
        
        (dir, file_name) = os.path.split(path)
        (name, ext) = os.path.splitext(file_name)
        producer.name = name
        if new_clip_name != None:
            producer.name = new_clip_name
        producer.media_type = get_media_type(path)

        if producer.media_type == FILE_DOES_NOT_EXIST:
            print "file does not exist"
            return None

        self.add_clip_attr(producer)
        
        # Img seq ttl value
        producer.ttl = ttl
        if ttl != None:
            producer.set("ttl", int(ttl))

        return producer
开发者ID:ptrg,项目名称:flowblade,代码行数:31,代码来源:sequence.py

示例4: set_track_mute_state

    def set_track_mute_state(self, track_index, mute_state):
        track = self.tracks[track_index]
        track.mute_state = mute_state
    
        # Some older projects might get here without a track gain filter existing
        if not hasattr(track, "gain_filter"):
            # Create and add gain filter
            gain_filter = mlt.Filter(self.profile, "volume")
            mltrefhold.hold_ref(gain_filter)
            gain_filter.set("gain", str(track.audio_gain))
            track.attach(gain_filter)
            track.gain_filter = gain_filter

        if mute_state == 2: # TRACK_MUTE_AUDIO
            if track.id < self.first_video_index:
                # Audio tracks
                track.set("hide", 1)
                track.gain_filter.set("gain", str(0))
            else:
                # Video tracks
                track.set("hide", 0)
                track.gain_filter.set("gain", str(0))
        elif mute_state == 3: # TRACK_MUTE_ALL
            track.set("hide", 1)
            track.gain_filter.set("gain", str(0))
        else: # TRACK_MUTE_NOTHING, TRACK_MUTE_VIDEO
            track.set("hide", int(track.mute_state))
            track.gain_filter.set("gain", str(track.audio_gain))
开发者ID:ptrg,项目名称:flowblade,代码行数:28,代码来源:sequence.py

示例5: add_watermark

 def add_watermark(self, watermark_file_path):
     watermark = mlt.Filter(self.profile, "watermark")
     mltrefhold.hold_ref(watermark)
     watermark.set("resource",str(watermark_file_path))
     watermark.set("composite.always_active", 1)
     self.tractor.attach(watermark)
     self.watermark_filter = watermark
     self.watermark_file_path = watermark_file_path
开发者ID:Mermouy,项目名称:flowblade,代码行数:8,代码来源:sequence.py

示例6: create_color_producer

def create_color_producer(profile, gdk_color_str):
    mlt_color = utils.gdk_color_str_to_mlt_color_str(gdk_color_str)

    producer = mlt.Producer(profile, "colour", mlt_color)
    mltrefhold.hold_ref(producer)
    producer.gdk_color_str = gdk_color_str

    return producer
开发者ID:apienk,项目名称:flowblade,代码行数:8,代码来源:patternproducer.py

示例7: create_mlt_producer

    def create_mlt_producer(self, profile):
        producer = mlt.Producer(profile, "count")    
        producer.set("direction", "down")
        producer.set("style", "seconds")
        producer.set("sound", "2pop")
        producer.set("background", "clock")
        producer.set("drop", "1")

        mltrefhold.hold_ref(producer)
        return producer
开发者ID:jliljebl,项目名称:flowblade,代码行数:10,代码来源:patternproducer.py

示例8: create_mlt_transition

 def create_mlt_transition(self, mlt_profile):
     transition = mlt.Transition(mlt_profile, 
                                str(self.info.mlt_service_id))
     mltrefhold.hold_ref(transition)
     self.mlt_transition = transition
     self.set_default_values()
     
     # PROP_EXPR values may have keywords that need to be replaced with
     # numerical values that depend on the profile we have. These need
     # to be replaced now that we have profile and we are ready to connect this.
     propertyparse.replace_value_keywords(self.properties, mlt_profile)
     
     self.update_editable_mlt_properties()
开发者ID:admonkey,项目名称:flowblade,代码行数:13,代码来源:mlttransitions.py

示例9: _mix_audio_for_track

    def _mix_audio_for_track(self, track):
        # Create and add transition to combine track audios
        transition = mlt.Transition(self.profile, "mix")
        mltrefhold.hold_ref(transition)
        transition.set("a_track", int(AUDIO_MIX_DOWN_TRACK))
        transition.set("b_track", track.id)
        transition.set("always_active", 1)
        transition.set("combine", 1)
        self.field.plant_transition(transition, int(AUDIO_MIX_DOWN_TRACK), track.id)

        # Create and ad gain filter
        gain_filter = mlt.Filter(self.profile, "volume")
        mltrefhold.hold_ref(gain_filter)
        gain_filter.set("gain", str(track.audio_gain))
        track.attach(gain_filter)
        track.gain_filter = gain_filter

        # Add pan filter if this track is panorated
        if track.audio_pan != NO_PAN:
            self.add_track_pan_filter(track, 0.5) 
            track.audio_pan = 0.5
开发者ID:Mermouy,项目名称:flowblade,代码行数:21,代码来源:sequence.py

示例10: create_slowmotion_producer

    def create_slowmotion_producer(self, path, speed):
        """
        Creates MLT Producer and adds attributes to it, but does 
        not add it to track/playlist object.
        """
        fr_path = "framebuffer:" + path + "?" + str(speed)
        producer = mlt.Producer(self.profile, None, str(fr_path)) # this runs 0.5s+ on some clips
        mltrefhold.hold_ref(producer)

        (folder, file_name) = os.path.split(path)
        (name, ext) = os.path.splitext(file_name)
        producer.name = name
        producer.path = path
        producer.speed = speed
        producer.media_type = get_media_type(path)
        if producer.media_type == FILE_DOES_NOT_EXIST:
            return None

        self.add_clip_attr(producer)
        
        return producer
开发者ID:Mermouy,项目名称:flowblade,代码行数:21,代码来源:sequence.py

示例11: init_mlt_objects

    def init_mlt_objects(self):
        # MLT objects for multitrack sequence
        self.tractor = mlt.Tractor()

        self.tractor.mark_in = -1
        self.tractor.mark_out = -1

        # Only create and add pan filter if actual pan is applied
        # This method gets called on load and we only want to add a filter then if pan is applied,
        # and not on initial creation.
        # audiomonitoring.py calls add_track_pan_filter() when pan turned on for initial creation
        if self.master_audio_pan != NO_PAN:
            self.add_track_pan_filter(self.tractor, self.master_audio_pan)

        # Create and ad gain filter
        gain_filter = mlt.Filter(self.profile, "volume")
        mltrefhold.hold_ref(gain_filter)
        gain_filter.set("gain", str(self.master_audio_gain))
        self.tractor.attach(gain_filter)
        self.tractor.gain_filter = gain_filter
        
        self.field = self.tractor.field()
        self.multitrack = self.tractor.multitrack()
        
        self.vectorscope = mlt.Filter(self.profile, "frei0r.vectorscope")
        mltrefhold.hold_ref(self.vectorscope) # ?? is this just some anti-crash hack attempt that was not removed
        self.vectorscope.set("mix", "0.5")
        self.vectorscope.set("overlay sides", "0.0") 
        self.rgbparade =  mlt.Filter(self.profile, "frei0r.rgbparade")
        mltrefhold.hold_ref(self.rgbparade) # ?? is this just some anti-crash hack attempt that was not removed
        self.rgbparade.set("mix", "0.4")
        self.rgbparade.set("overlay sides", "0.0")
        self.outputfilter = None
开发者ID:Mermouy,项目名称:flowblade,代码行数:33,代码来源:sequence.py

示例12: create_file_producer_clip

    def create_file_producer_clip(self, path, new_clip_name=None):
        """
        Creates MLT Producer and adds attributes to it, but does 
        not add it to track/playlist object.
        """
        producer = mlt.Producer(self.profile, str(path)) # this runs 0.5s+ on some clips
        mltrefhold.hold_ref(producer)
        producer.path = path
        producer.filters = []
        
        (dir, file_name) = os.path.split(path)
        (name, ext) = os.path.splitext(file_name)
        producer.name = name
        if new_clip_name != None:
            producer.name = new_clip_name
        producer.media_type = get_media_type(path)
        if producer.media_type == FILE_DOES_NOT_EXIST:
            print "file does not exist"
            return None

        self.add_clip_attr(producer)
        
        return producer
开发者ID:Mermouy,项目名称:flowblade,代码行数:23,代码来源:sequence.py

示例13: _render_frame_buffer_clip_dialog_callback

def _render_frame_buffer_clip_dialog_callback(dialog, response_id, fb_widgets, media_file):
    if response_id == Gtk.ResponseType.ACCEPT:
        # speed, filename folder
        speed = float(int(fb_widgets.hslider.get_value())) / 100.0
        file_name = fb_widgets.file_name.get_text()
        filenames = fb_widgets.out_folder.get_filenames()
        folder = filenames[0]
        write_file = folder + "/"+ file_name + fb_widgets.extension_label.get_text()

        if os.path.exists(write_file):
            primary_txt = _("A File with given path exists!")
            secondary_txt = _("It is not allowed to render Motion Files with same paths as existing files.\nSelect another name for file.") 
            dialogutils.warning_message(primary_txt, secondary_txt, dialog)
            return

         # Profile
        profile_index = fb_widgets.out_profile_combo.get_active()
        if profile_index == 0:
            # project_profile is first selection in combo box
            profile = PROJECT().profile
        else:
            profile = mltprofiles.get_profile_for_index(profile_index - 1)

        # Render consumer properties
        encoding_option_index = fb_widgets.encodings_cb.get_active()
        quality_option_index = fb_widgets.quality_cb.get_active()

        # Range
        range_selection = fb_widgets.render_range.get_active()
        
        dialog.destroy()

        # Create motion producer
        fr_path = "framebuffer:" + media_file.path + "?" + str(speed)
        motion_producer = mlt.Producer(profile, None, str(fr_path))
        mltrefhold.hold_ref(motion_producer)
        
        # Create sequence and add motion producer into it
        seq = sequence.Sequence(profile)
        seq.create_default_tracks()
        track = seq.tracks[seq.first_video_index]
        track.append(motion_producer, 0, motion_producer.get_length() - 1)

        print "motion clip render starting..."

        consumer = renderconsumer.get_render_consumer_for_encoding_and_quality(write_file, profile, encoding_option_index, quality_option_index)
        
        # start and end frames
        start_frame = 0
        end_frame = motion_producer.get_length() - 1
        wait_for_producer_stop = True
        if range_selection == 1:
            start_frame = int(float(media_file.mark_in) * (1.0 / speed))
            end_frame = int(float(media_file.mark_out + 1) * (1.0 / speed)) + int(1.0 / speed) #+ 40 # I'm unable to get this frame perfect.
                                                                                                    # +40 is to make sure rendering stops after mark out.
            if end_frame > motion_producer.get_length() - 1:
                end_frame = motion_producer.get_length() - 1
            
            wait_for_producer_stop = False # consumer wont stop automatically and needs to stopped explicitly

        # Launch render
        global motion_renderer, motion_progress_update
        motion_renderer = renderconsumer.FileRenderPlayer(write_file, seq.tractor, consumer, start_frame, end_frame)
        motion_renderer.wait_for_producer_end_stop = wait_for_producer_stop
        motion_renderer.start()

        title = _("Rendering Motion Clip")
        text = "<b>Motion Clip File: </b>" + write_file
        progress_bar = Gtk.ProgressBar()
        dialog = rendergui.clip_render_progress_dialog(_FB_render_stop, title, text, progress_bar, gui.editor_window.window)

        motion_progress_update = renderconsumer.ProgressWindowThread(dialog, progress_bar, motion_renderer, _FB_render_stop)
        motion_progress_update.start()
        
    else:
        dialog.destroy()
开发者ID:BogusCurry,项目名称:flowblade,代码行数:76,代码来源:render.py

示例14: _create_noise_producer

def _create_noise_producer(profile):
    producer = mlt.Producer(profile, "frei0r.nois0r")
    mltrefhold.hold_ref(producer)
    return producer
开发者ID:apienk,项目名称:flowblade,代码行数:4,代码来源:patternproducer.py

示例15: get_rendered_transition_tractor

def get_rendered_transition_tractor(current_sequence, 
                                    orig_from,
                                    orig_to,
                                    action_from_out,
                                    action_from_in,
                                    action_to_out,
                                    action_to_in,
                                    transition_type_selection_index,
                                    wipe_luma_sorted_keys_index,
                                    gdk_color_str):

    name, transition_type = rendered_transitions[transition_type_selection_index]
    
    # New from clip
    if orig_from.media_type != appconsts.PATTERN_PRODUCER:
        from_clip = current_sequence.create_file_producer_clip(orig_from.path)# File producer
    else:
        from_clip = current_sequence.create_pattern_producer(orig_from.create_data) # pattern producer
    current_sequence.clone_clip_and_filters(orig_from, from_clip)

    # New to clip
    if not(transition_type == RENDERED_FADE_IN or transition_type == RENDERED_FADE_OUT): # fades to not use to_clip
        if orig_to.media_type != appconsts.PATTERN_PRODUCER:
            to_clip = current_sequence.create_file_producer_clip(orig_to.path)# File producer
        else:
            to_clip = current_sequence.create_pattern_producer(orig_to.create_data) # pattern producer
        current_sequence.clone_clip_and_filters(orig_to, to_clip)

    # Create tractor and tracks
    tractor = mlt.Tractor()
    multitrack = tractor.multitrack()
    track0 = mlt.Playlist()
    track1 = mlt.Playlist()
    multitrack.connect(track0, 0)
    multitrack.connect(track1, 1)

    # we'll set in and out points for images and pattern producers.
    if not(transition_type == RENDERED_FADE_IN or transition_type == RENDERED_FADE_OUT): # fades to not use to_clip or some other data used here
        if from_clip.media_type == appconsts.IMAGE or from_clip.media_type == appconsts.PATTERN_PRODUCER:
            length = action_from_out - action_from_in
            from_clip.clip_in = 0
            from_clip.clip_out = length

        if to_clip.media_type == appconsts.IMAGE or to_clip.media_type == appconsts.PATTERN_PRODUCER:
            length = action_to_out - action_to_in
            to_clip.clip_in = 0
            to_clip.clip_out = length
    else:
        length = action_from_out
        if from_clip.media_type == appconsts.IMAGE or from_clip.media_type == appconsts.PATTERN_PRODUCER:
            from_clip.clip_in = 0
            from_clip.clip_out = length
            
    # Add clips to tracks and create keyframe string to contron mixing
    if transition_type == RENDERED_DISSOLVE or transition_type == RENDERED_WIPE:
        # Add clips. Images and pattern producers always fill full track.
        if from_clip.media_type != appconsts.IMAGE and from_clip.media_type != appconsts.PATTERN_PRODUCER:
            track0.insert(from_clip, 0, action_from_in, action_from_out)
        else:
            track0.insert(from_clip, 0, 0, action_from_out - action_from_in)
            
        if to_clip.media_type != appconsts.IMAGE and to_clip.media_type != appconsts.PATTERN_PRODUCER: 
            track1.insert(to_clip, 0, action_to_in, action_to_out)
        else:
            track1.insert(to_clip, 0, 0,  action_to_out - action_to_in)
        kf_str = "0=0/0:100%x100%:0.0;"+ str(tractor.get_length() - 1) + "=0/0:100%x100%:100.0"
    elif transition_type == RENDERED_COLOR_DIP:
        length = action_from_out - action_from_in
        first_clip_length = length / 2
        second_clip_length = length - first_clip_length
        color_clip = patternproducer.create_color_producer(current_sequence.profile, gdk_color_str)
        track0.insert(color_clip, 0, 0, length)
        track1.insert(from_clip, 0, action_from_in, action_from_in + first_clip_length)
        track1.insert(to_clip, 1, action_to_out - second_clip_length, action_to_out)
        kf_str = "0=0/0:100%x100%:100.0;"+ str(first_clip_length) + "=0/0:100%x100%:0.0;" + str(tractor.get_length() - 1) + "=0/0:100%x100%:100.0"
    elif (transition_type == RENDERED_FADE_IN or transition_type == RENDERED_FADE_OUT):
        color_clip = patternproducer.create_color_producer(current_sequence.profile, gdk_color_str)
        track0.insert(color_clip, 0, 0, length)
        if transition_type ==  RENDERED_FADE_IN:
            track1.insert(from_clip, 0, orig_from.clip_in, orig_from.clip_in + length)
            kf_str = "0=0/0:100%x100%:0.0;"+ str(length) + "=0/0:100%x100%:100.0"
        else: # transition_type ==  RENDERED_FADE_OUT
            track1.insert(from_clip, 0, orig_from.clip_out - length, orig_from.clip_out)
            kf_str = "0=0/0:100%x100%:100.0;"+ str(length) + "=0/0:100%x100%:0.0"

    # Create transition
    transition = mlt.Transition(current_sequence.profile, "region")
    mltrefhold.hold_ref(transition)
    transition.set("composite.geometry", str(kf_str)) # controls mix over time
    transition.set("composite.automatic",1)
    transition.set("composite.aligned", 0)
    transition.set("composite.deinterlace",0)
    transition.set("composite.distort",0)
    transition.set("composite.fill",1)
    transition.set("composite.operator","over")
    transition.set("composite.luma_invert",0)
    transition.set("composite.progressive",1)
    transition.set("composite.softness",0)
    transition.set("in", 0)
    transition.set("out", tractor.get_length() - 1)
#.........这里部分代码省略.........
开发者ID:admonkey,项目名称:flowblade,代码行数:101,代码来源:mlttransitions.py


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