Bonjour,
je viens de réaliser un petit programme destiné à afficher une webcam dans un panel et ceci en utilisant la librairie DirectShowLib; Pour ce faire je me suis largement inspiré d'un programme utilisant DShowNET;
Mon programme comporte une ou plusieurs erreur que je n'arrive pas à identifier. Pouuriez-vous m'aider
Par avance merci

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
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DirectShowLib;
using System.Runtime.InteropServices.ComTypes;
 
namespace gestion_cam
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
 
            //déclarations des variables
            DsDevice[] listeCaptureVideo;
            IMoniker monikerCapture;
            IBaseFilter _filtreEntree;
            IGraphBuilder _grapheBuilder;
            ICaptureGraphBuilder2 _captureGraphe;
            Type type;
            Object objetCOM;
            Object objetLien;
            IMediaControl _controle;
 
 
            // recherche de la cam
            listeCaptureVideo = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
 
             monikerCapture = listeCaptureVideo[1].Mon;
 
            // lien entre le moniker et objetLien
            Guid guide = typeof(IBaseFilter).GUID;
            monikerCapture.BindToObject(null, null, ref guide, out objetLien);
 
            // lien entre moniker et le filtre d'entrée via objectlien
 
            _filtreEntree = (IBaseFilter)objetLien;
 
           // création du filtregraph
 
            type = typeof(FilterGraph);
            objetCOM = Activator.CreateInstance(type);
            _grapheBuilder = (IGraphBuilder)objetCOM;
 
            // création du Capturegraph
 
            type = typeof(CaptureGraphBuilder2);
            objetCOM = Activator.CreateInstance(type);
            _captureGraphe = (ICaptureGraphBuilder2)objetCOM;
 
            // affectation du graphbuilder au capturegraphe
 
            int hh = _captureGraphe.SetFiltergraph(_grapheBuilder);
 
 
                  textBox1.Text = Convert.ToString(hh);
 
 
            hh = _captureGraphe.RenderStream(PinCategory.Capture,MediaType.Video, _filtreEntree, null, null);
 
           IVideoWindow video;
            video = (IVideoWindow)_grapheBuilder;
 
            video.put_Owner(panel1.Handle);
            hh = video.SetWindowPosition(0, 0, panel1.Width, panel1.Height);
                  textBox1.Text = Convert.ToString(hh);
            video.put_WindowStyle(WindowStyle.Maximize);
            _controle = (IMediaControl)_grapheBuilder;
            hh = _controle.Run();
 
 
 
        }
    }
}