FFmpegfs Fuse Multi Media Filesystem 2.16
Classes | Macros | Typedefs | Enumerations | Functions | Variables
ffmpegfs.cc File Reference

FFmpeg main function and utilities implementation. More...

#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavfilter/avfilter.h>
#include "ffmpegfs.h"
#include "logging.h"
#include "ffmpegfshelp.h"
#include <sys/sysinfo.h>
#include <sqlite3.h>
#include <unistd.h>
#include <fnmatch.h>
#include <iostream>
#include <libbluray/bluray-version.h>
Include dependency graph for ffmpegfs.cc:

Go to the source code of this file.

Classes

struct  HWACCEL
 Hardware acceleration device and type. More...
 

Macros

#define FFMPEGFS_OPT(templ, param, value)   { templ, offsetof(FFMPEGFS_PARAMS, param), value }
 

Typedefs

typedef std::map< const std::string, const AUTOCOPY, compAUTOCOPY_MAP
 Map command line option to AUTOCOPY enum. More...
 
typedef std::map< const std::string, const PROFILE, compPROFILE_MAP
 Map command line option to PROFILE enum. More...
 
typedef std::map< const std::string, const PRORESLEVEL, compLEVEL_MAP
 Map command line option to LEVEL enum. More...
 
typedef std::map< const std::string, const RECODESAME, compRECODESAME_MAP
 Map command line option to RECODESAME enum. More...
 
typedef struct HWACCEL HWACCEL
 Hardware acceleration device and type. More...
 
typedef std::map< const std::string, HWACCEL, compHWACCEL_MAP
 Map command line option to HWACCEL struct. More...
 
typedef std::map< const std::string, const AVCodecID, compCODEC_MAP
 Map command line option to AVCodecID. More...
 
typedef std::map< const std::string, const SAMPLE_FMT, compSAMPLE_FMT_MAP
 Map command line option to SAMPLE_FMT. More...
 
typedef std::map< const std::string, const AVCodecID, compAUDIOCODEC_MAP
 Map command line option to audio AVCodecID. More...
 
typedef std::map< const std::string, const AVCodecID, compVIDEOCODEC_MAP
 Map command line option to video AVCodecID. More...
 

Enumerations

enum  {
  KEY_HELP , KEY_VERSION , KEY_FFMPEG_CAPS , KEY_KEEP_OPT ,
  KEY_DESTTYPE , KEY_AUDIOCODEC , KEY_VIDEOCODEC , KEY_AUDIO_BITRATE ,
  KEY_AUDIO_SAMPLERATE , KEY_AUDIO_CHANNELS , KEY_AUDIO_SAMPLE_FMT , KEY_VIDEO_BITRATE ,
  KEY_SEGMENT_DURATION , KEY_MIN_SEEK_TIME_DIFF , KEY_SCRIPTFILE , KEY_SCRIPTSOURCE ,
  KEY_EXPIRY_TIME , KEY_MAX_INACTIVE_SUSPEND_TIME , KEY_MAX_INACTIVE_ABORT_TIME , KEY_PREBUFFER_TIME ,
  KEY_PREBUFFER_SIZE , KEY_MAX_CACHE_SIZE , KEY_MIN_DISKSPACE_SIZE , KEY_CACHEPATH ,
  KEY_CACHE_MAINTENANCE , KEY_AUTOCOPY , KEY_RECODESAME , KEY_PROFILE ,
  KEY_LEVEL , KEY_LOG_MAXLEVEL , KEY_LOGFILE , KEY_HWACCEL_ENCODER_API ,
  KEY_HWACCEL_ENCODER_DEVICE , KEY_HWACCEL_DECODER_API , KEY_HWACCEL_DECODER_DEVICE , KEY_HWACCEL_DECODER_BLOCKED ,
  KEY_INCLUDE_EXTENSIONS , KEY_HIDE_EXTENSIONS
}
 

Functions

static int get_bitrate (const std::string &arg, BITRATE *bitrate)
 Get formatted bitrate. More...
 
static int get_samplerate (const std::string &arg, int *samplerate)
 Get formatted sample rate. More...
 
static int get_sampleformat (const std::string &arg, SAMPLE_FMT *sample_fmt)
 Get sample format. More...
 
static int get_time (const std::string &arg, time_t *time)
 Get formatted time,. More...
 
static int get_size (const std::string &arg, size_t *size)
 Read size:
. More...
 
static int get_desttype (const std::string &arg, FFMPEGFS_FORMAT_ARR &format)
 Get destination type. More...
 
static int get_audiocodec (const std::string &arg, AVCodecID *audio_codec)
 Get the audio codec. More...
 
static int get_videocodec (const std::string &arg, AVCodecID *video_codec)
 Get the video codec. More...
 
static int get_autocopy (const std::string &arg, AUTOCOPY *autocopy)
 Get autocopy option. More...
 
static int get_recodesame (const std::string &arg, RECODESAME *recode)
 Get recode option. More...
 
