Examples of DvdSubtitleStream


Examples of bdsup2sub.supstream.dvd.DvdSubtitleStream

        } else {
            // use palette from loaded VobSub or SUP/IFO
            Palette miniPal = new Palette(4, true);
            int alpha[];
            int palFrame[];
            DvdSubtitleStream substreamDvd;

            if (inMode == InputMode.VOBSUB) {
                substreamDvd = subDVD;
            } else {
                substreamDvd = supDVD;
            }

            alpha = substreamDvd.getFrameAlpha(index);
            palFrame = substreamDvd.getFramePalette(index);

            for (int i=0; i < 4; i++) {
                int a = (alpha[i]*0xff)/0xf;
                if (a >= configuration.getAlphaCrop()) {
                    miniPal.setARGB(i, currentSourceDVDPalette.getARGB(palFrame[i]));
View Full Code Here

Examples of bdsup2sub.supstream.dvd.DvdSubtitleStream

        // close existing subtitleStream
        if (subtitleStream != null) {
            subtitleStream.close();
        }

        DvdSubtitleStream substreamDvd;
        String fnI;
        String fnS;

        if (isVobSub) {
            // SUB/IDX
            if (configuration.getCurrentStreamID() == StreamID.DVDSUB) {
                fnS = fname;
                fnI = FilenameUtils.removeExtension(fname) + ".idx";
            } else {
                fnI = fname;
                fnS = FilenameUtils.removeExtension(fname) + ".sub";
            }
            subDVD = new SubDvd(fnS, fnI);
            subtitleStream = subDVD;
            inMode = InputMode.VOBSUB;
            substreamDvd = subDVD;
        } else {
            // SUP/IFO
            if (FilenameUtils.getExtension(fname).equalsIgnoreCase("ifo") ) {
                fnI = fname;
                fnS = FilenameUtils.removeExtension(fname) + ".sup";
            } else {
                fnI = FilenameUtils.removeExtension(fname) + ".ifo";
                fnS = fname;
            }
            supDVD = new SupDvd(fnS, fnI);
            subtitleStream = supDVD;
            inMode = InputMode.SUPIFO;
            substreamDvd = supDVD;
        }

        // decode first frame
        subtitleStream.decode(0);
        subVobTrg = new SubPictureDVD();
        defaultSourceDVDPalette = substreamDvd.getSrcPalette();
        currentSourceDVDPalette = new Palette(defaultSourceDVDPalette);

        // automatically set luminance thresholds for VobSub conversion
        int primColIdx = subtitleStream.getPrimaryColorIndex();
        int yMax = subtitleStream.getPalette().getY()[primColIdx] & 0xff;
        int[] luminanceThreshold = new int[2];
        configuration.setLuminanceThreshold(luminanceThreshold);
        if (yMax > 10) {
            // find darkest opaque color
            int yMin = yMax;
            for (int i=0; i < 4; i++) {
                int y = subtitleStream.getPalette().getY()[i] & 0xff;
                int a = subtitleStream.getPalette().getAlpha(i);
                if (y < yMin && a > configuration.getAlphaThreshold()) {
                    yMin = y;
                }
            }
            luminanceThreshold[0] = yMin + (yMax-yMin)*9/10;
            luminanceThreshold[1] = yMin + (yMax-yMin)*3/10;
        } else {
            luminanceThreshold[0] = 210;
            luminanceThreshold[1] = 160;
        }

        configuration.setLanguageIdx(substreamDvd.getLanguageIndex());

        // set frame rate
        int h = subtitleStream.getSubPicture(0).getHeight(); //subtitleStream.getBitmap().getHeight();
        switch (h) {
            case 480:
View Full Code Here

Examples of bdsup2sub.supstream.dvd.DvdSubtitleStream

     * @param pal Modified imported palette
     */
    public static void setCurSrcDVDPalette(Palette pal) {
        currentSourceDVDPalette = pal;

        DvdSubtitleStream substreamDvd = null;
        if (inMode == InputMode.VOBSUB) {
            substreamDvd = subDVD;
        } else if (inMode == InputMode.SUPIFO) {
            substreamDvd = supDVD;
        }

        substreamDvd.setSrcPalette(currentSourceDVDPalette);
    }
View Full Code Here

Examples of bdsup2sub.supstream.dvd.DvdSubtitleStream

     * Return frame palette of given subtitle.
     * @param index Index of subtitle
     * @return Frame palette of given subtitle as array of int (4 entries)
     */
    public static int[] getFramePal(int index) {
        DvdSubtitleStream substreamDvd = null;

        if (inMode == InputMode.VOBSUB) {
            substreamDvd = subDVD;
        } else if (inMode == InputMode.SUPIFO) {
            substreamDvd = supDVD;
        }

        if (substreamDvd != null) {
            return substreamDvd.getFramePalette(index);
        } else {
            return null;
        }
    }
View Full Code Here

Examples of bdsup2sub.supstream.dvd.DvdSubtitleStream

     * Return frame alpha values of given subtitle.
     * @param index Index of subtitle
     * @return Frame alpha values of given subtitle as array of int (4 entries)
     */
    public static int[] getFrameAlpha(int index) {
        DvdSubtitleStream substreamDvd = null;

        if (inMode == InputMode.VOBSUB) {
            substreamDvd = subDVD;
        } else if (inMode == InputMode.SUPIFO) {
            substreamDvd = supDVD;
        }

        if (substreamDvd != null) {
            return substreamDvd.getFrameAlpha(index);
        } else {
            return null;
        }
    }
View Full Code Here

Examples of bdsup2sub.supstream.dvd.DvdSubtitleStream

     * Return original frame palette of given subtitle.
     * @param index Index of subtitle
     * @return Frame palette of given subtitle as array of int (4 entries)
     */
    public static int[] getOriginalFramePal(int index) {
        DvdSubtitleStream substreamDvd = null;

        if (inMode == InputMode.VOBSUB) {
            substreamDvd = subDVD;
        } else if (inMode == InputMode.SUPIFO) {
            substreamDvd = supDVD;
        }

        if (substreamDvd != null) {
            return substreamDvd.getOriginalFramePalette(index);
        } else {
            return null;
        }
    }
View Full Code Here

Examples of bdsup2sub.supstream.dvd.DvdSubtitleStream

     * Return original frame alpha values of given subtitle.
     * @param index Index of subtitle
     * @return Frame alpha values of given subtitle as array of int (4 entries)
     */
    public static int[] getOriginalFrameAlpha(int index) {
        DvdSubtitleStream substreamDvd = null;

        if (inMode == InputMode.VOBSUB) {
            substreamDvd = subDVD;
        } else if (inMode == InputMode.SUPIFO) {
            substreamDvd = supDVD;
        }

        if (substreamDvd != null) {
            return substreamDvd.getOriginalFrameAlpha(index);
        } else {
            return null;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.