/*
 * Copyright (C) 2014 Prometheus
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package gava;

import javax.swing.SwingUtilities;
import org.gstreamer.Gst;

public class Suscriptor {    
    /**
     * Inicia el programa
     * 
     * @param args Un argumento opcional como nombre del tópico.
     */
    public static void main(final String[] args) {
        final String key = (args.length == 0) ? "test0" : args[0];
        
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                // Inicia GStreamer
                Gst.init("Gava", args); 
                
                // Crea el lector de vídeo.
                LectorVideo lector = new LectorVideo(key);
                lector.iniciar();
                
                // Añade un listener que se ejecute al finalizar la aplicación (Ctl + C)
                Runtime.getRuntime().addShutdownHook(new ShutdownThread(lector));
            }
        });
    }
    
    /**
     * Listener llamado cuando se finaliza la aplicación.
     * Termina los thread de publicación de vídeo para eliminar el participante.
     */
    private static class ShutdownThread extends Thread {
        private final LectorVideo lector;
        
        public ShutdownThread(final LectorVideo lector) {
            this.lector = lector;
        }
        
        @Override
        public void run() {
            System.out.println("Parando. . .");
            this.lector.dispose();
        }
    }
}

@@ -767,16 +767,89 @@
  gava;%0A%0A
+import java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;%0A
 import j
@@ -875,16 +875,16 @@
 lities;%0A
-
 import o
@@ -1434,16 +1434,22 @@
         
+final 
 LectorVi
@@ -1526,32 +1526,630 @@
                %0A
+                // A los 7 segundos cambiamos de c%C3%A1mara si estamos en el escenario%0A                // de debug%0A                javax.swing.Timer t = new javax.swing.Timer(7000, new ActionListener() %7B%0A                    @Override%0A                    public void actionPerformed(ActionEvent ae) %7B%0A                        System.out.println(%22Cambiando...%22);%0A                        lector.cambioParametros(new String%5B%5D %7B %22'test1'%22 %7D);%0A                    %7D%0A                %7D);%0A                t.setRepeats(false);%0A                if (args.length == 0)%0A                    t.start();%0A                %0A
                 

Prueba de cambio de cámara en suscriptor