package com.foxx.androidcast.media.codec;

/*********************************************************************
 * VideoEncoderSink.java
 * Created at: Sun 17 May 2026 22:49:49 +0200
 * Updated at: Wed 20 May 2026 15:17:13 +0200 by Anton Afanasyeu <a.afanasieff@gmail.com>
 * Commit: 5d8e82d2e60a21fff3138d2a394ee4e8b4c6dcb8
 * interface VideoEncoderSink
 * Contributors:
 *    - Anton Afanasyeu <a.afanasieff@gmail.com> (2 commits, 41 lines)
 *    - Cursor Agent (project assistant)
 * Digest: SHA256	5f4e7be7b85bbdf19150483998ca7dbe4faeede03678ffa3dcf112e0de885299
**********************************************************************/
import android.graphics.Bitmap;
import android.view.Surface;

import com.foxx.androidcast.CastTuningEngine;

import java.io.IOException;

/** Video encoder pipeline (MediaCodec today; libvpx fallback later). */
public interface VideoEncoderSink {

    interface Callback {
        void onConfig(int width, int height, byte[] csd0, byte[] csd1);

        void onEncodedFrame(long ptsUs, boolean keyFrame, byte[] data);
    }

    Surface getInputSurface();

    void requestKeyframe();

    Surface prepare(int width, int height, String mime, CastTuningEngine.EffectiveParams params,
            Callback callback) throws IOException;

    void prepareBufferInput(int width, int height, String mime, CastTuningEngine.EffectiveParams params,
            Callback callback) throws IOException;

    void queueBitmapFrame(Bitmap bitmap, long ptsUs);

    void queueYuvFrame(byte[] yuv, long ptsUs);

    void stop();
}
