/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * StreamPanel.java
 *
 * Created on 4-Apr-2012, 4:07:51 PM
 */
package webcamstudio.components;

import java.awt.BorderLayout;
import java.awt.Color;
import webcamstudio.mixers.Frame;
import webcamstudio.mixers.PrePlayer;
import webcamstudio.mixers.PreviewMixer;

/**
 *
 * @author patrick (modified by karl)
 */
public class WSPreviewPanel extends javax.swing.JPanel implements PreviewMixer.SinkListener {

    private PrePlayer player = null;
    

    /** Creates new form StreamPanel
     * @param viewer */
    public WSPreviewPanel(PreViewer viewer) {

        initComponents();
        viewer.setOpaque(true);
        viewer.setVisible(true);
        viewer.setBackground(Color.red);
        panPreview.add(viewer, BorderLayout.CENTER);
        player = PrePlayer.getPreInstance(viewer);   
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panPreview = new javax.swing.JPanel();

        setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        setMaximumSize(new java.awt.Dimension(290, 428));
        setMinimumSize(new java.awt.Dimension(290, 428));
        setPreferredSize(new java.awt.Dimension(290, 280));
        setLayout(new java.awt.BorderLayout());

        panPreview.setBackground(new java.awt.Color(113, 113, 113));
        panPreview.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        panPreview.setMaximumSize(new java.awt.Dimension(90, 60));
        panPreview.setMinimumSize(new java.awt.Dimension(90, 60));
        panPreview.setName("panPreview"); // NOI18N
        panPreview.setPreferredSize(new java.awt.Dimension(90, 60));
        panPreview.setLayout(new java.awt.BorderLayout());
        add(panPreview, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel panPreview;
    // End of variables declaration//GEN-END:variables

    @Override
    public void newPreFrame(Frame frame) {
        player.addFrame(frame);
    }
}