static int get_profile (const std::string &arg, PROFILE *profile)
 Get profile option. More...
 
static int get_level (const std::string &arg, PRORESLEVEL *level)
 Get ProRes level. More...
 
static int get_segment_duration (const std::string &arg, int64_t *value)
 Get HLS segment duration. Input value must be in seconds. More...
 
static int get_seek_time_diff (const std::string &arg, int64_t *value)
 Get seek time diff. Input value must be in seconds. More...
 
static int get_hwaccel (const std::string &arg, HWACCELAPI *hwaccel_API, AVHWDeviceType *hwaccel_device_type)
 Get type of hardware acceleration. To keep it simple, currently all values are accepted. More...
 
static int get_codec (const std::string &codec, AVCodecID *codec_id)
 Get AVCodecID for codec string. More...
 
static int get_hwaccel_dec_blocked (const std::string &arg, HWACCEL_BLOCKED_MAP **hwaccel_dec_blocked)
 Get list of codecs and optional profiles blocked for hardware accelerated decoding. More...
 
static int get_value (const std::string &arg, int *value)
 Get value from command line string. Finds whatever is after the "=" sign. More...
 
static int get_value (const std::string &arg, std::string *value)
 Get value from command line string. Finds whatever is after the "=" sign. More...
 
static int get_value (const std::string &arg, MATCHVEC *value)
 Get comma separated values from command line string. Finds whatever is after the "=" sign. More...
 
static int get_value (const std::string &arg, double *value)
 Get value from command line string. Finds whatever is after the "=" sign. More...
 
static int ffmpegfs_opt_proc (__attribute__((unused)) void *data, const char *arg, int key, struct fuse_args *outargs)
 FUSE option parsing function. More...
 
static bool set_defaults ()
 Set default values. More...
 
static void build_device_type_list ()
 Build list of available device types. Builds a list of device types supported by the current FFmpeg libary. More...
 
static void print_params ()
 Print currently selected parameters. More...
 
static void usage ()
 Print program usage info. More...
 
static void ffmpeg_log (void *ptr, int level, const char *fmt, va_list vl)
 Custom FFmpeg log function. Used with av_log_set_callback(). More...
 
static bool init_logging (const std::string &logfile, const std::string &max_level, bool to_stderr, bool to_syslog)
 Inititalise logging facility. More...
 
template<typename T >
static void list_options (const char *info, const T &map)
 Iterate through all elements in map print all keys. More...
 
std::string get_sampleformat_text (SAMPLE_FMT sample_fmt)
 Convert SAMPLE_FMT enum to human readable text. More...
 
std::string get_audio_codec_text (AVCodecID audio_codec)
 Convert AVCodecID enum for audio codec to human readable text. More...
 
std::string get_video_codec_text (AVCodecID video_codec)
 Convert AVCodecID enum for video codec to human readable text. More...
 
std::string get_autocopy_text (AUTOCOPY autocopy)
 Convert AUTOCOPY enum to human readable text. More...
 
std::string get_recodesame_text (RECODESAME recode)
 Convert RECODESAME enum to human readable text. More...
 
std::string get_profile_text (PROFILE profile)
 Convert PROFILE enum to human readable text. More...
 
std::string get_level_text (PRORESLEVEL level)
 Convert PRORESLEVEL enum to human readable text. More...
 
bool check_hwaccel_dec_blocked (AVCodecID codec_id, int profile)
 Check if codec_id and the optional profile are in the block list. More...
 
std::string get_hwaccel_API_text (HWACCELAPI hwaccel_API)
 Get the selected hardware acceleration as text. More...
 
int main (int argc, char *argv[])
 Main program entry point. More...
 

Variables

FFMPEGFS_FORMAT_ARR ffmpeg_format
 Two FFmpegfs_Format infos, 0: video file, 1: audio file. More...
 
FFMPEGFS_PARAMS params
 FFmpegfs command line parameters. More...
 
static struct fuse_opt ffmpegfs_opts []
 
static const AUDIOCODEC_MAP audiocodec_map
 List of audio codecs. More...
 
static const VIDEOCODEC_MAP videocodec_map
 List of video codecs. More...
 
static const AUTOCOPY_MAP autocopy_map
 
static const PROFILE_MAP profile_map
 
static const LEVEL_MAP prores_level_map
 
static const RECODESAME_MAP recode_map
 
static HWACCEL_MAP hwaccel_map
 
static const CODEC_MAP hwaccel_codec_map
 
static const SAMPLE_FMT_MAP sample_fmt_map
 

Detailed Description

FFmpeg main function and utilities implementation.

Author
Norbert Schlia (nschl.nosp@m.ia@o.nosp@m.blivi.nosp@m.on-s.nosp@m.oftwa.nosp@m.re.d.nosp@m.e)

Definition in file ffmpegfs.cc.

Macro Definition Documentation

◆ FFMPEGFS_OPT

