IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Multimédia Java Discussion :

[JMF]Taille du visualComponent


Sujet :

Multimédia Java

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    189
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 189
    Par défaut [JMF]Taille du visualComponent
    Bonjour,

    j'aimerais savoir s'il est possible de modifier la taille du VisualComponent d'un player ... j'ai essayé .getVisualComponent().setSize(50,50) ;

    mais celà ne fonctionne pas

    est ce que quelqu'un aurait une idée ?

  2. #2
    Invité
    Invité(e)
    Par défaut
    salut,
    si tu veux adapter le visuelcomponent à ton fenetre tu peux utiliser la fonction pack() de la classe jframe. en ce qui concerne le redimensionnement du visuelcomponent moi aussi je cherche comment le faire si je trouve quelque chose je vais t'informer.

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    189
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 189
    Par défaut
    j'ai fait des pack(), des setSize() dans tous les sens celà ne fonctionne toujours pas. J'obtiens ça


  4. #4
    Invité
    Invité(e)
    Par défaut
    salut,
    tu peut montrer ton code?

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    189
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 189
    Par défaut
    okay je mets toute la classe

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    /*-----BEGINNING CLASSES IMPORTATION -----*/
     
    import java.awt.*;
    import java.io.IOException;
    import java.net.InetAddress;
    import javax.swing.*;
    import javax.media.control.TrackControl;
    import javax.media.format.VideoFormat;
    import javax.media.protocol.* ;
    import javax.media.rtp.*;
    import javax.media.* ;
    import jmapps.util.StateHelper;
    import javax.media.format.* ;
    import java.util.*; 
     
    /*-----END CLASSES IMPORTATION-----*/
     
     
    /*-----BEGINNING PREVIEW_WINDOW CLASS-----*/
     
    @SuppressWarnings("serial")
    public class previewWindow extends JInternalFrame
    {
    	private JPanel panneauBas ; 
    	private JCheckBox muet ;  
    	private JPanel panneauHaut ;
    	private Processor processeur ;
    	private Player play ;
    	private DataSource sourceCamera ;
     
    		private CaptureDeviceInfo  info ;
    		private MediaLocator ml ;
    		private VideoFormat formatVideo ;
    private Vector peri ;
     
     
     
    	/*-----BEGINNING PREVIEW_WINDOW CONSTRUC TOR-----*/
     
    	public previewWindow()
    	{
    		super("Webcam locale",true, true) ; 
    		System.out.println("Camera loading ...") ;
    		panneauBas = new JPanel() ; 
    		muet = new JCheckBox("Micro muet") ;	
    		panneauHaut = new JPanel() ;
     
    		//panneauHaut.setPreferredSize(new Dimension(50,50)) ;
     
    		panneauBas.add(muet, BorderLayout.WEST) ; 
     
    		initCam() ;
     
     
    		this.getContentPane().add(panneauBas, BorderLayout.SOUTH);
     
    		this.pack() ;
    		this.resize(350,300);
    		this.setVisible(false);
     
    		System.out.println("Camera loading done") ;
    	}
     
    	/*-----END PREVIEW_WINDOW CONSTRUCTOR-----*/
     
     
    	//METHOD WICH ENABLES TO GET THE PLAYER
    	public Player getPlayer()
    	{
    		return this.play ;
    	}
     
     
    	//METHOD WHICH ENABLES TO INITIALIZE THE CAMERA
    	void initCam()
    	{
    		DataSource copieSourceCamera ;
     
    		 Format[] formats ;
     
    		try
    		{	
    			peri = CaptureDeviceManager.getDeviceList(new VideoFormat(VideoFormat.YUV));
     
     
    			info = (CaptureDeviceInfo) peri.elementAt(0) ;		
    			ml = info.getLocator();
    			formats = info.getFormats() ;	
    			formatVideo = (VideoFormat) formats[3] ;
     
    			sourceCamera = Manager.createDataSource(new MediaLocator("vfw://0"));
    			sourceCamera = Manager.createCloneableDataSource(sourceCamera);	
    			copieSourceCamera = ((SourceCloneable)sourceCamera).createClone(); 
     
     
     
     
     
     
    			processeur = Manager.createProcessor(sourceCamera) ;
    			StateHelper playhelper = new StateHelper(processeur);
    			playhelper.configure();
     
    			play = Manager.createPlayer(copieSourceCamera) ;
     
    			play.start() ;
     
    			TrackControl [] tracks = processeur.getTrackControls();
     
     
    			for (int i = 0; i < tracks.length; i++) 
    			{
    			   Format format = tracks[i].getFormat();
    			    if (  tracks[i].isEnabled() &&
    				  format instanceof VideoFormat) {
     
     
    				//Dimension size = ((VideoFormat)format).getSize();
     
    				//float frameRate = ((VideoFormat)format).getFrameRate();		
    				VideoFormat h263 = new VideoFormat(VideoFormat.H263_RTP, new Dimension(160,120),Format.NOT_SPECIFIED,Format.byteArray,Format.NOT_SPECIFIED) ; ;
    				tracks[i].setFormat(h263);
     
    			    }}
     
     
    			ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
    			processeur.setContentDescriptor(cd);
    			playhelper.realize();
     
    			Dimension videoSize = play.getVisualComponent().getPreferredSize(); 
                 int videoWidth = videoSize.width; 
     
                int  videoHeight =  videoSize.height; 
     
                 		 play.getVisualComponent().setSize(100,100) ;
    			 this.getContentPane().add(play.getVisualComponent(), BorderLayout.NORTH) ;
     
    			this.pack() ;
     
     
    			processeur.start() ;
     
     
     
    		}
    		catch(IOException e)
    		{
    			System.out.println("No camera found") ;
    		}
    		catch(NoDataSourceException e)
    		{
    			System.out.println("No camera data source found") ;
    		}
    		catch(NoPlayerException e)
    		{
    			System.out.println("NoPlayerException") ;
    		}
     
     
    	}
     
    	//METHOD WHICH ENABLES TO START STREAMING
    	void startStreaming(String s)
    	{
    		try
    		{
    			DataSource OutputSource = this.processeur.getDataOutput();
     
    			System.out.println("Streaming loading ...");
    			RTPManager rtpm = RTPManager.newInstance();
    			SessionAddress localaddr = new SessionAddress(InetAddress.getLocalHost(),40000);
    			rtpm.initialize(localaddr);
    			SessionAddress destaddr = new SessionAddress(InetAddress.getByName(s),22222);
    			rtpm.addTarget(destaddr);
    			SendStream ss2 = rtpm.createSendStream(OutputSource,0);
    			ss2.start();
    			System.out.println("Streaming loading done") ;
    		}
    		catch(IOException e)
    		{
    			System.out.println("IOException");
    		}
    		catch(InvalidSessionAddressException e)
    		{
    			System.out.println("InvalidSessionAddressException");
    		}
    		catch(UnsupportedFormatException e)
    		{
    			System.out.println("UnsupportedFormatException");
    		}
    	}
    }
     
    /*-----END PREVIEW_WINDOW CLASS-----*/

  6. #6
    Invité
    Invité(e)
    Par défaut
    salut,
    enleve le premier this.pack() (qui se trouve dans le constructeur) et essaye.
    moi je l'ai utiliser pour mire des vidéos et ça parche mais pour la lecture d'après un périphérique je ne sais pas si ça marche ou pas en tout cas essaye.

  7. #7
    Membre confirmé
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    189
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 189
    Par défaut
    nan c'est mort ça marche pas ...

  8. #8
    Membre confirmé Avatar de smh_master
    Inscrit en
    Août 2005
    Messages
    143
    Détails du profil
    Informations forums :
    Inscription : Août 2005
    Messages : 143
    Par défaut
    il faudrait plutôt utiliser :

    this.setSize(width,height) au lieu de this.resize(width,height)

    et supprimer this.pack()

    .

Discussions similaires

  1. [Video] JMF infos video taille codec frame ..
    Par kitue dans le forum Multimédia
    Réponses: 1
    Dernier message: 02/06/2008, 10h21
  2. Connaitre la taille de la RAM
    Par dway dans le forum Assembleur
    Réponses: 23
    Dernier message: 15/09/2004, 10h05
  3. taille maximale d'une base de donnée paradox
    Par Anonymous dans le forum Paradox
    Réponses: 5
    Dernier message: 14/02/2004, 17h39
  4. taille du texte dans un viewport
    Par pitounette dans le forum OpenGL
    Réponses: 3
    Dernier message: 22/07/2002, 12h06
  5. comment réduire une image jpeg (taille x*y)
    Par don-diego dans le forum C
    Réponses: 4
    Dernier message: 14/07/2002, 20h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo