Exemplo n.º 1
0
    def check_subtitle_cpl_duration(self, playlist, asset, folder):
        """ Subtitle duration coherence with CPL. """
        st_dict = self.get_subtitle_xml(asset, folder)
        if not st_dict:
            return

        st_rate = self.get_subtitle_editrate(asset, st_dict)
        subtitles = keys_by_name_dict(st_dict, 'Subtitle')
        _, asset = asset

        last_tc = 0
        for st in subtitles[0]:
            st_out = self.st_tc_frames(st['Subtitle@TimeOut'], st_rate)
            if st_out > last_tc:
                last_tc = st_out

        cpl_rate = asset['EditRate']
        cpl_dur = asset['Duration']
        ratio_editrate = st_rate / cpl_rate
        last_tc_st = last_tc / ratio_editrate

        if last_tc_st > cpl_dur:
            reel_cpl = get_reel_for_asset(playlist, asset['Id'])['Position']
            raise CheckException(
                "Subtitle exceed track duration. Subtitle {} - Track {} "
                "- Reel {}".format(frame_to_tc(last_tc_st, cpl_rate),
                                   frame_to_tc(cpl_dur, cpl_rate), reel_cpl))
Exemplo n.º 2
0
    def check_subtitle_cpl_first_tt_event(self, playlist, asset, folder):
        """ First Timed Text Event of Composition TimeIn greater than 4s.

            The composition's first Timed Text event's TimeIn attribute
            should be greater than or equal to 4 seconds.

            Reference:
                SMPTE RDD 52:2020 7.2.4
        """
        reel_cpl = get_reel_for_asset(playlist, asset[1]['Id'])['Position']
        first_reel_of_st = get_first_reel_for_asset_type(playlist, 'Subtitle')
        # We are probably checking a Caption track
        if not first_reel_of_st:
            return None
        first_reel_of_st = first_reel_of_st['Position']
        if not first_reel_of_st or reel_cpl != first_reel_of_st:
            return

        st_dict = self.st_util.get_subtitle_xml(asset, folder)
        if not st_dict:
            return

        subtitles = keys_by_name_dict(st_dict, 'Subtitle')
        if not subtitles:
            return

        st_editrate = self.st_util.get_subtitle_editrate(asset, st_dict)
        first_tc = subtitles[0][0]['Subtitle@TimeIn']
        first_tc_frames = self.st_util.st_tc_frames(first_tc, st_editrate)

        if (first_tc_frames < 4 * st_editrate):
            self.error("First Timed Text event of CPL happens "
                       "earlier than 4 seconds: {}".format(first_tc))
Exemplo n.º 3
0
    def check_subtitle_cpl_reel_number(self, playlist, asset, folder):
        """ Subtitle reel number coherence with CPL. """
        st_dict = self.get_subtitle_xml(asset, folder)
        if not st_dict:
            return
        _, asset = asset

        reel_no = self.get_subtitle_elem(st_dict, 'ReelNumber')
        reel_cpl = get_reel_for_asset(playlist, asset['Id'])['Position']

        if reel_no and reel_no != reel_cpl:
            raise CheckException("Subtitle file indicate Reel {} but actually "
                                 "used in Reel {}".format(reel_no, reel_cpl))
Exemplo n.º 4
0
    def check_subtitle_cpl_reel_number(self, playlist, asset, folder):
        """ Subtitle reel number coherence with CPL.

            References:
                TI Subtitle Specification for DLP Cinema (v1.1) 2.5
                https://web.archive.org/web/20140924175755/http://dlp.com/downloads/pdf_dlp_cinema_CineCanvas_Rev_C.pdf
                SMPTE ST 428-7:2014 5.6
        """
        st_dict = self.st_util.get_subtitle_xml(asset, folder)
        if not st_dict:
            return
        _, asset = asset

        reel_no = self.st_util.get_subtitle_elem(st_dict, 'ReelNumber')
        reel_cpl = get_reel_for_asset(playlist, asset['Id'])['Position']

        if reel_no and reel_no != reel_cpl:
            self.error("Subtitle file indicate Reel {} but actually "
                       "used in Reel {}".format(reel_no, reel_cpl))