#define FFMPEGFS_OPT (   templ,
  param,
  value 
)    { templ, offsetof(FFMPEGFS_PARAMS, param), value }

Map FFmpegfs options to FUSE parameters

Definition at line 290 of file ffmpegfs.cc.

Typedef Documentation

◆ AUDIOCODEC_MAP

typedef std::map<const std::string, const AVCodecID, comp> AUDIOCODEC_MAP

Map command line option to audio AVCodecID.

Definition at line 447 of file ffmpegfs.cc.

◆ AUTOCOPY_MAP

typedef std::map<const std::string, const AUTOCOPY, comp> AUTOCOPY_MAP

Map command line option to AUTOCOPY enum.

Definition at line 431 of file ffmpegfs.cc.

◆ CODEC_MAP

typedef std::map<const std::string, const AVCodecID, comp> CODEC_MAP

Map command line option to AVCodecID.

Definition at line 444 of file ffmpegfs.cc.

◆ HWACCEL

typedef struct HWACCEL HWACCEL

Hardware acceleration device and type.

<

◆ HWACCEL_MAP

typedef std::map<const std::string, HWACCEL, comp> HWACCEL_MAP

Map command line option to HWACCEL struct.

Definition at line 443 of file ffmpegfs.cc.

◆ LEVEL_MAP

typedef std::map<const std::string, const PRORESLEVEL, comp> LEVEL_MAP

Map command line option to LEVEL enum.

Definition at line 433 of file ffmpegfs.cc.

◆ PROFILE_MAP

typedef std::map<const std::string, const PROFILE, comp> PROFILE_MAP

Map command line option to PROFILE enum.

Definition at line 432 of file ffmpegfs.cc.

◆ RECODESAME_MAP

typedef std::map<const std::string, const RECODESAME, comp> RECODESAME_MAP

Map command line option to RECODESAME enum.

Definition at line 434 of file ffmpegfs.cc.

◆ SAMPLE_FMT_MAP

typedef std::map<const std::string, const SAMPLE_FMT, comp> SAMPLE_FMT_MAP

Map command line option to SAMPLE_FMT.

Definition at line 445 of file ffmpegfs.cc.

◆ VIDEOCODEC_MAP

typedef std::map<const std::string, const AVCodecID, comp> VIDEOCODEC_MAP

Map command line option to video AVCodecID.

Definition at line 448 of file ffmpegfs.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition at line 244 of file ffmpegfs.cc.

Function Documentation

◆ build_device_type_list()

static void build_device_type_list ( )
static

Build list of available device types. Builds a list of device types supported by the current FFmpeg libary.

Definition at line 2028 of file ffmpegfs.cc.

References hwaccel_map.

Referenced by main().

◆ check_hwaccel_dec_blocked()

bool check_hwaccel_dec_blocked ( AVCodecID  codec_id,
int  profile 
)

Check if codec_id and the optional profile are in the block list.

Parameters
[in]codec_id- Codec ID to check
[in]profile- Profile to check. Set to FF_PROFILE_UNKOWN to ignore.
Returns
Returns true if codec is in block list, false if not.

Definition at line 1585 of file ffmpegfs.cc.

References FFMPEGFS_PARAMS::m_hwaccel_dec_blocked, and params.

Referenced by FFmpeg_Transcoder::open_decoder().

◆ ffmpeg_log()

static void ffmpeg_log ( void *  ptr,
int  level,
const char *  fmt,
va_list  vl 
)
static

Custom FFmpeg log function. Used with av_log_set_callback().

Parameters
[in]ptr- See av_log_set_callback() in FFmpeg API.
[in]level- See av_log_set_callback() in FFmpeg API.
[in]fmt- See av_log_set_callback() in FFmpeg API.
[in]vl- See av_log_set_callback() in FFmpeg API.

Definition at line 2158 of file ffmpegfs.cc.

References Logging::log_with_level(), LOGDEBUG, LOGERROR, LOGTRACE, LOGWARN, Logging::show(), and strsprintf().

Referenced by main().

◆ ffmpegfs_opt_proc()

static int ffmpegfs_opt_proc ( __attribute__((unused)) void *  data,
const char *  arg,
int  key,
struct fuse_args *  outargs 
)
static

FUSE option parsing function.

Parameters
[in]data- is the user data passed to the fuse_opt_parse() function
[in]arg- is the whole argument or option
[in]key- determines why the processing function was called
[in]outargs- the current output argument list
Returns
-1 on error, 0 if arg is to be discarded, 1 if arg should be kept

Definition at line 1757 of file ffmpegfs.cc.

References append_sep(), docker_client, expand_path(), is_mount(), FFMPEGFS_PARAMS::m_basepath, FFMPEGFS_PARAMS::m_mountpath, params, and sanitise_filepath().

Referenced by main().

◆ get_audio_codec_text()

std::string get_audio_codec_text ( AVCodecID  audio_codec)

