我的MjpegProcessor
库存在问题。在我的c#控制台应用程序中,永远不会调用Mjpeg_FrameReady
方法。
如果我调试应用程序,则流是打开的,但控制台中没有任何反应。
using System;
using System.Text;
using System.Threading;
using MjpegProcessor;
using System.Drawing;
namespace Server
{
internal class StreamHandler
{
private MjpegDecoder _mjpeg;
public StreamHandler()
{
Thread handler = new Thread(StartHandler);
handler.Start();
}
private void StartHandler()
{
_mjpeg = new MjpegDecoder();
_mjpeg.FrameReady += Mjpeg_FrameReady;
_mjpeg.Error += Mjpeg_Error;
_mjpeg.ParseStream(new Uri("http://172.0.0.1/mjpg/video.mjpg"), "edv", "edv1bkt");
}
private void Mjpeg_Error(object sender, ErrorEventArgs e)
{
Console.WriteLine(e.Message);
}
private void Mjpeg_FrameReady(object sender, FrameReadyEventArgs e)
{
Bitmap image = e.Bitmap;
Console.WriteLine(image);
}
}
}
是否需要Windows窗体上下文?