Permalink
Browse files

torc-utils: Add torcutils files.

  • Loading branch information...
1 parent ad635f7 commit 5ca8f7dd47ca5e04c9c19d4f75c3c89f2c706e10 @mark-kendall mark-kendall committed Oct 7, 2012
Showing with 43 additions and 0 deletions.
  1. +30 −0 programs/torc-utils/torcutils.cpp
  2. +13 −0 programs/torc-utils/torcutils.h
@@ -0,0 +1,30 @@
+// Torc
+#include "torcexitcodes.h"
+#include "torcdecoder.h"
+#include "torcutils.h"
+
+int TorcUtils::Probe(const UtilsCommandLineParser *Cmdline)
+{
+ if (!Cmdline)
+ return GENERIC_EXIT_NOT_OK;
+
+ QString uri = Cmdline->ToString("infile");
+
+ if (uri.isEmpty())
+ return GENERIC_EXIT_INVALID_CMDLINE;
+
+ int flags = TorcDecoder::DecodeNone;
+ TorcDecoder* decoder = new TorcDecoder(uri, flags);
+ if (decoder->Open())
+ {
+ while (!(decoder->State() == TorcDecoder::Stopped ||
+ decoder->State() == TorcDecoder::Paused ||
+ decoder->State() == TorcDecoder::Errored))
+ {
+ usleep(50000);
+ }
+ }
+
+ delete decoder;
+ return GENERIC_EXIT_OK;
+}
@@ -0,0 +1,13 @@
+#ifndef TORCUTILS_H
+#define TORCUTILS_H
+
+// Torc
+#include "utilscommandlineparser.h"
+
+class TorcUtils
+{
+ public:
+ static int Probe(const UtilsCommandLineParser *Cmdline);
+};
+
+#endif // TORCUTILS_H

0 comments on commit 5ca8f7d

Please sign in to comment.