Convert AVCodecID enum for audio codec to human readable text.

Parameters
[in]audio_codec- AVCodecID enum value to convert.
Returns
AVCodecID as text or "INVALID" if not known.

Definition at line 1236 of file ffmpegfs.cc.

References audiocodec_map, and search_by_value().

Referenced by Format_Options::audio_codec_list().

◆ get_audiocodec()

static int get_audiocodec ( const std::string &  arg,
AVCodecID *  audio_codec 
)
static

Get the audio codec.

Parameters
[in]arg- One of the possible audio codecs.
[out]audio_codec- Upon return contains selected AVCodecID enum.
Returns
Returns 0 if found; if not found returns -1.

Definition at line 1130 of file ffmpegfs.cc.

References audiocodec_map, and list_options().

◆ get_autocopy()

static int get_autocopy ( const std::string &  arg,
AUTOCOPY autocopy 
)
static

Get autocopy option.

Parameters
[in]arg- One of the auto copy options.
[out]autocopy- Upon return contains selected AUTOCOPY enum.
Returns
Returns 0 if found; if not found returns -1.

Definition at line 1206 of file ffmpegfs.cc.

References autocopy_map, and list_options().

◆ get_autocopy_text()

std::string get_autocopy_text ( AUTOCOPY  autocopy)

Convert AUTOCOPY enum to human readable text.

Parameters
[in]autocopy- AUTOCOPY enum value to convert.
Returns
AUTOCOPY enum as text or "INVALID" if not known.

Definition at line 1256 of file ffmpegfs.cc.

References autocopy_map, and search_by_value().

◆ get_bitrate()

static int get_bitrate ( const std::string &  arg,
BITRATE bitrate 
)
static

Get formatted bitrate.

Supported formats:
In bit/s:  #  or #bps
In kbit/s: #M or #Mbps
In Mbit/s: #M or #Mbps
Parameters
[in]arg- Bitrate as string.
[in]bitrate- On return, contains parsed bitrate.
Returns
Returns 0 if valid; if invalid returns -1.

Definition at line 707 of file ffmpegfs.cc.

References BITRATE, and reg_compare().

◆ get_codec()

static int get_codec ( const std::string &  codec,
AVCodecID *  codec_id 
)
static

Get AVCodecID for codec string.

Parameters
[in]codec- Codec string
[out]codec_id- AVCodecID of codec string
Returns
Returns 0 if found; if not found returns -1 and codec_id set to AV_CODEC_ID_NONE.

Definition at line 1509 of file ffmpegfs.cc.

References hwaccel_codec_map, and list_options().

Referenced by get_hwaccel_dec_blocked().

◆ get_desttype()

static int get_desttype ( const std::string &  arg,
FFMPEGFS_FORMAT_ARR format 
)
static

Get destination type.

Parameters
[in]arg- Format as string (MP4, OGG etc.).
[out]format- Index 0: Selected video format.
Index 1: Selected audio format.
Returns
Returns 0 if found; if not found returns -1.

Definition at line 1076 of file ffmpegfs.cc.

References split().

◆ get_hwaccel()

static int get_hwaccel ( const std::string &  arg,
HWACCELAPI hwaccel_API,
AVHWDeviceType *  hwaccel_device_type 
)
static

Get type of hardware acceleration. To keep it simple, currently all values are accepted.

Parameters
[in]arg- One of the hardware acceleration types, e.g. VAAPI.
[out]hwaccel_API- Upon return contains the hardware acceleration API.
[out]hwaccel_device_type- Upon return contains the hardware acceleration device type.
Returns
Returns 0 if found; if not found returns -1.

Definition at line 1465 of file ffmpegfs.cc.

References hwaccel_map, list_options(), HWACCEL::m_hwaccel_API, HWACCEL::m_hwaccel_device_type, and HWACCEL::m_supported.

◆ get_hwaccel_API_text()

std::string get_hwaccel_API_text ( HWACCELAPI  hwaccel_API)

Get the selected hardware acceleration as text.

Parameters
[in]hwaccel_API- Hardware acceleration buffering API.
Returns
Hardware acceleration API as string.

Definition at line 1603 of file ffmpegfs.cc.

References hwaccel_map.

Referenced by FFmpeg_Transcoder::add_stream(), FFmpeg_Transcoder::open_bestmatch_video(), and FFmpeg_Transcoder::open_decoder().

◆ get_hwaccel_dec_blocked()

static int get_hwaccel_dec_blocked ( const std::string &  arg,
HWACCEL_BLOCKED_MAP **  hwaccel_dec_blocked 
)
static

Get list of codecs and optional profiles blocked for hardware accelerated decoding.

Parameters
[in]arg- Parameter with codec string and optional profile
[out]hwaccel_dec_blocked- Map with blocked codecs and profiles. Will be allocated if necessary.
Returns
Returns 0 on success; on error returns -1.

Definition at line 1534 of file ffmpegfs.cc.

References get_codec().

