2012-08-04 07:40:39 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <sstream>
|
2012-08-11 14:24:48 -05:00
|
|
|
#include <vector>
|
2012-08-04 07:40:39 -05:00
|
|
|
|
2012-08-11 14:24:48 -05:00
|
|
|
class VideoBuffer;
|
2012-08-12 16:32:57 -05:00
|
|
|
|
2012-08-04 07:40:39 -05:00
|
|
|
namespace format
|
|
|
|
{
|
2012-09-28 18:20:52 -05:00
|
|
|
static char hex[] = "0123456789ABCDEF";
|
|
|
|
|
2012-08-04 07:40:39 -05:00
|
|
|
template <typename T> std::string NumberToString(T number)
|
|
|
|
{
|
|
|
|
std::stringstream ss;
|
|
|
|
ss << number;
|
|
|
|
return ss.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T> T StringToNumber(const std::string & text)
|
|
|
|
{
|
|
|
|
std::stringstream ss(text);
|
|
|
|
T number;
|
|
|
|
return (ss >> number)?number:0;
|
|
|
|
}
|
|
|
|
|
2012-09-28 18:20:52 -05:00
|
|
|
std::string URLEncode(std::string value);
|
2012-08-04 07:40:39 -05:00
|
|
|
std::string UnixtimeToDate(time_t unixtime, std::string dateFomat = "%d %b %Y");
|
|
|
|
std::string UnixtimeToDateMini(time_t unixtime);
|
2012-12-08 18:14:48 -06:00
|
|
|
std::string CleanString(std::string dirtyString, int maxVisualSize, int maxStringLength);
|
|
|
|
std::string CleanString(std::string dirtyString, int maxStringLength = std::string::npos);
|
|
|
|
std::string CleanString(char * dirtyData, int maxVisualSize, int maxStringLength);
|
|
|
|
std::string CleanString(char * dirtyData, int maxStringLength);
|
2012-08-11 14:24:48 -05:00
|
|
|
std::vector<char> VideoBufferToPNG(const VideoBuffer & vidBuf);
|
2012-08-17 17:09:48 -05:00
|
|
|
std::vector<char> VideoBufferToPPM(const VideoBuffer & vidBuf);
|
2012-10-29 04:36:16 -05:00
|
|
|
std::vector<char> VideoBufferToPTI(const VideoBuffer & vidBuf);
|
2013-03-10 13:08:34 -05:00
|
|
|
VideoBuffer * PTIToVideoBuffer(std::vector<char> & data);
|
2012-08-11 14:24:48 -05:00
|
|
|
unsigned long CalculateCRC(unsigned char * data, int length);
|
2013-05-11 06:08:32 -05:00
|
|
|
}
|