Commit 77987aba authored by Stefan Westerfeld's avatar Stefan Westerfeld

Support "-" as filename for hls-mark, to use stdin as input.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 88c5fbba
...@@ -275,11 +275,23 @@ TSReader::parse_header (Header& header, vector<unsigned char>& data) ...@@ -275,11 +275,23 @@ TSReader::parse_header (Header& header, vector<unsigned char>& data)
Error Error
TSReader::load (const string& inname) TSReader::load (const string& inname)
{ {
if (inname == "-")
{
return load (stdin);
}
else
{
FILE *infile = fopen (inname.c_str(), "r"); FILE *infile = fopen (inname.c_str(), "r");
ScopedFile infile_s (infile); ScopedFile infile_s (infile);
if (!infile) if (!infile)
return Error (string_printf ("error opening input .ts '%s'", inname.c_str())); return Error (string_printf ("error opening input .ts '%s'", inname.c_str()));
return load (infile);
}
}
Error
TSReader::load (FILE *infile)
{
vector<unsigned char> awmk_stream; vector<unsigned char> awmk_stream;
Header header; Header header;
bool header_valid = false; bool header_valid = false;
......
...@@ -34,6 +34,7 @@ private: ...@@ -34,6 +34,7 @@ private:
}; };
std::vector<Entry> m_entries; std::vector<Entry> m_entries;
bool parse_header (Header& header, std::vector<unsigned char>& data); bool parse_header (Header& header, std::vector<unsigned char>& data);
Error load (FILE *infile);
public: public:
Error load (const std::string& inname); Error load (const std::string& inname);
const std::vector<Entry>& entries(); const std::vector<Entry>& entries();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment