public string ProcessVideo(string videoFilename, bool search = true, bool onDemand = true, bool keepFrames = false) { string statusMsg = ""; LayerB layerB = new LayerB(videoFilename, search, searchServerAddress); //TODO: ensure that search server address is not null try { statusMsg = layerB.Process(onDemand, keepFrames); } catch (Exception err) { statusMsg = err.Message; } return(statusMsg); }
//call-back method that polls queue to get filename and search/store parameter static void timer_queuePoll_Elapsed(object sender, ElapsedEventArgs e) { timer_queuePoll.Enabled = false; List <string> items = new List <string>(); //although queue set to currently return one item List <string> item_handles = new List <string>(); string statusMsg = ""; //get video filename from sqs queue item_handles = CloudServices.CloudServices.GetObjects(ref items, ref statusMsg); //check error if (statusMsg != "") { LogManager.Write(statusMsg, "ERROR"); timer_queuePoll.Enabled = false; return; } /* decode item and get videofilename and search/store parameter, then proess it */ string videoFilename; bool isSearch; for (int i = 0; i < items.Count; i++) { string item = items[0]; //video filename videoFilename = item.Substring(0, item.IndexOf("\n")); //to search or to store? string srch = item.Substring(item.IndexOf("\n") + 1, 1); if (srch == "1") { isSearch = true; } else { isSearch = false; } //item handle string itemHandle = item_handles[i]; //process video LayerB layerB = new LayerB(videoFilename, isSearch, searchServerAdress); try { //process layerB.Process(); //remove from queue CloudServices.CloudServices.RemoveObject(itemHandle, ref statusMsg); } catch (Exception err) { statusMsg = err.Message; } } //done processing (if item was in recevived from queue). Enable timer for next poll timer_queuePoll.Enabled = true; }