◆ get_level()

static int get_level ( const std::string &  arg,
PRORESLEVEL level 
)
static

Get ProRes level.

Parameters
[in]arg- One of the ProRes levels.
[out]level- Upon return contains selected PRORESLEVEL enum.
Returns
Returns 0 if found; if not found returns -1.

Definition at line 1365 of file ffmpegfs.cc.

References list_options(), and prores_level_map.

◆ get_level_text()

std::string get_level_text ( PRORESLEVEL  level)

Convert PRORESLEVEL enum to human readable text.

Parameters
[in]level- PRORESLEVEL enum value to convert.
Returns
PRORESLEVEL enum as text or "INVALID" if not known.

Definition at line 1396 of file ffmpegfs.cc.

References prores_level_map, and search_by_value().

◆ get_profile()

static int get_profile ( const std::string &  arg,
PROFILE profile 
)
static

Get profile option.

Parameters
[in]arg- One of the auto profile options.
[out]profile- Upon return contains selected PROFILE enum.
Returns
Returns 0 if found; if not found returns -1.

Definition at line 1318 of file ffmpegfs.cc.

References list_options(), and profile_map.

◆ get_profile_text()

std::string get_profile_text ( PROFILE  profile)

Convert PROFILE enum to human readable text.

Parameters
[in]profile- PROFILE enum value to convert.
Returns
PROFILE enum as text or "INVALID" if not known.

Definition at line 1348 of file ffmpegfs.cc.

References profile_map, and search_by_value().

◆ get_recodesame()

static int get_recodesame ( const std::string &  arg,
RECODESAME recode 
)
static

Get recode option.

Parameters
[in]arg- One of the recode options.
[out]recode- Upon return contains selected RECODESAME enum.
Returns
Returns 0 if found; if not found returns -1.

Definition at line 1272 of file ffmpegfs.cc.

References list_options(), and recode_map.

◆ get_recodesame_text()

std::string get_recodesame_text ( RECODESAME  recode)

Convert RECODESAME enum to human readable text.

Parameters
[in]recode- RECODESAME enum value to convert.
Returns
RECODESAME enum as text or "INVALID" if not known.

Definition at line 1302 of file ffmpegfs.cc.

References recode_map, and search_by_value().

◆ get_sampleformat()

static int get_sampleformat ( const std::string &  arg,
SAMPLE_FMT sample_fmt 
)
static

Get sample format.

Parameters
[in]arg- Sample format as string.
[in]sample_fmt- On return, contains parsed sample format.
Returns
Returns 0 if valid; if invalid returns -1.

Definition at line 827 of file ffmpegfs.cc.

References FMT_DONTCARE, list_options(), and sample_fmt_map.

◆ get_sampleformat_text()

std::string get_sampleformat_text ( SAMPLE_FMT  sample_fmt)

Convert SAMPLE_FMT enum to human readable text.

Returns
SAMPLE_FMT enum as text or "INVALID" if not known.

Definition at line 861 of file ffmpegfs.cc.

References sample_fmt_map, and search_by_value().

Referenced by Format_Options::sample_fmt_list().

◆ get_samplerate()

static int get_samplerate ( const std::string &  arg,
int *  samplerate 
)
static

Get formatted sample rate.

Supported formats:
In Hz:  #  or #Hz
In kHz: #K or #KHz
Parameters
[in]arg- Samplerate as string.
[in]samplerate- On return, contains parsed sample rate.
Returns
Returns 0 if valid; if invalid returns -1.

Definition at line 775 of file ffmpegfs.cc.

References reg_compare().

◆ get_seek_time_diff()

static int get_seek_time_diff ( const std::string &  arg,
int64_t *  value 
)
static

Get seek time diff. Input value must be in seconds.

Parameters
[in]arg- Segment duration in seconds. Must be greater or equal 0.
[out]value- Upon return contains seek time diff in AV_TIME_BASE units.
Returns
Returns 0 if valid; if out of range returns -1.

Definition at line 1437 of file ffmpegfs.cc.

References get_value().

◆ get_segment_duration()

static int get_segment_duration ( const std::string &  arg,
int64_t *  value 
)
static

Get HLS segment duration. Input value must be in seconds.

Parameters
[in]arg- Segment duration in seconds. Must be greater than 0.
[out]value- Upon return contains segment duration in AV_TIME_BASE units.
Returns
Returns 0 if valid; if out of range returns -1.

Definition at line 1412 of file ffmpegfs.cc.

References get_value().

◆ get_size()

static int get_size ( const std::string &  arg,
size_t *  size 
)
static

Read size:
.

Supported formats:
In bytes:  # or #B @n
In KBytes: #K or #KB @n
In MBytes: #B or #MB @n
In GBytes: #G or #GB @n
In TBytes: #T or #TB
Parameters
[in]arg- Time as string.
[out]size- On return, contains parsed size.
Returns
Returns 0 if valid; if invalid returns -1.

