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

C# Discussion :

directshow et graphedit


Sujet :

C#

  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Octobre 2010
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2010
    Messages : 2
    Par défaut directshow et graphedit
    Bonjour,

    Voilà je commence depuis peu à appréhender la librairie directshowlib, j'aimerai charger un .grf un graph dans mon code c# utilisant directshow mais pas réussi pour le moment.

    Je peux ajouter un filtre si je veux comme ca :

    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
     
     graphBuilder[i] = (IGraphBuilder)new FilterGraph();
     
                //Create the Capture Graph Builder
                ICaptureGraphBuilder2 captureGraphBuilder = null;           
                captureGraphBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
     
     
                //Create the media control for controlling the graph
                mediaControl[i] = (IMediaControl)this.graphBuilder[i];
     
                // Attach the filter graph to the capture graph
                int hr = captureGraphBuilder.SetFiltergraph(this.graphBuilder[i]);
                DsError.ThrowExceptionForHR(hr);
     
                //Add the Video input device to the graph
                hr = graphBuilder[i].AddFilter(theDevice[0], "source filter");
                DsError.ThrowExceptionForHR(hr);
    Mais j'ai creer plusieurs filtres dans graphedit et j'aimerai le charger, on fait comment ? merci.

  2. #2
    Candidat au Club
    Profil pro
    Inscrit en
    Octobre 2010
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2010
    Messages : 2
    Par défaut
    Bon j'arrive à a construire mes filtres par le code et j'arrive à l'afficher dans graphedit mais il me manque apparemment l'affichage pour le visualiser mon ecran est tout noir dans mon application :

    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
     
     graphBuilder[i] = (IGraphBuilder)new FilterGraph();
     
                //Add the Video input device to the graph
                hr = graphBuilder[i].AddFilter(theDevice[0], "source filter");
     
     
                smartTee = new SmartTee() as IBaseFilter;
                hr = graphBuilder[i].AddFilter(smartTee, "SmartTee");
                DsError.ThrowExceptionForHR(hr);
     
                teeIn = DsFindPin.ByDirection(smartTee, PinDirection.Input, 0);
     
                devCapture = DsFindPin.ByCategory(theDevice[0], PinCategory.Capture, 0);
     
                hr = graphBuilder[i].Connect(devCapture, teeIn);           
                DsError.ThrowExceptionForHR(hr);
     
                IBaseFilter renderer  = new VideoRendererDefault() as IBaseFilter;
                hr = graphBuilder[i].AddFilter(renderer, "Renderer");
                DsError.ThrowExceptionForHR(hr);
     
                teeOut = DsFindPin.ByDirection(smartTee, PinDirection.Output, 0);
     
                rendererIn = DsFindPin.ByDirection(renderer, PinDirection.Input, 0);
     
                hr = graphBuilder[i].Connect(teeOut, rendererIn);
                DsError.ThrowExceptionForHR(hr);
     
     IVideoWindow videoWindow = null;
                videoWindow = (IVideoWindow)graphBuilder[i];
     
                Panel pan = null;
                if (i == 0)
                {
                    pan = this.panel1;
                }
                else
                {
                    pan = this.panel2;
                }
     
     
                //Set the owener of the videoWindow to an IntPtr of some sort (the Handle of any control - could be a form / button etc.)
                hr = videoWindow.put_Owner(pan.Handle);
                DsError.ThrowExceptionForHR(hr);
     
     
     
                //Set the style of the video window
                hr = videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipChildren);
                DsError.ThrowExceptionForHR(hr);
     
                // Position video window in client rect of main application window
                hr = videoWindow.SetWindowPosition(0, 0,pan.Width, pan.Height);
                DsError.ThrowExceptionForHR(hr);
     
                // Make the video window visible
                hr = videoWindow.put_Visible(OABool.True);
                DsError.ThrowExceptionForHR(hr);
    qu'est ce qui manque pour pouvoir afficher ma capture ?

    Dans graphedit un start et c'est ok.

Discussions similaires

  1. Filtre DirectShow
    Par masterfangorn dans le forum DirectX
    Réponses: 4
    Dernier message: 23/05/2003, 14h57
  2. interfaces pour Filtres DirectShow
    Par Chupakabra dans le forum DirectX
    Réponses: 1
    Dernier message: 23/05/2003, 14h54
  3. Gros Problème avec DirectShow et la méthode RELEASE
    Par Olivier Delmotte dans le forum DirectX
    Réponses: 3
    Dernier message: 10/03/2003, 18h10
  4. directshow
    Par bud1703 dans le forum DirectX
    Réponses: 1
    Dernier message: 02/03/2003, 23h50
  5. Tutoriaux DirectShow
    Par Olivier Delmotte dans le forum DirectX
    Réponses: 2
    Dernier message: 22/02/2003, 14h18

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