Click here to Skip to main content
15,890,882 members
Home / Discussions / C#
   

C#

 
GeneralABOUT MARSHAL IN MC++ Pin
novachen8-Dec-02 19:24
novachen8-Dec-02 19:24 
GeneralRe: ABOUT MARSHAL IN MC++ Pin
David Stone9-Dec-02 8:46
sitebuilderDavid Stone9-Dec-02 8:46 
GeneralRe: ABOUT MARSHAL IN MC++ Pin
Nick Parker9-Dec-02 9:52
protectorNick Parker9-Dec-02 9:52 
GeneralRe: ABOUT MARSHAL IN MC++ Pin
novachen9-Dec-02 14:39
novachen9-Dec-02 14:39 
GeneralRe: ABOUT MARSHAL IN MC++ Pin
Nick Parker9-Dec-02 16:23
protectorNick Parker9-Dec-02 16:23 
GeneralSending Mail With Attachment With Web Service Problem Pin
yccheok8-Dec-02 18:03
yccheok8-Dec-02 18:03 
GeneralRe: Sending Mail With Attachment With Web Service Problem Pin
David Stone9-Dec-02 8:44
sitebuilderDavid Stone9-Dec-02 8:44 
GeneralWeb Cam Handle Still Hold By WMEncoder After Stop Called Pin
yccheok8-Dec-02 17:46
yccheok8-Dec-02 17:46 
previously, i had an application that use a COM object to grap image from web cam. i try to enhance my application by using the Windows Media Encoder 9 Series SDK to do live video streaming.

i realize that whenever i stop my image capturing thread and run WM live video streaming thread, my application has no problem at all the access the web cam device. however, whenever i try to stop WM live video streaming thread, the COM object unable the use the web cam device. it seems that the camera device still hold by the WM thread. the WM thread goes like this......
-----------------------------------------------------------------------
public void StartWM()
{
if(WMThread != null)
{
if(WMThread.IsAlive)
{
StopWM();
}
}

if(cameraThread != null)
{
if(cameraThread.IsAlive)
{
StopCamera();
}
}

WMThread = new Thread(new ThreadStart(_StartWM));
WMThread.Priority = ThreadPriority.Lowest;
WMThread.Start();
}

public void StopCamera()
{
if(cameraThread != null)
{
cameraThread.Abort();
while(cameraThread.IsAlive);
cameraThread = null;
}
}

public void StopWM()
{
if(WMThread != null)
{
WMThread.Abort();
while(WMThread.IsAlive);
WMThread = null;
}

if(Encoder != null)
{
Encoder.Stop();
//HOW TO MAKE SURE ENCODER
//IS COMPLETELY RELEASE ITS //WEB CAM DEVIDE HANDLE
//BEFORE IT PROCEEDS TO
//NEXT //STATEMET???????
//while(Encoder.IsAlive); <-
//- of course this
//wont work Smile | :)
Encoder = null;
}
}

private void _StartWM()
{
try
{
// Create WMEncoderApp and WMEncoder objects.
if(Encoder == null)
{
Encoder = new WMEncoder();
}


//encoder initialize
//code goes here for live
//video
//broadcasting

//Start the encoding
//process.
Encoder.PrepareToEncode(true);
Encoder.SynchronizeOperation = false;
Encoder.Start();
}
catch(Exception ex){}
}

-----------------------------------------------------------------------
whenever i wish to start the camera thread, i must first make sure the wm thread first release its handle to web cam. hence, i used to call StartCamera.

public void StartCamera()
{
if(WMThread != null)
{
if(WMThread.IsAlive)
{
StopWM();
}
}

if(cameraThread != null)
{
if(cameraThread.IsAlive)
{
StopCamera();
}
}

cameraThread = new Thread(new ThreadStart(_StartCamera));
cameraThread.Priority = ThreadPriority.Lowest;
cameraThread.Start();
}
-----------------------------------------------------------------------

inside _StartCamera, i will construct a camera COM object and capture image using that COM object. however, the COM object unable the use the web cam device whenever it wants to grap image Frown | :(

i suspect that the web cam is still hold by encoder. how can i make sure web cam is released by encoder after i call Encoder.Stop()?

thank you.

regards
yccheok
GeneralHalt At Socket.Receive() Statement Pin
yccheok8-Dec-02 16:50
yccheok8-Dec-02 16:50 
QuestionHow to invoke DLL in C# Pin
Anonymous8-Dec-02 14:02
Anonymous8-Dec-02 14:02 
AnswerRe: How to invoke DLL in C# Pin
Eric Gunnerson (msft)9-Dec-02 12:46
Eric Gunnerson (msft)9-Dec-02 12:46 
GeneralProblem with double buffering in GDI+ Pin
djkno38-Dec-02 11:04
djkno38-Dec-02 11:04 
GeneralRe: Problem with double buffering in GDI+ Pin
Nick Parker8-Dec-02 12:16
protectorNick Parker8-Dec-02 12:16 
GeneralRe: Problem with double buffering in GDI+ Pin
djkno38-Dec-02 12:39
djkno38-Dec-02 12:39 
GeneralRe: Problem with double buffering in GDI+ Pin
Jon Rista8-Dec-02 13:08
Jon Rista8-Dec-02 13:08 
GeneralLooking for samples how to write an IRC client in C# Pin
gicio8-Dec-02 10:17
gicio8-Dec-02 10:17 
GeneralRe: Looking for samples how to write an IRC client in C# Pin
leppie9-Dec-02 8:18
leppie9-Dec-02 8:18 
GeneralTreeView Context menus Pin
Dave Kerr8-Dec-02 5:36
Dave Kerr8-Dec-02 5:36 
GeneralRe: TreeView Context menus Pin
leppie8-Dec-02 9:58
leppie8-Dec-02 9:58 
Generaltotal beginner Pin
GaryR8-Dec-02 1:13
GaryR8-Dec-02 1:13 
GeneralRe: total beginner Pin
joan_fl8-Dec-02 2:18
joan_fl8-Dec-02 2:18 
GeneralRe: total beginner Pin
GaryR8-Dec-02 4:15
GaryR8-Dec-02 4:15 
Generalresource bitmap to imagelist Pin
peterchen8-Dec-02 0:10
peterchen8-Dec-02 0:10 
GeneralRe: resource bitmap to imagelist Pin
Jon Rista8-Dec-02 13:51
Jon Rista8-Dec-02 13:51 
GeneralCollections and the Collection Editor Pin
Dave Kerr7-Dec-02 23:57
Dave Kerr7-Dec-02 23:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.