Definition at line 984 of file ffmpegfs.cc.

References reg_compare().

◆ get_time()

static int get_time ( const std::string &  arg,
time_t *  time 
)
static

Get formatted time,.

Supported formats:
Seconds: # @n
Minutes: #m @n
Hours:   #h @n
Days:    #d @n
Weeks:   #w
Parameters
[in]arg- Time as string.
[in]time- On return, contains parsed time.
Returns
Returns 0 if valid; if invalid returns -1.

Definition at line 885 of file ffmpegfs.cc.

References reg_compare().

◆ get_value() [1/4]

static int get_value ( const std::string &  arg,
double *  value 
)
static

Get value from command line string. Finds whatever is after the "=" sign.

Parameters
[in]arg- Command line option.
[in]value- Upon return, contains the value after the "=" sign.
Returns
Returns 0 if valid; if invalid returns -1.

Definition at line 1733 of file ffmpegfs.cc.

◆ get_value() [2/4]

static int get_value ( const std::string &  arg,
int *  value 
)
static

Get value from command line string. Finds whatever is after the "=" sign.

Parameters
[in]arg- Command line option.
[in]value- Upon return, contains the value after the "=" sign.
Returns
Returns 0 if valid; if invalid returns -1.

Definition at line 1625 of file ffmpegfs.cc.

Referenced by get_seek_time_diff(), and get_segment_duration().

◆ get_value() [3/4]

static int get_value ( const std::string &  arg,
MATCHVEC value 
)
static

Get comma separated values from command line string. Finds whatever is after the "=" sign.

Parameters
[in]arg- Command line option.
[in]value- Upon return, contains a set of the values after the "=" sign.
Returns
Returns 0 if valid; if invalid returns -1.

Definition at line 1671 of file ffmpegfs.cc.

References split().

◆ get_value() [4/4]

static int get_value ( const std::string &  arg,
std::string *  value 
)
static

Get value from command line string. Finds whatever is after the "=" sign.

Parameters
[in]arg- Command line option.
[in]value- Upon return, contains the value after the "=" sign.
Returns
Returns 0 if valid; if invalid returns -1.

Definition at line 1648 of file ffmpegfs.cc.

◆ get_video_codec_text()

std::string get_video_codec_text ( AVCodecID  video_codec)

Convert AVCodecID enum for video codec to human readable text.

Parameters
[in]video_codec- AVCodecID enum value to convert.
Returns
AVCodecID as text or "INVALID" if not known.

Definition at line 1246 of file ffmpegfs.cc.

References search_by_value(), and videocodec_map.

Referenced by Format_Options::video_codec_list().

◆ get_videocodec()

static int get_videocodec ( const std::string &  arg,
AVCodecID *  video_codec 
)
static

Get the video codec.

Parameters
[in]arg- One of the possible video codecs.
[out]video_codec- Upon return contains selected AVCodecID enum.
Returns
Returns 0 if found; if not found returns -1.

Definition at line 1168 of file ffmpegfs.cc.

References list_options(), and videocodec_map.

◆ init_logging()

static bool init_logging ( const std::string &  logfile,
const std::string &  max_level,
bool  to_stderr,
bool  to_syslog 
)
static

Inititalise logging facility.

Parameters
[in]logfile- Name of log file if file writing is selected.
[in]max_level- Maximum level to log.
[in]to_stderr- If true, log to stderr.
[in]to_syslog- If true, log to syslog.
Returns
Returns true on success; false on error.

Definition at line 2320 of file ffmpegfs.cc.

References Logging::init_logging(), LOGDEBUG, LOGERROR, LOGINFO, LOGTRACE, and LOGWARN.

Referenced by main().

◆ list_options()

template<typename T >
static void list_options ( const char *  info,
const T &  map 
)
static

Iterate through all elements in map print all keys.

Parameters
[in]info- Informative text, will be printed before the list. May be nullptr.
[in]map- Map to go through.

Definition at line 672 of file ffmpegfs.cc.

Referenced by get_audiocodec(), get_autocopy(), get_codec(), get_hwaccel(), get_level(), get_profile(), get_recodesame(), get_sampleformat(), and get_videocodec().

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ print_params()

static void print_params ( )
static

Print currently selected parameters.

Definition at line 2046 of file ffmpegfs.cc.

References AUDIO, ffmpeg_format, FFMPEGFS_PARAMS::m_basepath, FFMPEGFS_PARAMS::m_mountpath, params, Logging::trace(), and transcoder_cache_path().

◆ set_defaults()

static bool set_defaults ( )
static

Set default values.

Returns
Returns true if options are OK, false if option combination is invalid.

Definition at line 2010 of file ffmpegfs.cc.

References ffmpeg_format, FFMPEGFS_PARAMS::m_level, NONE, params, PRORES_HQ, and VIDEO.

◆ usage()

static void usage ( )
static

Print program usage info.

Definition at line 655 of file ffmpegfs.cc.

Variable Documentation

◆ audiocodec_map

const AUDIOCODEC_MAP audiocodec_map
static
Initial value:
{
{ "AAC", AV_CODEC_ID_AAC },
{ "AC3", AV_CODEC_ID_AC3 },
{ "MP3", AV_CODEC_ID_MP3 },
{ "OPUS", AV_CODEC_ID_OPUS },
{ "VORBIS", AV_CODEC_ID_VORBIS },
{ "DTS", AV_CODEC_ID_DTS },
{ "PCM16", AV_CODEC_ID_PCM_S16LE },
{ "PCM24", AV_CODEC_ID_PCM_S24LE },
{ "PCM32", AV_CODEC_ID_PCM_S32LE },
}

List of audio codecs.

Definition at line 453 of file ffmpegfs.cc.

Referenced by get_audio_codec_text(), and get_audiocodec().

◆ autocopy_map

const AUTOCOPY_MAP autocopy_map
static
Initial value:
{
{ "OFF", AUTOCOPY::OFF },
{ "MATCH", AUTOCOPY::MATCH },
{ "MATCHLIMIT", AUTOCOPY::MATCHLIMIT },
{ "STRICT", AUTOCOPY::STRICT },
{ "STRICTLIMIT", AUTOCOPY::STRICTLIMIT },
}
@ STRICT
Copy stream if codec matches desired target, transcode otherwise.
@ MATCH
Copy stream if target supports codec.
@ MATCHLIMIT
Same as MATCH, only copy if target not larger transcode otherwise.
@ OFF
Never copy streams, transcode always.
@ STRICTLIMIT
Same as STRICT, only copy if target not larger, transcode otherwise.

List of AUTOCOPY options

Definition at line 485 of file ffmpegfs.cc.

Referenced by get_autocopy(), and get_autocopy_text().

◆ ffmpeg_format

FFMPEGFS_FORMAT_ARR ffmpeg_format

◆ ffmpegfs_opts

struct fuse_opt ffmpegfs_opts[]
static

FUSE option descriptions

Need to ignore annoying warnings caused by fuse.h

Definition at line 300 of file ffmpegfs.cc.

Referenced by main().

◆ hwaccel_codec_map

const CODEC_MAP hwaccel_codec_map
static
Initial value:
{
{ "H263", AV_CODEC_ID_H263 },
{ "H264", AV_CODEC_ID_H264 },
{ "HEVC", AV_CODEC_ID_HEVC },
{ "MPEG2", AV_CODEC_ID_MPEG2VIDEO },
{ "MPEG4", AV_CODEC_ID_MPEG4 },
{ "VC1", AV_CODEC_ID_VC1 },
{ "VP8", AV_CODEC_ID_VP8 },
{ "VP9", AV_CODEC_ID_VP9 },
{ "WMV3", AV_CODEC_ID_WMV3 },
}

List of AUTOCOPY options

Definition at line 591 of file ffmpegfs.cc.

Referenced by get_codec().

◆ hwaccel_map

HWACCEL_MAP hwaccel_map
static

List if hardware acceleration options. See https://trac.ffmpeg.org/wiki/HWAccelIntro

AV_HWDEVICE_TYPE_NONE will be set to the appropriate device type in build_device_type_list() by asking the FFmpeg API for the proper type.

Definition at line 544 of file ffmpegfs.cc.

Referenced by build_device_type_list(), get_hwaccel(), and get_hwaccel_API_text().

◆ params

FFmpegfs command line parameters.

Definition at line 74 of file ffmpegfs.cc.

Referenced by FFmpeg_Transcoder::add_stream(), Format_Options::audio_codec(), Format_Options::audio_codec_list(), FFmpeg_Transcoder::audio_size(), Cache_Entry::Cache_Entry(), FFmpeg_Transcoder::calculate_predicted_filesize(), FFmpeg_Transcoder::can_copy_stream(), check_hwaccel_dec_blocked(), Cache_Entry::clear(), create_dvd_virtualfile(), FFmpeg_Transcoder::decode_frame(), Cache_Entry::decode_timeout(), FFmpeg_Transcoder::encode_finish(), Cache_Entry::expired(), FFmpeg_Transcoder::FFmpeg_Transcoder(), ffmpegfs_getattr(), ffmpegfs_init(), ffmpegfs_opt_proc(), ffmpegfs_readdir(), find_original(), FFmpeg_Transcoder::get_format(), get_format(), FFmpeg_Transcoder::get_hw_decoder_name(), FFmpeg_Transcoder::get_hw_encoder_name(), FFmpeg_Transcoder::get_next_segment(), FFmpeg_Transcoder::get_pix_formats(), VIRTUALFILE::get_segment_count(), FFmpeg_Transcoder::get_video_size(), guess_format_idx(), FFmpeg_Transcoder::hwframe_ctx_set(), Buffer::init(), insert_file(), Format_Options::is_audio_codec_supported(), Format_Options::is_sample_fmt_supported(), Format_Options::is_video_codec_supported(), load_path(), main(), Buffer::make_cachefile_name(), make_hls_fileset(), FFmpeg_Transcoder::open_albumarts(), FFmpeg_Transcoder::open_bestmatch_video(), FFmpeg_Transcoder::open_decoder(), FFmpeg_Transcoder::open_input_file(), FFmpeg_Transcoder::open_output_filestreams(), FFmpeg_Transcoder::open_output_frame_set(), Cache_Entry::outdated(), FFmpeg_Transcoder::prepare_codec(), FFmpeg_Transcoder::prepare_format(), prepare_script(), print_params(), FFmpeg_Transcoder::process_single_fr(), Format_Options::sample_format(), set_defaults(), FFmpeg_Transcoder::start_new_segment(), Format_Options::subtitle_codec(), Cache_Entry::suspend_timeout(), transcode(), transcoder_cache_path(), transcoder_new(), transcoder_read(), transcoder_set_filesize(), transcoder_thread(), Format_Options::video_codec(), Format_Options::video_codec_list(), FFmpeg_Transcoder::video_size(), virtual_name(), and Logging::Logger::~Logger().

◆ profile_map

const PROFILE_MAP profile_map
static
Initial value:
{
{ "NONE", PROFILE::DEFAULT },
{ "FF", PROFILE::MP4_FF },
{ "EDGE", PROFILE::MP4_EDGE },
{ "IE", PROFILE::MP4_IE },
{ "CHROME", PROFILE::MP4_CHROME },
{ "SAFARI", PROFILE::MP4_SAFARI },
{ "OPERA", PROFILE::MP4_OPERA },
{ "MAXTHON", PROFILE::MP4_MAXTHON },
}
@ MP4_MAXTHON
Maxthon.
@ MP4_CHROME
Google Chrome.
@ MP4_OPERA
Opera.
@ MP4_EDGE
MS Edge.
@ MP4_IE
MS Internet Explorer.
@ DEFAULT
No specific profile/Don't care.
@ MP4_SAFARI
Apple Safari.
@ MP4_FF
Firefox.

List if MP4 profiles

Definition at line 497 of file ffmpegfs.cc.

Referenced by get_profile(), and get_profile_text().

◆ prores_level_map

const LEVEL_MAP prores_level_map
static
Initial value:
{
}
@ PRORES_STANDARD
Prores Level: STANDARD.
@ PRORES_PROXY
Prores Level: PROXY.
@ PRORES_HQ
Prores Level: HQ.
@ PRORES_LT
Prores Level: LT.

List if ProRes levels.

Definition at line 517 of file ffmpegfs.cc.

Referenced by get_level(), and get_level_text().

◆ recode_map

const RECODESAME_MAP recode_map
static
Initial value:
{
{ "NO", RECODESAME::NO },
{ "YES", RECODESAME::YES },
}
@ YES
Always recode to same format.
@ NO
Never recode to same format.

List if recode options.

Definition at line 529 of file ffmpegfs.cc.

Referenced by get_recodesame(), and get_recodesame_text().

◆ sample_fmt_map

const SAMPLE_FMT_MAP sample_fmt_map
static
Initial value:
{
{ "16", SAMPLE_FMT::FMT_16 },
{ "24", SAMPLE_FMT::FMT_24 },
{ "32", SAMPLE_FMT::FMT_32 },
{ "64", SAMPLE_FMT::FMT_64 },
{ "F16", SAMPLE_FMT::FMT_F16 },
{ "F24", SAMPLE_FMT::FMT_F24 },
{ "F32", SAMPLE_FMT::FMT_F32 },
{ "F64", SAMPLE_FMT::FMT_F64 },
}
@ FMT_F16
16 bit floating point
@ FMT_F32
32 bit floating point
@ FMT_F24
24 bit floating point
@ FMT_8
8 bit integer
@ FMT_32
32 bit integer
@ FMT_16
16 bit integer
@ FMT_DONTCARE
Don't care, leave to FFmpegfs to choose.
@ FMT_F64
64 bit floating point
@ FMT_24
24 bit integer
@ FMT_64
64 bit integer

List of sample formats.

Definition at line 607 of file ffmpegfs.cc.

Referenced by get_sampleformat(), and get_sampleformat_text().

◆ videocodec_map

const VIDEOCODEC_MAP videocodec_map
static
Initial value:
{
{ "MPEG1", AV_CODEC_ID_MPEG1VIDEO },
{ "MPEG2", AV_CODEC_ID_MPEG2VIDEO },
{ "H264", AV_CODEC_ID_H264 },
{ "H265", AV_CODEC_ID_H265 },
{ "VP8", AV_CODEC_ID_VP8 },
{ "VP9", AV_CODEC_ID_VP9 },
}

List of video codecs.

Definition at line 470 of file ffmpegfs.cc.

Referenced by get_video_codec_text(), and get_videocodec().