master.flame.danmaku.danmaku.parser.BaseDanmakuParser Java Examples

The following examples show how to use master.flame.danmaku.danmaku.parser.BaseDanmakuParser. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VideoViewLiveActivity.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
private BaseDanmakuParser createParser(InputStream stream) {
    if (stream == null) {
        return new BaseDanmakuParser() {
            @Override
            protected Danmakus parse() {
                return new Danmakus();
            }
        };
    }
    ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
    try {
        loader.load(stream);
    } catch (IllegalDataException e) {
        e.printStackTrace();
    }
    BaseDanmakuParser parser = new BiliDanmukuParser();
    IDataSource<?> dataSource = loader.getDataSource();
    parser.load(dataSource);
    return parser;

}
 
Example #2
Source File: VideoViewActivity.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
private BaseDanmakuParser createParser(InputStream stream) {
    if (stream == null) {
        return new BaseDanmakuParser() {
            @Override
            protected Danmakus parse() {
                return new Danmakus();
            }
        };
    }
    ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
    try {
        loader.load(stream);
    } catch (IllegalDataException e) {
        e.printStackTrace();
    }
    BaseDanmakuParser parser = new BiliDanmukuParser();
    IDataSource<?> dataSource = loader.getDataSource();
    parser.load(dataSource);
    return parser;

}
 
Example #3
Source File: DrawTask.java    From letv with Apache License 2.0 6 votes vote down vote up
protected void loadDanmakus(BaseDanmakuParser parser) {
    this.danmakuList = parser.setConfig(this.mContext).setDisplayer(this.mDisp).setTimer(this.mTimer).getDanmakus();
    if (!(this.danmakuList == null || this.danmakuList.isEmpty() || this.danmakuList.first().flags != null)) {
        IDanmakuIterator it = this.danmakuList.iterator();
        while (it.hasNext()) {
            BaseDanmaku item = it.next();
            if (item != null) {
                item.flags = this.mContext.mGlobalFlagValues;
            }
        }
    }
    this.mContext.mGlobalFlagValues.resetAll();
    if (this.danmakuList != null) {
        this.mLastDanmaku = this.danmakuList.last();
    }
}
 
Example #4
Source File: DanmakuVideoPlayer.java    From GSYVideoPlayer with Apache License 2.0 6 votes vote down vote up
/**
 创建解析器对象,解析输入流

 @param stream
 @return
 */
private BaseDanmakuParser createParser(InputStream stream) {

    if (stream == null) {
        return new BaseDanmakuParser() {

            @Override
            protected Danmakus parse() {
                return new Danmakus();
            }
        };
    }

    ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);

    try {
        loader.load(stream);
    } catch (IllegalDataException e) {
        e.printStackTrace();
    }
    BaseDanmakuParser parser = new BiliDanmukuParser();
    IDataSource<?> dataSource = loader.getDataSource();
    parser.load(dataSource);
    return parser;

}
 
Example #5
Source File: BiliDanmukuParser.java    From HeroVideo-master with Apache License 2.0 5 votes vote down vote up
@Override
public BaseDanmakuParser setDisplayer(IDisplayer disp) {
    super.setDisplayer(disp);
    mDispScaleX = mDispWidth / DanmakuFactory.BILI_PLAYER_WIDTH;
    mDispScaleY = mDispHeight / DanmakuFactory.BILI_PLAYER_HEIGHT;
    return this;
}
 
Example #6
Source File: DanmakuHelper.java    From BlueBoard with Apache License 2.0 5 votes vote down vote up
public static BaseDanmakuParser createParser(InputStream stream) {

        if (stream == null) {
            return new BaseDanmakuParser() {

                @Override
                protected Danmakus parse() {
                    return new Danmakus();
                }
            };
        }

//        ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
        ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_ACFUN);

        try {
            loader.load(stream);
        } catch (IllegalDataException e) {
            e.printStackTrace();
        }
