com.c77.androidstreamingclient.lib.video.DumpDecoder.java Source code

Java tutorial

Introduction

Here is the source code for com.c77.androidstreamingclient.lib.video.DumpDecoder.java

Source

/*
* Copyright (C) 2015 Creativa77 SRL and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
*
* Ayelen Chavez ashi@creativa77.com.ar
* Julian Cerruti jcerruti@creativa77.com.ar
*
*/

package com.c77.androidstreamingclient.lib.video;

import android.util.Log;

import com.c77.androidstreamingclient.lib.BufferedSample;
import com.c77.androidstreamingclient.lib.RtpPlayerException;

import org.apache.commons.codec.binary.Hex;

import java.nio.ByteBuffer;
import java.util.Arrays;

/**
 * Created by julian on 12/15/14.
 */
public class DumpDecoder implements Decoder {
    private static final String TAG = DumpDecoder.class.getName();
    private ByteBuffer buffer = ByteBuffer.allocate(50000);

    @Override
    public BufferedSample getSampleBuffer() throws RtpPlayerException {
        buffer.reset();
        return new BufferedSample(buffer, 0);
    }

    @Override
    public void decodeFrame(BufferedSample frame) {
        String debugging = "Size = " + frame.getSampleSize();
        debugging += " [" + new String(Hex.encodeHex(Arrays.copyOf(frame.getBuffer().array(), 16))) + "]";
        Log.i("DumpDecoder", debugging);
    }
}