/// <summary> /// Configures the SmartCapture device to output the given image size. /// </summary> /// <param name="size">Supports CIF and 4CIF</param> private void SetImageSize(VideoImageSize size) { if (_deviceContext == IntPtr.Zero) { throw new ArgumentNullException("DeviceContext"); } int width; int height; switch (size) { case VideoImageSize.CIF: width = 352; height = 240; AppLogger.Message("ImageSize CIF"); break; case VideoImageSize.FourCIF: width = 704; height = 480; AppLogger.Message("ImageSize FourCIF"); break; default: throw new ArgumentException(size.ToString(), "ImageSize"); } if (NativeMethods.SCSetVideoFrameSize(_deviceContext, width, height) != 1) { throw new Exception("SCSetVideoFrameSize failed"); } Thread.Sleep(300); }
/// <summary> /// Helper method to retrieve a stream with a video conver image /// </summary> public Stream GetVideoImage(String imageId, String imagePath, VideoImageSize size) { var w = 750; var h = 500; if (!RestUtility.ParseImageSize(size.ToString(), out w, out h)) { throw new ArgumentException("Invalid image size", "size"); } String url = null; if (!String.IsNullOrEmpty(imageId)) { url = String.Format("http://resources.wimpmusic.com/images/{0}/{1}x{2}.jpg", imageId.Replace('-', '/'), w, h); } else { url = String.Format("http://images.tidalhifi.com/im/im?w={1}&h={2}&img={0}&noph", imagePath, w, h); } return(RestClient.GetStream(url)); }
/// <summary> /// Helper method to retrieve a stream with a video conver image /// </summary> public WebStreamModel GetVideoImage(String imageId, String imagePath, VideoImageSize size) { var w = 750; var h = 500; if (!RestUtility.ParseImageSize(size.ToString(), out w, out h)) throw new ArgumentException("Invalid image size", "size"); String url = null; if (!String.IsNullOrEmpty(imageId)) url = String.Format("http://resources.wimpmusic.com/images/{0}/{1}x{2}.jpg", imageId.Replace('-', '/'), w, h); else url = String.Format("http://images.tidalhifi.com/im/im?w={1}&h={2}&img={0}&noph", imagePath, w, h); return new WebStreamModel(RestClient.GetWebResponse(url)); }