<commit_before>package com.pr0gramm.app.mpeg;

import android.content.Context;
import android.graphics.Bitmap;

import com.pr0gramm.app.ui.views.viewer.SoftwareMediaPlayer;

import java.io.InputStream;

/**
 * Plays mpeg files.
 */
public class MpegSoftwareMediaPlayer extends SoftwareMediaPlayer implements VideoConsumer {
    private PictureBuffer buffer;

    public MpegSoftwareMediaPlayer(Context context, InputStream inputStream) {
        super(context, inputStream);
    }

    @Override
    protected void playOnce(InputStream stream) throws Exception {
        logger.info("creating video decoder instance");
        VideoDecoder decoder = new VideoDecoder(this, stream);

        logger.info("start decoding mpeg file now");
        decoder.decodeSequence();

        logger.info("decoding mepg stream finished");
    }

    @Override
    public void sequenceStarted() {
        logger.info("sequence started");
    }

    @Override
    public void sequenceEnded() {
        logger.info("sequence ended");
    }

    @Override
    public void pictureDecoded(PictureBuffer picture) {
        Bitmap bitmap = requestBitmap(picture.width, picture.height);
        try {
            // post information about the newly received size info
            reportSize(picture.width, picture.height);

            bitmap.setPixels(picture.pixels, 0, picture.codedWidth, 0, 0,
                    picture.width, picture.height);
        } catch (Exception error) {
            returnBitmap(bitmap);
            throw error;
        }

        publishBitmap(bitmap);
    }

    @Override<commit_msg>Fix "busy indicator not disappearing" with mpeg decoder<commit_after>package com.pr0gramm.app.mpeg;

import android.content.Context;
import android.graphics.Bitmap;

import com.pr0gramm.app.ui.views.viewer.SoftwareMediaPlayer;

import java.io.InputStream;

/**
 * Plays mpeg files.
 */
public class MpegSoftwareMediaPlayer extends SoftwareMediaPlayer implements VideoConsumer {
    private PictureBuffer buffer;

    public MpegSoftwareMediaPlayer(Context context, InputStream inputStream) {
        super(context, inputStream);
    }

    @Override
    protected void playOnce(InputStream stream) throws Exception {
        publishIsBuffering(true);

        logger.info("creating video decoder instance");
        VideoDecoder decoder = new VideoDecoder(this, stream);

        logger.info("start decoding mpeg file now");
        decoder.decodeSequence();

        logger.info("decoding mepg stream finished");
    }

    @Override
    public void sequenceStarted() {
        logger.info("sequence started");
    }

    @Override
    public void sequenceEnded() {
        logger.info("sequence ended");
    }

    @Override
    public void pictureDecoded(PictureBuffer picture) {
        publishIsBuffering(false);

        Bitmap bitmap = requestBitmap(picture.width, picture.height);
        try {
            // post information about the newly received size info
            reportSize(picture.width, picture.height);

            bitmap.setPixels(picture.pixels, 0, picture.codedWidth, 0, 0,
                    picture.width, picture.height);

        } catch (Exception error) {
            returnBitmap(bitmap);
            throw error;
        }

        publishBitmap(bitmap);
    }

    @Override
{'fraction_non_alphanumeric': 0.08892921960072596, 'fraction_numerical': 0.0030248033877797943, 'mean_word_length': 2.788087056128293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '139317', 'n_tokens_mistral': 879, 'n_tokens_neox': 831, 'n_words': 214}