//        BaseDanmakuParser parser = new BiliDanmukuParser();
        BaseDanmakuParser parser = new AcFunDanmakuParser();
        IDataSource<?> dataSource = loader.getDataSource();
        parser.load(dataSource);

        return parser;
    }
 
Example #7
Source File: DanmakuSurfaceView.java    From BlueBoard with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(BaseDanmakuParser parser, DanmakuContext config) {
    prepare();
    handler.setConfig(config);
    handler.setParser(parser);
    handler.setCallback(mCallback);
    handler.prepare();
}
 
Example #8
Source File: DanmakuVideoPlayer.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
public BaseDanmakuParser getParser() {
    if (mParser == null) {
        if (mDumakuFile != null) {
            mParser = createParser(getIsStream(mDumakuFile));
        }
    }
    return mParser;
}
 
Example #9
Source File: BiliDanmukuParser.java    From GSYVideoPlayer with Apache License 2.0 5 votes vote down vote up
@Override
public BaseDanmakuParser setDisplayer(IDisplayer disp) {
    super.setDisplayer(disp);
    mDispScaleX = mDispWidth / DanmakuFactory.BILI_PLAYER_WIDTH;
    mDispScaleY = mDispHeight / DanmakuFactory.BILI_PLAYER_HEIGHT;
    return this;
}
 
Example #10
Source File: BiliDanmukuParser.java    From HeroVideo-master with Apache License 2.0 5 votes vote down vote up
@Override
public BaseDanmakuParser setDisplayer(IDisplayer disp) {
    super.setDisplayer(disp);
    mDispScaleX = mDispWidth / DanmakuFactory.BILI_PLAYER_WIDTH;
    mDispScaleY = mDispHeight / DanmakuFactory.BILI_PLAYER_HEIGHT;
    return this;
}
 
Example #11
Source File: DanmakuTextureView.java    From letv with Apache License 2.0 5 votes vote down vote up
public void prepare(BaseDanmakuParser parser, DanmakuContext config) {
    prepare();
    this.handler.setConfig(config);
    this.handler.setParser(parser);
    this.handler.setCallback(this.mCallback);
    this.handler.prepare();
}
 
Example #12
Source File: DanmakuView.java    From letv with Apache License 2.0 5 votes vote down vote up
public void prepare(BaseDanmakuParser parser, DanmakuContext config) {
    prepare();
    this.handler.setConfig(config);
    this.handler.setParser(parser);
    this.handler.setCallback(this.mCallback);
    this.handler.prepare();
}
 
Example #13
Source File: DanmakuSurfaceView.java    From letv with Apache License 2.0 5 votes vote down vote up
public void prepare(BaseDanmakuParser parser, DanmakuContext config) {
    prepare();
    this.handler.setConfig(config);
    this.handler.setParser(parser);
    this.handler.setCallback(this.mCallback);
    this.handler.prepare();
}
 
Example #14
Source File: BiliDanmukuDownloadUtil.java    From HeroVideo-master with Apache License 2.0 4 votes vote down vote up
public static Observable<BaseDanmakuParser> downloadXML(final String uri)
{

    return Observable.create(new Observable.OnSubscribe<BaseDanmakuParser>()
    {

        @Override
        public void call(final Subscriber<? super BaseDanmakuParser> subscriber)
        {


            if (TextUtils.isEmpty(uri))
            {
                subscriber.onNext(new BaseDanmakuParser()
                {

                    @Override
                    protected IDanmakus parse()
                    {

                        return new Danmakus();
                    }
                });
            }

            ILoader loader = null;
            try
            {
                HttpConnection.Response rsp = (HttpConnection.Response)
                        Jsoup.connect(uri).timeout(20000).execute();
                InputStream stream = new ByteArrayInputStream(BiliDanmukuCompressionTools.
                        decompressXML(rsp.bodyAsBytes()));

                loader = DanmakuLoaderFactory.
                        create(DanmakuLoaderFactory.TAG_BILI);
                loader.load(stream);
            } catch (IOException | DataFormatException | IllegalDataException e)
            {
                e.printStackTrace();
            }


            BaseDanmakuParser parser = new BiliDanmukuParser();
            assert loader != null;
            IDataSource<?> dataSource = loader.getDataSource();
            parser.load(dataSource);
            subscriber.onNext(parser);
        }
    }).subscribeOn(Schedulers.io());
}
 
Example #15
Source File: BiliDanmukuParser.java    From letv with Apache License 2.0 4 votes vote down vote up
public BaseDanmakuParser setDisplayer(IDisplayer disp) {
    super.setDisplayer(disp);
    this.mDispScaleX = ((float) this.mDispWidth) / DanmakuFactory.BILI_PLAYER_WIDTH;
    this.mDispScaleY = ((float) this.mDispHeight) / DanmakuFactory.BILI_PLAYER_HEIGHT;
    return this;
}
 
Example #16
Source File: DrawTask.java    From letv with Apache License 2.0 4 votes vote down vote up
public void setParser(BaseDanmakuParser parser) {
    this.mParser = parser;
    this.mReadyState = false;
}
 
Example #17
Source File: DrawHandler.java    From letv with Apache License 2.0 4 votes vote down vote up
public void setParser(BaseDanmakuParser parser) {
    this.mParser = parser;
}
 
Example #18
Source File: CustomMediaController.java    From MyHearts with Apache License 2.0 4 votes vote down vote up
public void setTanMuView(IDanmakuView tanMuView, DanmakuContext mDanmakuContext, BaseDanmakuParser mParser) {
    this.mDanmakuView = tanMuView;
    this.mDanmakuContext = mDanmakuContext;
    this.mParser = mParser;
}
 
Example #19
Source File: CustomMediaLiveController.java    From MyHearts with Apache License 2.0 4 votes vote down vote up
public void setTanMuView(IDanmakuView tanMuView,DanmakuContext mDanmakuContext,BaseDanmakuParser mParser ) {
    this.mDanmakuView = tanMuView;
    this.mDanmakuContext=mDanmakuContext;
    this.mParser=mParser;
}
 
Example #20
Source File: BiliDanmukuDownloadUtil.java    From HeroVideo-master with Apache License 2.0 4 votes vote down vote up
public static Observable<BaseDanmakuParser> downloadXML(final String uri)
{

    return Observable.create(new Observable.OnSubscribe<BaseDanmakuParser>()
    {

        @Override
        public void call(final Subscriber<? super BaseDanmakuParser> subscriber)
        {


            if (TextUtils.isEmpty(uri))
            {
                subscriber.onNext(new BaseDanmakuParser()
                {

                    @Override
                    protected IDanmakus parse()
                    {

                        return new Danmakus();
                    }
                });
            }

            ILoader loader = null;
            try
            {
                HttpConnection.Response rsp = (HttpConnection.Response)
                        Jsoup.connect(uri).timeout(20000).execute();
                InputStream stream = new ByteArrayInputStream(BiliDanmukuCompressionTools.
                        decompressXML(rsp.bodyAsBytes()));

                loader = DanmakuLoaderFactory.
                        create(DanmakuLoaderFactory.TAG_BILI);
                loader.load(stream);
            } catch (IOException | DataFormatException | IllegalDataException e)
            {
                e.printStackTrace();
            }


            BaseDanmakuParser parser = new BiliDanmukuParser();
            assert loader != null;
            IDataSource<?> dataSource = loader.getDataSource();
            parser.load(dataSource);
            subscriber.onNext(parser);
        }
    }).subscribeOn(Schedulers.io());
}
 
Example #21
Source File: IDrawTask.java    From letv with Apache License 2.0 votes vote down vote up
void setParser(BaseDanmakuParser baseDanmakuParser); 
Example #22
Source File: IDanmakuView.java    From letv with Apache License 2.0 votes vote down vote up
void prepare(BaseDanmakuParser baseDanmakuParser, DanmakuContext danmakuContext);