2021-05-31 05:42:20 +00:00
|
|
|
//
|
2021-07-08 06:30:47 +00:00
|
|
|
// Copyright (c) 2013-2021 The SRS Authors
|
2021-05-31 05:42:20 +00:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
//
|
2014-04-07 01:34:36 +00:00
|
|
|
|
|
|
|
#ifndef SRS_APP_FFMPEG_HPP
|
|
|
|
#define SRS_APP_FFMPEG_HPP
|
|
|
|
|
|
|
|
#include <srs_core.hpp>
|
|
|
|
|
2020-04-29 12:02:28 +00:00
|
|
|
#ifdef SRS_FFMPEG_STUB
|
2014-04-07 01:34:36 +00:00
|
|
|
|
|
|
|
#include <vector>
|
2015-08-24 13:51:05 +00:00
|
|
|
#include <string>
|
2014-04-07 01:34:36 +00:00
|
|
|
|
|
|
|
class SrsConfDirective;
|
|
|
|
class SrsPithyPrint;
|
2015-08-24 13:51:05 +00:00
|
|
|
class SrsProcess;
|
2014-04-07 01:34:36 +00:00
|
|
|
|
2019-04-30 00:24:52 +00:00
|
|
|
// A transcode engine: ffmepg, used to transcode a stream to another.
|
2014-04-07 01:34:36 +00:00
|
|
|
class SrsFFMPEG
|
|
|
|
{
|
|
|
|
private:
|
2015-08-24 13:51:05 +00:00
|
|
|
SrsProcess* process;
|
|
|
|
std::vector<std::string> params;
|
2014-04-07 01:34:36 +00:00
|
|
|
private:
|
|
|
|
std::string log_file;
|
|
|
|
private:
|
|
|
|
std::string ffmpeg;
|
2020-02-05 04:32:15 +00:00
|
|
|
std::vector<std::string> iparams;
|
2017-01-06 02:39:37 +00:00
|
|
|
std::vector<std::string> perfile;
|
2014-07-19 02:54:38 +00:00
|
|
|
std::string iformat;
|
|
|
|
std::string input;
|
2014-04-07 02:15:44 +00:00
|
|
|
std::vector<std::string> vfilter;
|
2014-04-07 01:34:36 +00:00
|
|
|
std::string vcodec;
|
|
|
|
int vbitrate;
|
2014-04-07 02:15:44 +00:00
|
|
|
double vfps;
|
2014-04-07 01:34:36 +00:00
|
|
|
int vwidth;
|
|
|
|
int vheight;
|
|
|
|
int vthreads;
|
|
|
|
std::string vprofile;
|
|
|
|
std::string vpreset;
|
2014-04-07 02:15:44 +00:00
|
|
|
std::vector<std::string> vparams;
|
2014-04-07 01:34:36 +00:00
|
|
|
std::string acodec;
|
|
|
|
int abitrate;
|
|
|
|
int asample_rate;
|
|
|
|
int achannels;
|
2014-04-07 02:15:44 +00:00
|
|
|
std::vector<std::string> aparams;
|
2014-07-19 02:54:38 +00:00
|
|
|
std::string oformat;
|
2014-04-07 02:15:44 +00:00
|
|
|
std::string _output;
|
2014-04-07 01:34:36 +00:00
|
|
|
public:
|
|
|
|
SrsFFMPEG(std::string ffmpeg_bin);
|
|
|
|
virtual ~SrsFFMPEG();
|
|
|
|
public:
|
2020-02-05 04:32:15 +00:00
|
|
|
virtual void append_iparam(std::string iparam);
|
2014-07-19 07:20:16 +00:00
|
|
|
virtual void set_oformat(std::string format);
|
2014-04-07 02:15:44 +00:00
|
|
|
virtual std::string output();
|
|
|
|
public:
|
2018-01-01 11:39:57 +00:00
|
|
|
virtual srs_error_t initialize(std::string in, std::string out, std::string log);
|
|
|
|
virtual srs_error_t initialize_transcode(SrsConfDirective* engine);
|
|
|
|
virtual srs_error_t initialize_copy();
|
2015-08-24 13:51:05 +00:00
|
|
|
public:
|
2018-01-01 11:39:57 +00:00
|
|
|
virtual srs_error_t start();
|
|
|
|
virtual srs_error_t cycle();
|
2014-04-07 01:34:36 +00:00
|
|
|
virtual void stop();
|
2015-05-30 03:25:33 +00:00
|
|
|
public:
|
|
|
|
virtual void fast_stop();
|
2020-01-29 12:22:28 +00:00
|
|
|
virtual void fast_kill();
|
2014-04-07 01:34:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
2014-08-02 14:18:39 +00:00
|
|
|
|