FFmpegfs Fuse Multi Media Filesystem 2.16
|
The FFmpeg_Transcoder class. More...
#include <ffmpeg_transcoder.h>
Classes | |
struct | BUFFER_DATA |
Buffer structure, used in FFmpeg_Transcoder::read_packet. More... | |
struct | INPUTFILE |
Input file definition. More... | |
struct | OUTPUTFILE |
Output file definition. More... | |
struct | PRORES_BITRATE |
Predicted bitrates for Apple Prores, see https://www.apple.com/final-cut-pro/docs/Apple_ProRes_White_Paper.pdf. More... | |
class | StreamRef |
In/output stream reference data. More... | |
Public Member Functions | |
FFmpeg_Transcoder () | |
virtual | ~FFmpeg_Transcoder () |
bool | is_open () const |
int | open_input_file (LPVIRTUALFILE virtualfile, std::shared_ptr< FileIO > fio=nullptr) |
int | open_output_file (Buffer *buffer) |
Open output file. Data will actually be written to buffer and copied by FUSE when accessed. More... | |
int | process_single_fr (DECODER_STATUS *status) |
int | encode_finish () |
void | closeio () |
Close transcoder, free all ressources. More... | |
time_t | mtime () const |
Get last modification time of file. More... | |
int64_t | duration () const |
Get the file duration. More... | |
size_t | predicted_filesize () const |
Try to predict the recoded file size. This may (better will surely) be inaccurate. More... | |
uint32_t | video_frame_count () const |
Get the number of video frames in file. More... | |
uint32_t | segment_count () const |
Get the number of HLS segments of file. More... | |
const ID3v1 * | id3v1tag () const |
Assemble an ID3v1 file tag. More... | |
virtual const char * | filename () const override |
Return source filename. More... | |
virtual const char * | destname () const override |
Return destination filename. More... | |
virtual const char * | virtname () const override |
Return virtual filename. Same as destination filename, but with virtual (mount) path.. More... | |
bool | close_output_file () |
Closes the output file if open and reports lost packets. Can safely be called again after the file was already closed or if the file was never open. More... | |
bool | close_input_file () |
Closes the input file if open. Can safely be called again after the file was already closed or if the file was never open. More... | |
int | stack_seek_frame (uint32_t frame_no) |
Seek to a specific frame. Does not actually perform the seek, this is done asynchronously by the transcoder thread. More... | |
int | stack_seek_segment (uint32_t segment_no) |
Seek to a specific HLS segment. Does not actually perform the seek, this is done asynchronously by the transcoder thread. More... | |
bool | is_multiformat () const |
Check for an export frame format. More... | |
bool | is_frameset () const |
Check for an export frame format. More... | |
bool | is_hls () const |
Check for HLS format. More... | |
bool | have_seeked () const |
Check if we made a seek operation. More... | |
void | flush_buffers () |
Flush FFmpeg's input buffers. More... | |
int | flush_delayed_audio () |
Flush delayed audio packets, if there are any. More... | |
int | flush_delayed_video () |
Flush delayed video packets, if there are any. More... | |
int | flush_delayed_subtitles () |
Flush delayed subtitle packets, if there are any. More... | |
int64_t | pts () const |
Get PTS (presentation time stamp) of decoded audio/video so far. More... | |
uint32_t | last_seek_frame_no () const |
Current seek frame if available. More... | |
Public Member Functions inherited from FFmpeg_Base | |
FFmpeg_Base () | |
Construct FFmpeg_Base object. More... | |
virtual | ~FFmpeg_Base ()=default |
Destruct FFmpeg_Base object. | |
Static Public Member Functions | |
static bool | audio_size (size_t *filesize, AVCodecID codec_id, BITRATE bit_rate, int64_t duration, int channels, int sample_rate, AVSampleFormat sample_format) |
Predict audio file size. This may (better will surely) be inaccurate. More... | |
static bool | video_size (size_t *filesize, AVCodecID codec_id, BITRATE bit_rate, int64_t duration, int width, int height, bool interleaved, const AVRational &framerate) |
Predict video file size. This may (better will surely) be inaccurate. More... | |
static bool | total_overhead (size_t *filesize, FILETYPE filetype) |
Predict overhead in file size. This may (better will surely) be inaccurate. More... | |
Protected Types | |
enum class | HWACCELMODE { NONE , ENABLED , FALLBACK } |
Currently active hardware acceleration mode. More... | |
typedef struct FFmpeg_Transcoder::BUFFER_DATA | BUFFER_DATA |
Buffer structure, used in FFmpeg_Transcoder::read_packet. | |
typedef struct FFmpeg_Transcoder::PRORES_BITRATE | PRORES_BITRATE |
Predicted bitrates for Apple Prores, see https://www.apple.com/final-cut-pro/docs/Apple_ProRes_White_Paper.pdf. More... | |
typedef struct FFmpeg_Transcoder::PRORES_BITRATE * | LPPRORES_BITRATE |
Pointer version of PRORES_BITRATE. | |
typedef PRORES_BITRATE const * | LPCPRORES_BITRATE |
Pointer to const version of PRORES_BITRATE. More... | |
typedef std::map< int, StreamRef > | StreamRef_map |
Map stream index to StreamRef. More... | |
typedef std::map< AVHWDeviceType, AVPixelFormat > | DEVICETYPE_MAP |
Map device types to pixel formats. More... | |
typedef std::variant< FFmpeg_Frame, FFmpeg_Subtitle > | MULTIFRAME |
Combined audio/videoframe and subtitle. More... | |
typedef std::multimap< int64_t, MULTIFRAME > | MULTIFRAME_MAP |
Audio frame/video frame/subtitle buffer. More... | |
typedef std::map< int, int > | STREAM_MAP |
Map input subtitle stream to output stream. More... | |
Protected Member Functions | |
int | copy_audio_to_frame_buffer (int *finished) |
Copy data from audio FIFO to frame buffer. Divides WAV data into proper chunks to be fed into the encoder. More... | |
int | open_bestmatch_decoder (AVFormatContext *format_ctx, AVCodecContext **codec_ctx, int *stream_idx, AVMediaType type) |
Find best match stream and open codec context for it. More... | |
int | open_bestmatch_video () |
Open the best match video stream, if present in input file. More... | |
int | open_bestmatch_audio () |
Open the best match audio stream. More... | |
int | open_subtitles () |
Open all subtitles streams, if present in input file and if supported by output file. The input and output codec type must also match: Can only transcode bitmap subtitles into bitmap subtitles or text to text. More... | |
int | open_albumarts () |
open_albumarts More... | |
AVPixelFormat | get_hw_pix_fmt (const AVCodec *codec, AVHWDeviceType dev_type, bool use_device_ctx) const |
Determine the hardware pixel format for the codec, if applicable. More... | |
int | open_decoder (AVFormatContext *format_ctx, AVCodecContext **codec_ctx, int stream_idx, const AVCodec *input_codec, AVMediaType mediatype) |
Open codec context for stream_idx. More... | |
int | open_output_frame_set (Buffer *buffer) |
Open output frame set. Data will actually be written to buffer and copied by FUSE when accessed. More... | |
int | open_output (Buffer *buffer) |
Open output file. Data will actually be written to buffer and copied by FUSE when accessed. More... | |
int | process_output () |
Process headers of output file Write file header, process meta data and add album arts. More... | |
bool | is_video () const |
int | update_codec (void *opt, const PROFILE_OPTION_VEC &profile_option_vec) const |
Prepare codec options. More... | |
int | prepare_codec (void *opt, FILETYPE filetype) const |
Prepare codec options for a file type. More... | |
int | add_stream (AVCodecID codec_id) |
Add new stream to output file. More... | |
int | add_subtitle_stream (AVCodecID codec_id, StreamRef &input_streamref, const std::optional< std::string > &language=std::nullopt) |
Add new subtitle stream to output file. More... | |
int | add_stream_copy (AVCodecID codec_id, AVMediaType codec_type) |
Add new stream copy to output file. More... | |
int | add_albumart_stream (const AVCodecContext *input_codec_ctx) |
Add a stream for an album art. More... | |
int | add_albumart_frame (AVStream *output_stream, AVPacket *pkt_in) |
Add album art to stream. More... | |
int | open_output_filestreams (Buffer *buffer) |
Open an output file and the required encoder. Also set some basic encoder parameters. Some of these parameters are based on the input file's parameters. More... | |
template<size_t size> | |
const char * | tagcpy (char(&out)[size], const std::string &in) const |
Safely copy a tag to a target buffer. If the input buffer size is larger than output the data will be truncated to avoid overruns. The function never appends a /0 terminator. More... | |
template<class T > | |
const T & | tagcpy (T &out, const std::string &in) const |
Safely copy a tag to a target buffer. If the input buffer size is larger than output the data will be truncated to avoid overruns. The function never appends a /0 terminator. More... | |
void | copy_metadata (AVDictionary **metadata_out, const AVDictionary *metadata_in, bool contentstream=true) |
Process the metadata in the FFmpeg file. This should be called at the beginning, before reading audio data. The set_text_tag() and set_picture_tag() methods of the given Encoder will be used to set the metadata, with results going into the given Buffer. This function will also read the actual PCM stream parameters. More... | |
int | process_metadata () |
Copy metadata from source to target. More... | |
int | process_albumarts () |
Copy all album arts from source to target. More... | |
int | init_resampler () |
Initialize the audio resampler based on the input and output codec settings. If the input and output sample formats differ, a conversion is required libswresample takes care of this, but requires initialization. More... | |
int | init_audio_fifo () |
Initialise a FIFO buffer for the audio samples to be encoded. More... | |
int | update_format (AVDictionary **dict, const PROFILE_OPTION_VEC &option_vec) const |
Update format options. More... | |
int | prepare_format (AVDictionary **dict, FILETYPE filetype) const |
Prepare format optimisations. More... | |
int | write_output_file_header () |
Write the header of the output file container. More... | |
int | store_packet (AVPacket *pkt, AVMediaType mediatype) |
Store packet in output stream. More... | |
int | decode_audio_frame (AVPacket *pkt, int *decoded) |
Decode one audio frame. More... | |
int | decode_video_frame (AVPacket *pkt, int *decoded) |
Decode one video frame. More... | |
int | decode_subtitle (AVPacket *pkt, int *decoded) |
Decode one subtitle. More... | |
int | decode_subtitle (AVCodecContext *codec_ctx, AVPacket *pkt, int *decoded, int out_stream_idx) |
Decode one subtitle. More... | |
void | make_pts (AVPacket *pkt, int64_t *cur_ts) const |
Create PTS/DTS and update the packet. If the update packet lacks time stamps, create a fictitious PTS or DTS and update it. If the packet already has valid time stamps, nothing is changed. More... | |
int | decode_frame (AVPacket *pkt) |
Decode one frame. More... | |
int | init_converted_samples (uint8_t ***converted_input_samples, int frame_size) |
Initialise a temporary storage for the specified number of audio samples. The conversion requires temporary storage due to the different format. The number of audio samples to be allocated is specified in frame_size. More... | |
int | convert_samples (uint8_t **input_data, int in_samples, uint8_t **converted_data, int *out_samples) |
Convert the input audio samples into the output sample format. The conversion happens on a per-frame basis, the size of which is specified by frame_size. More... | |
int | add_samples_to_fifo (uint8_t **converted_input_samples, int frame_size) |
Add converted input audio samples to the FIFO buffer for later processing. More... | |
int | flush_frames_all (bool use_flush_packet) |
Flush the remaining frames for all streams. More... | |
int | flush_frames_single (int stream_idx, bool use_flush_packet) |
Flush the remaining frames. More... | |
int | read_decode_convert_and_store (int *finished) |
Read frame from source file, decode and store in FIFO. More... | |
int | init_audio_output_frame (AVFrame *frame, int frame_size) const |
Initialise one input frame for writing to the output file. The frame will be exactly frame_size samples large. More... | |
int | alloc_picture (AVFrame *frame, AVPixelFormat pix_fmt, int width, int height) const |
Allocate memory for one picture. More... | |
void | produce_audio_dts (AVPacket *pkt) |
Produce audio dts/pts. This is required because the target codec usually has a different frame size than the source, so the number of packets will not match 1:1. More... | |
int | decode (AVCodecContext *codec_ctx, AVFrame *frame, int *got_frame, const AVPacket *pkt) const |
int | create_audio_frame (int frame_size) |
Load one audio frame from the FIFO buffer and store in frame buffer. More... | |
int | encode_audio_frame (const AVFrame *frame, int *data_present) |
Create one frame worth of audio to the output file. More... | |
int | encode_video_frame (const AVFrame *frame, int *data_present) |
Encode one frame worth of video to the output file. More... | |
int | encode_subtitle (const AVSubtitle *sub, int out_stream_idx, int *data_present) |
Encode one subtitle frame to the output file. More... | |
int | encode_image_frame (const AVFrame *frame, int *data_present) |
Encode frame to image. More... | |
int | write_output_file_trailer () |
Write the trailer of the output file container. More... | |
size_t | calculate_predicted_filesize () const |
Try to predict final file size. More... | |
bool | get_video_size (int *output_width, int *output_height) const |
Get the size of the output video based on user selection and apsect ratio. More... | |
bool | get_aspect_ratio (int width, int height, const AVRational &sar, AVRational *ar) const |
Calculate aspect ratio for width/height and sample aspect ratio (sar). More... | |
int | init_deinterlace_filters (AVCodecContext *codec_ctx, AVPixelFormat pix_fmt, const AVRational &avg_frame_rate, const AVRational &time_base) |
Initialise video filters. More... | |
int | send_filters (FFmpeg_Frame *srcframe, int &ret) |
Send video frame to the filters. More... | |
void | free_filters () |
Free filter sinks. More... | |
bool | can_copy_stream (const AVStream *stream) const |
Check if stream can be copied from input to output (AUTOCOPY option). More... | |
bool | close_resample () |
Close and free the resampler context. More... | |
int | init_rescaler (AVPixelFormat in_pix_fmt, int in_width, int in_height, AVPixelFormat out_pix_fmt, int out_width, int out_height) |
Init image size rescaler and pixel format converter. More... | |
int | purge_audio_fifo () |
Purge all samples in audio FIFO. More... | |
size_t | purge_multiframe_map () |
Purge all frames in buffer. More... | |
size_t | purge_hls_fifo () |
Purge all packets in HLS FIFO buffer. More... | |
void | purge () |
Purge FIFO and map buffers and report lost packets/frames/samples. More... | |
int | do_seek_frame (uint32_t frame_no) |
Actually perform seek for frame. This function ensures that it is positioned at a key frame, so the resulting position may be different from the requested. If e.g. frame no. 24 is a key frame, and frame_no is set to 28, the actual position will be at frame 24. More... | |
int | skip_decoded_frames (uint32_t frame_no, bool forced_seek) |
Skip decoded frames or force seek to frame_no. More... | |
void | get_pix_formats (AVPixelFormat *in_pix_fmt, AVPixelFormat *out_pix_fmt, AVCodecContext *output_codec_ctx=nullptr) const |
Get correct input and output pixel format. More... | |
enum AVPixelFormat | get_format (AVCodecContext *input_codec_ctx, const enum AVPixelFormat *pix_fmts) const |
int | hwdevice_ctx_create (AVBufferRef **hwaccel_enc_device_ctx, AVHWDeviceType dev_type, const std::string &device) const |
int | hwdevice_ctx_add_ref (AVCodecContext *input_codec_ctx) |
Add reference to hardware device context. More... | |
void | hwdevice_ctx_free (AVBufferRef **hwaccel_device_ctx) |
Free (remove reference) to hardware device context. More... | |
int | hwframe_ctx_set (AVCodecContext *output_codec_ctx, AVCodecContext *input_codec_ctx, AVBufferRef *hw_device_ctx) const |
Adds a reference to an existing decoder hardware frame context or allocates a new AVHWFramesContext tied to the given hardware device context if if the decoder runs in software. More... | |
int | hwframe_copy_from_hw (AVCodecContext *output_codec_ctx, FFmpeg_Frame *sw_frame, const AVFrame *hw_frame) const |
int | hwframe_copy_to_hw (AVCodecContext *output_codec_ctx, FFmpeg_Frame *hw_frame, const AVFrame *sw_frame) const |
int | get_hw_decoder_name (AVCodecID codec_id, std::string *codec_name=nullptr) const |
Get the hardware codec name as string. This is required, because e.g. the name for the software codec is libx264, but for hardware it is h264_vaapi under VAAPI. More... | |
int | get_hw_encoder_name (AVCodecID codec_id, std::string *codec_name=nullptr) const |
Get the hardware codec name as string. This is required, because e.g. the name for the software codec is libx264, but for hardware it is h264_vaapi under VAAPI. More... | |
int | get_hw_vaapi_codec_name (AVCodecID codec_id, std::string *codec_name) const |
Determine VAAPI codec name. More... | |
int | get_hw_mmal_decoder_name (AVCodecID codec_id, std::string *codec_name) const |
Determine MMAL decoder codec name. More... | |
int | get_hw_omx_encoder_name (AVCodecID codec_id, std::string *codec_name) const |
Determine OMX encoder codec name. More... | |
int | get_hw_v4l2m2m_encoder_name (AVCodecID codec_id, std::string *codec_name) const |
Determine video for linux encoder codec name. More... | |
uint32_t | get_next_segment (int64_t pos) const |
Calculate next HLS segment from position. More... | |
bool | goto_next_segment (uint32_t next_segment) const |
Check if segment number is next designated segment. More... | |
int | create_fake_wav_header () const |
Create a fake WAV header Create a fake WAV header. Inserts predicted file sizes to allow playback to start directly. More... | |
int | create_fake_aiff_header () const |
Create a fake AIFF header Create a fake AIFF header. Inserts predicted file sizes to allow playback to start directly. More... | |
int | read_aiff_chunk (Buffer *buffer, size_t *buffoffset, const char *ID, uint8_t *chunk, size_t *size) const |
Read AIFF chunk. More... | |
bool | is_audio_stream (int stream_idx) const |
Check for audio stream. More... | |
bool | is_video_stream (int stream_idx) const |
Check for video stream. More... | |
bool | is_subtitle_stream (int stream_idx) const |
Check for subtitle stream. More... | |
StreamRef * | get_out_subtitle_stream (int stream_idx) |
Get subtitle stream for the stream index. More... | |
bool | stream_exists (int stream_idx) const |
Check if stream exists. More... | |
void | add_stream_map (int in_stream_idx, int out_stream_idx) |
Add entry to input stream to output stream map. More... | |
int | map_in_to_out_stream (int in_stream_idx) const |
Map input stream index to output stream index. More... | |
int | add_subtitle_streams () |
Add all subtitle streams. Already existing streams are not added again. More... | |
int | seek_frame () |
Frame sets only: perform seek to a certain frame. More... | |
int | start_new_segment () |
HLS only: start a new HLS segment. More... | |
int | add_external_subtitle_streams () |
Scan for external subtitle files. More... | |
int | add_external_subtitle_stream (const std::string &subtitle_file, const std::optional< std::string > &language) |
add_external_subtitle_stream More... | |
int | foreach_subtitle_file (const std::string &search_path, const std::regex ®ex, int depth, const std::function< int(const std::string &, const std::optional< std::string > &)> &f) |
foreach_subititle_file More... | |
Protected Member Functions inherited from FFmpeg_Base | |
void | video_stream_setup (AVCodecContext *output_codec_ctx, AVStream *output_stream, AVCodecContext *input_codec_ctx, AVRational framerate, AVPixelFormat enc_hw_pix_fmt) const |
Set up a video stream. More... | |
int | dict_set_with_check (AVDictionary **pm, const char *key, const char *value, int flags, const char *filename=nullptr, bool nodelete=false) const |
Call av_dict_set and check the result code. It displays an error message if appropriate. More... | |
int | dict_set_with_check (AVDictionary **pm, const char *key, int64_t value, int flags, const char *filename=nullptr, bool nodelete=false) const |
Call av_dict_set and check the result code. It displays an error message if appropriate. More... | |
int | opt_set_with_check (void *obj, const char *key, const char *value, int flags, const char *filename=nullptr) const |
Call av_opt_set and check result code. Displays an error message if appropriate. More... | |
void | video_info (bool out_file, const AVFormatContext *format_ctx, const AVStream *stream) const |
Print data from the video stream to a log. More... | |
void | audio_info (bool out_file, const AVFormatContext *format_ctx, const AVStream *stream) const |
Print data from the audio stream to log. More... | |
void | subtitle_info (bool out_file, const AVFormatContext *format_ctx, const AVStream *stream) const |
Print data from the subtitle stream to log. More... | |
virtual const char * | filename () const =0 |
Return source filename. Must be implemented in child class. More... | |
virtual const char * | destname () const =0 |
Return destination filename. Must be implemented in child class. More... | |
virtual const char * | virtname () const =0 |
Return virtual filename. Must be implemented in child class. More... | |
uint32_t | pts_to_frame (AVStream *stream, int64_t pts) const |
Convert PTS value to frame number. More... | |
int64_t | frame_to_pts (AVStream *stream, uint32_t frame_no) const |
Convert frame number to PTS value. More... | |
int | get_channels (const AVCodecParameters *codecpar) const |
Get the number of channels from AVCodecParameters. More... | |
void | set_channels (AVCodecParameters *codecpar_out, const AVCodecParameters *codecpar_in) const |
Set the number of channels from AVCodecParameters. More... | |
int | get_channels (const AVCodecContext *codec_ctx) const |
Get the number of channels from AVCodecContext. More... | |
void | set_channels (AVCodecContext *codec_ctx_out, const AVCodecContext *codec_ctx_in) const |
Set the number of channels from AVCodecContext. More... | |
void | set_channels (AVCodecContext *codec_ctx_out, int channels) const |
Set the number of channels from AVCodecContext. More... | |
int | get_script_info (AVCodecContext *codec_ctx, int play_res_x, int play_res_y, const char *font, int font_size, int primary_color, int secondary_color, int outline_color, int back_color, int bold, int italic, int underline, int border_style, int alignment) const |
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS. Nicked from the FFmpeg API function ff_ass_subtitle_header_full(). :) More... | |
Static Protected Member Functions | |
static int | input_read (void *opaque, unsigned char *data, int size) |
Custom read function for FFmpeg. More... | |
static int | output_write (void *opaque, const uint8_t *data, int size) |
Custom write function for FFmpeg. More... | |
static int64_t | seek (void *opaque, int64_t offset, int whence) |
Custom seek function for FFmpeg. More... | |
static BITRATE | get_prores_bitrate (int width, int height, const AVRational &framerate, bool interleaved, PRORESLEVEL profile) |
Calculate the appropriate bitrate for a ProRes file given several parameters. More... | |
static bool | get_output_sample_rate (int input_sample_rate, int max_sample_rate, int *output_sample_rate=nullptr) |
Calculate output sample rate based on user option. More... | |
static bool | get_output_bit_rate (BITRATE input_bit_rate, BITRATE max_bit_rate, BITRATE *output_bit_rate=nullptr) |
Calculate output bit rate based on user option. More... | |
static enum AVPixelFormat | get_format_static (AVCodecContext *input_codec_ctx, const enum AVPixelFormat *pix_fmts) |
static AVPixelFormat | find_sw_fmt_by_hw_type (AVHWDeviceType type) |
Get the software pixel format for the given hardware acceleration. More... | |
static int | read_packet (void *opaque, uint8_t *buf, int buf_size) |
FFmpeg_Transcoder::read_packet. More... | |
Static Protected Member Functions inherited from FFmpeg_Base | |
static std::string | get_pix_fmt_name (AVPixelFormat pix_fmt) |
Calls av_get_pix_fmt_name and returns a std::string with the pix format name. More... | |
static std::string | get_sample_fmt_name (AVSampleFormat sample_fmt) |
Calls av_get_sample_fmt_name and returns a std::string with the format name. More... | |
static std::string | get_channel_layout_name (const AVChannelLayout *ch_layout) |
Calls av_channel_layout_describe and returns a std::string with the channel layout. More... | |
Private Attributes | |
std::shared_ptr< FileIO > | m_fileio |
FileIO object of input file. More... | |
time_t | m_mtime |
Modified time of input file. More... | |
std::recursive_mutex | m_seek_to_fifo_mutex |
Access mutex for seek FIFO. More... | |
std::queue< uint32_t > | m_seek_to_fifo |
Stack of seek requests. Will be processed FIFO. More... | |
std::atomic_uint32_t | m_last_seek_frame_no |
If not 0, this is the last frame that we seeked to. Video sources only. More... | |
bool | m_have_seeked |
After seek operations this is set to make sure the trancoding result is marked RESULTCODE_INCOMPLETE to start transcoding over next access to fill the gaps. More... | |
bool | m_skip_next_frame |
After seek, skip next video frame. More... | |
bool | m_is_video |
true if input is a video file More... | |
MULTIFRAME_MAP | m_frame_map |
Audio/video/subtitle frame map. More... | |
AVSampleFormat | m_cur_sample_fmt |
Currently selected audio sample format. More... | |
int | m_cur_sample_rate |
Currently selected audio sample rate. More... | |
AVChannelLayout | m_cur_ch_layout |
Currently selected audio channel layout. More... | |
SwrContext * | m_audio_resample_ctx |
SwResample context for audio resampling. More... | |
AVAudioFifo * | m_audio_fifo |
Audio sample FIFO. More... | |
SwsContext * | m_sws_ctx |
Context for video filtering. More... | |
AVFilterContext * | m_buffer_sink_context |
Video filter sink context. More... | |
AVFilterContext * | m_buffer_source_context |
Video filter source context. More... | |
AVFilterGraph * | m_filter_graph |
Video filter graph. More... | |
int64_t | m_pts |
Generated PTS. More... | |
int64_t | m_pos |
Generated position. More... | |
INPUTFILE | m_in |
Input file information. More... | |
OUTPUTFILE | m_out |
Output file information. More... | |
STREAM_MAP | m_stream_map |
Input stream to output stream map. More... | |
uint32_t | m_current_segment |
HLS only: Segment file number currently being encoded. More... | |
bool | m_insert_keyframe |
HLS only: Allow insertion of 1 keyframe. More... | |
bool | m_copy_audio |
If true, copy audio stream from source to target (just remux, no recode). More... | |
bool | m_copy_video |
If true, copy video stream from source to target (just remux, no recode). More... | |
int64_t | m_cur_audio_ts |
If the audio stream is copied and the time stamps are absent from the input stream, we have to generate them. More... | |
int64_t | m_cur_video_ts |
If the video stream is copied and the time stamps are absent from the input stream, we have to generate them. More... | |
const FFmpegfs_Format * | m_current_format |
Currently used output format(s) More... | |
Buffer * | m_buffer |
Pointer to cache buffer object. More... | |
uint32_t | m_reset_pts |
We have to reset audio/video pts to the new position. More... | |
uint32_t | m_fake_frame_no |
The MJEPG codec requires monotonically growing PTS values so we fake some to avoid them going backwards after seeks. More... | |
HWACCELMODE | m_hwaccel_enc_mode |
Current hardware acceleration mode for encoder. More... | |
HWACCELMODE | m_hwaccel_dec_mode |
Current hardware acceleration mode for decoder. More... | |
bool | m_hwaccel_enable_enc_buffering |
Enable hardware acceleration frame buffers for encoder. More... | |
bool | m_hwaccel_enable_dec_buffering |
Enable hardware acceleration frame buffers for decoder. More... | |
AVBufferRef * | m_hwaccel_enc_device_ctx |
Hardware acceleration device context for encoder. More... | |
AVBufferRef * | m_hwaccel_dec_device_ctx |
Hardware acceleration device context for decoder. More... | |
AVPixelFormat | m_enc_hw_pix_fmt |
Requested encoder hardware pixel format. More... | |
AVPixelFormat | m_dec_hw_pix_fmt |
Requested decoder hardware pixel format. More... | |
uint32_t | m_active_stream_msk |
HLS: Currently active streams bit mask. Set FFMPEGFS_AUDIO and/or FFMPEGFS_VIDEO. More... | |
uint32_t | m_inhibit_stream_msk |
HLS: Currently inhibited streams bit mask. Packets temporarly go to m_hls_packet_fifo and will be prepended to next segment. Set FFMPEGFS_AUDIO and/or FFMPEGFS_VIDEO. More... | |
std::queue< AVPacket * > | m_hls_packet_fifo |
HLS packet FIFO. More... | |
Static Private Attributes | |
static const std::vector< PRORES_BITRATE > | m_prores_bitrate |
ProRes bitrate table. Used for file size prediction. More... | |
static const DEVICETYPE_MAP | m_devicetype_map |
List of AVPixelFormats mapped to hardware acceleration types. More... | |
Static Private Attributes inherited from FFmpeg_Profiles | |
static const PROFILE_LIST_VEC | m_profile |
List of profile options. More... | |
Additional Inherited Members | |
Protected Attributes inherited from FFmpeg_Base | |
VIRTUALFILE * | m_virtualfile |
Underlying virtual file object. More... | |
Private Types inherited from FFmpeg_Profiles | |
typedef struct FFmpeg_Profiles::PROFILE_OPTION | PROFILE_OPTION |
Profiles options. More... | |
typedef PROFILE_OPTION * | LPPROFILE_OPTION |
Pointer version of PROFILE_OPTION. More... | |
typedef PROFILE_OPTION const * | LPCPROFILE_OPTION |
Pointer to const version of PROFILE_OPTION. More... | |
typedef std::vector< PROFILE_OPTION > | PROFILE_OPTION_VEC |
PROFILE_OPTION array. More... | |
typedef struct FFmpeg_Profiles::PROFILE_LIST | PROFILE_LIST |
List of profiles. More... | |
typedef PROFILE_LIST * | LPPROFILE_LIST |
Pointer version of PROFILE_LIST. More... | |
typedef PROFILE_LIST const * | LPCPROFILE_LIST |
Pointer to const version of PROFILE_LIST. More... | |
typedef std::vector< PROFILE_LIST > | PROFILE_LIST_VEC |
PROFILE_LIST array. More... | |
Private Member Functions inherited from FFmpeg_Profiles | |
FFmpeg_Profiles ()=default | |
Construct a FFmpeg_Profiles object. | |
virtual | ~FFmpeg_Profiles ()=default |
Destruct a FFmpeg_Profiles object. | |
The FFmpeg_Transcoder class.
Definition at line 75 of file ffmpeg_transcoder.h.
|
protected |
Map device types to pixel formats.
Definition at line 178 of file ffmpeg_transcoder.h.
|
protected |
Pointer to const version of PRORES_BITRATE.
Definition at line 112 of file ffmpeg_transcoder.h.
|
protected |
Combined audio/videoframe and subtitle.
Definition at line 187 of file ffmpeg_transcoder.h.
|
protected |
Audio frame/video frame/subtitle buffer.
Definition at line 188 of file ffmpeg_transcoder.h.
|
protected |
Predicted bitrates for Apple Prores, see https://www.apple.com/final-cut-pro/docs/Apple_ProRes_White_Paper.pdf.
< List of ProRes bit rates
|
protected |
Map input subtitle stream to output stream.
Definition at line 189 of file ffmpeg_transcoder.h.
|
protected |
Map stream index to StreamRef.
Definition at line 138 of file ffmpeg_transcoder.h.
|
strongprotected |
Currently active hardware acceleration mode.
<
Enumerator | |
---|---|
NONE | Hardware acceleration not active. |
ENABLED | Hardware acceleration is active. |
FALLBACK | Hardware acceleration selected, but fell back to software. |
Definition at line 180 of file ffmpeg_transcoder.h.
|
explicit |
Construct FFmpeg_Transcoder object
Definition at line 217 of file ffmpeg_transcoder.cc.
References init_id3v1(), FFMPEGFS_PARAMS::m_audiochannels, m_cur_ch_layout, FFmpeg_Transcoder::OUTPUTFILE::m_id3v1, m_mtime, m_out, NONE, params, and Logging::trace().
|
virtual |
Destroy FFMPEG_Transcoder object Close and free all internal structures.
Definition at line 269 of file ffmpeg_transcoder.cc.
References closeio(), and Logging::trace().
|
protected |
Add album art to stream.
[in] | output_stream | - Output stream. |
[in] | pkt_in | - Packet with album art. |
Definition at line 2536 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), store_packet(), Logging::trace(), and virtname().
Referenced by decode_frame(), and process_albumarts().
|
protected |
Add a stream for an album art.
[in] | input_codec_ctx | - Input codec context. |
Definition at line 2428 of file ffmpeg_transcoder.cc.
References AV_CODEC_FLAG_GLOBAL_HEADER, Logging::debug(), Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), get_codec_name(), get_media_type_string(), FFmpeg_Transcoder::INPUTFILE::m_album_art, FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::StreamRef::set_codec_ctx(), and virtname().
Referenced by open_output_filestreams().
|
protected |
add_external_subtitle_stream
[in] | subtitle_file | - Name of subtitle fule |
[in] | language | - Language or subtitle file, or std::nullopt if unknown. |
Definition at line 7636 of file ffmpeg_transcoder.cc.
References add_subtitle_stream(), Logging::debug(), decode_subtitle(), Logging::error(), ffmpeg_geterror(), filename(), INVALID_STREAM, m_current_format, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, open_bestmatch_decoder(), FFmpeg_Transcoder::BUFFER_DATA::ptr, read_packet(), FFmpeg_Transcoder::StreamRef::set_codec_ctx(), FFmpeg_Transcoder::BUFFER_DATA::size, and FFmpegfs_Format::subtitle_codec().
|
protected |
Scan for external subtitle files.
Definition at line 7778 of file ffmpeg_transcoder.cc.
References Logging::error(), filename(), foreach_subtitle_file(), and regex_escape().
Referenced by open_output_filestreams().
|
protected |
Add converted input audio samples to the FIFO buffer for later processing.
[in] | converted_input_samples | - Samples to add. |
[in] | frame_size | - Frame size |
Definition at line 3986 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), m_audio_fifo, and virtname().
Referenced by decode_audio_frame().
|
protected |
Add new stream to output file.
[in] | codec_id | - Codec for this stream. |
Definition at line 1631 of file ffmpeg_transcoder.cc.
References add_stream_map(), BITRATE, Logging::debug(), FFmpeg_Base::dict_set_with_check(), ENABLED, Logging::error(), FALLBACK, ffmpeg_rescale_q(), format_bitrate(), format_samplerate(), FFmpeg_Base::get_channels(), get_hw_encoder_name(), get_hw_pix_fmt(), get_hwaccel_API_text(), get_output_bit_rate(), get_output_sample_rate(), get_video_size(), hwframe_ctx_set(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFMPEGFS_PARAMS::m_audiobitrate, FFMPEGFS_PARAMS::m_audiochannels, FFMPEGFS_PARAMS::m_audiosamplerate, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_current_format, m_enc_hw_pix_fmt, FFmpeg_Transcoder::INPUTFILE::m_filetype, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_hwaccel_enable_enc_buffering, FFMPEGFS_PARAMS::m_hwaccel_enc_API, m_hwaccel_enc_device_ctx, FFMPEGFS_PARAMS::m_hwaccel_enc_device_type, m_hwaccel_enc_mode, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, FFMPEGFS_PARAMS::m_videobitrate, params, FFmpegfs_Format::sample_format(), FFmpeg_Base::set_channels(), FFmpeg_Transcoder::StreamRef::set_codec_ctx(), Logging::trace(), FFmpeg_Base::video_stream_setup(), and virtname().
Referenced by open_output_filestreams().
|
protected |
Add new stream copy to output file.
[in] | codec_id | - Codec for this stream. |
[in] | codec_type | - Codec type: audio or video. |
Definition at line 2349 of file ffmpeg_transcoder.cc.
References add_stream_map(), Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, print_stream_info(), FFmpeg_Transcoder::StreamRef::set_codec_ctx(), and virtname().
Referenced by open_output_filestreams().
|
protected |
Add entry to input stream to output stream map.
[in] | in_stream_idx | - Index of input stream |
[in] | out_stream_idx | - Index of output stream |
Definition at line 7550 of file ffmpeg_transcoder.cc.
References INVALID_STREAM, and m_stream_map.
Referenced by add_stream(), add_stream_copy(), and add_subtitle_stream().
|
protected |
Add new subtitle stream to output file.
[in] | codec_id | - Codec for this stream. |
[in] | input_streamref | - Streamref of input stream. |
[in] | language | - (Optional) Language or subtitle file, or std::nullopt if unknown. |
Definition at line 2209 of file ffmpeg_transcoder.cc.
References add_stream_map(), ASS_DEFAULT_ALIGNMENT, ASS_DEFAULT_BACK_COLOUR, ASS_DEFAULT_BOLD, ASS_DEFAULT_BORDERSTYLE, ASS_DEFAULT_COLOUR, ASS_DEFAULT_FONT, ASS_DEFAULT_FONT_SIZE, ASS_DEFAULT_ITALIC, ASS_DEFAULT_PLAYRESX, ASS_DEFAULT_PLAYRESY, ASS_DEFAULT_UNDERLINE, Logging::debug(), FFmpeg_Base::dict_set_with_check(), Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), get_codec_name(), get_media_type_string(), FFmpeg_Base::get_script_info(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_subtitle, FFmpeg_Transcoder::INPUTFILE::m_video, FFmpeg_Transcoder::StreamRef::set_codec_ctx(), and virtname().
Referenced by add_external_subtitle_stream(), and add_subtitle_streams().
|
protected |
Add all subtitle streams. Already existing streams are not added again.
Definition at line 2733 of file ffmpeg_transcoder.cc.
References add_subtitle_stream(), INVALID_STREAM, m_current_format, m_in, FFmpeg_Transcoder::INPUTFILE::m_subtitle, map_in_to_out_stream(), and FFmpegfs_Format::subtitle_codec().
Referenced by open_output_filestreams().
|
protected |
Allocate memory for one picture.
[in] | frame | - Frame to prepare |
[in] | pix_fmt | - Pixel format |
[in] | width | - Picture width |
[in] | height | - Picture height |
Definition at line 3149 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), and virtname().
Referenced by decode_video_frame().
|
static |
Predict audio file size. This may (better will surely) be inaccurate.
[out] | filesize | - Predicted file size in bytes, including audio stream size. |
[in] | codec_id | - Target codec ID. |
[in] | bit_rate | - Target bit rate. |
[in] | duration | - File duration. |
[in] | channels | - Number of channels in target file. |
[in] | sample_rate | - Sample rate of target file. |
[in] | sample_format | - Selected sample format |
Definition at line 5734 of file ffmpeg_transcoder.cc.
References BITRATE, duration(), get_output_bit_rate(), get_output_sample_rate(), ID3V1_TAG_LENGTH, FFMPEGFS_PARAMS::m_audiobitrate, FFMPEGFS_PARAMS::m_audiosamplerate, and params.
Referenced by calculate_predicted_filesize(), and transcoder_set_filesize().
|
protected |
Try to predict final file size.
Definition at line 6087 of file ffmpeg_transcoder.cc.
References FFmpegfs_Format::audio_codec(), audio_size(), BITRATE, FFmpegfs_Format::desttype(), filename(), FFmpegfs_Format::filetype(), FFmpeg_Base::get_channels(), get_codec_name(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_cur_sample_fmt, m_current_format, FFMPEGFS_PARAMS::m_deinterlace, m_fileio, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, m_is_video, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, params, stream_exists(), total_overhead(), FFmpegfs_Format::video_codec(), video_size(), and Logging::warning().
Referenced by open_input_file().
|
protected |
Check if stream can be copied from input to output (AUTOCOPY option).
[in] | stream | - Input stream to check. |
Definition at line 784 of file ffmpeg_transcoder.cc.
References FFmpegfs_Format::audio_codec(), BITRATE, Logging::debug(), get_output_bit_rate(), Logging::info(), FFMPEGFS_PARAMS::m_audiobitrate, FFMPEGFS_PARAMS::m_autocopy, m_current_format, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, FFMPEGFS_PARAMS::m_videobitrate, MATCH, MATCHLIMIT, OFF, params, STRICT, STRICTLIMIT, FFmpegfs_Format::video_codec(), and virtname().
Referenced by open_output_filestreams().
bool FFmpeg_Transcoder::close_input_file | ( | ) |
Closes the input file if open. Can safely be called again after the file was already closed or if the file was never open.
Definition at line 6435 of file ffmpeg_transcoder.cc.
References free_filters(), FFmpeg_Transcoder::INPUTFILE::m_album_art, FFmpeg_Transcoder::INPUTFILE::m_audio, m_fileio, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, FFmpeg_Transcoder::INPUTFILE::m_subtitle, FFmpeg_Transcoder::INPUTFILE::m_video, and FFmpeg_Transcoder::StreamRef::reset().
Referenced by closeio().
bool FFmpeg_Transcoder::close_output_file | ( | ) |
Closes the output file if open and reports lost packets. Can safely be called again after the file was already closed or if the file was never open.
Definition at line 6392 of file ffmpeg_transcoder.cc.
References close_resample(), FFmpeg_Transcoder::INPUTFILE::m_album_art, FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_out, FFmpeg_Transcoder::INPUTFILE::m_subtitle, m_sws_ctx, FFmpeg_Transcoder::INPUTFILE::m_video, purge(), and FFmpeg_Transcoder::StreamRef::reset().
Referenced by closeio(), open_output(), and start_new_segment().
|
protected |
Close and free the resampler context.
Definition at line 6309 of file ffmpeg_transcoder.cc.
References m_audio_resample_ctx.
Referenced by close_output_file(), and init_resampler().
void FFmpeg_Transcoder::closeio | ( | ) |
Close transcoder, free all ressources.
Definition at line 6476 of file ffmpeg_transcoder.cc.
References close_input_file(), close_output_file(), hwdevice_ctx_free(), m_hwaccel_dec_device_ctx, m_hwaccel_enc_device_ctx, and Logging::trace().
Referenced by transcode(), transcoder_predict_filesize(), and ~FFmpeg_Transcoder().
|
protected |
Convert the input audio samples into the output sample format. The conversion happens on a per-frame basis, the size of which is specified by frame_size.
[in] | input_data | - Input data. |
[in] | in_samples | - Number of input samples. |
[out] | converted_data | - Converted data. |
[out] | out_samples | - Number of output samples |
Definition at line 3946 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), FFmpeg_Base::get_channels(), FFmpeg_Transcoder::INPUTFILE::m_audio, m_audio_resample_ctx, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_in, m_out, and virtname().
Referenced by decode_audio_frame().
|
protected |
Copy data from audio FIFO to frame buffer. Divides WAV data into proper chunks to be fed into the encoder.
Definition at line 5187 of file ffmpeg_transcoder.cc.
References AV_CODEC_CAP_VARIABLE_FRAME_SIZE, create_audio_frame(), FFmpeg_Transcoder::INPUTFILE::m_audio, m_audio_fifo, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_out, and read_decode_convert_and_store().
Referenced by process_single_fr().
|
protected |
Process the metadata in the FFmpeg file. This should be called at the beginning, before reading audio data. The set_text_tag() and set_picture_tag() methods of the given Encoder will be used to set the metadata, with results going into the given Buffer. This function will also read the actual PCM stream parameters.
[in] | metadata_out | - Dictionary of output file. Metadata will be copied into it. |
[in] | metadata_in | - Dictionary of input file. Metadata will be copied out of it. |
[in] | contentstream | - True if this is a content stream, i.e, audio or video. False for album arts or sub titles. |
Definition at line 4901 of file ffmpeg_transcoder.cc.
References FFmpeg_Base::dict_set_with_check(), VIRTUALFILE::CUESHEET_TRACK::m_artist, VIRTUALFILE::m_cuesheet_track, FFmpeg_Transcoder::INPUTFILE::m_filetype, VIRTUALFILE::m_flags, m_out, VIRTUALFILE::CUESHEET_TRACK::m_title, VIRTUALFILE::CUESHEET_TRACK::m_trackno, FFmpeg_Base::m_virtualfile, strcasecmp(), strsprintf(), virtname(), and VIRTUALFLAG_CUESHEET.
Referenced by process_metadata().
|
protected |
Load one audio frame from the FIFO buffer and store in frame buffer.
[in] | frame_size | - Size of frame. |
Definition at line 4787 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), ffmpeg_rescale_q_rnd(), init_audio_output_frame(), FFmpeg_Transcoder::INPUTFILE::m_audio, m_audio_fifo, FFmpeg_Transcoder::OUTPUTFILE::m_audio_pts, m_frame_map, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_start_time, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Frame::res(), and virtname().
Referenced by copy_audio_to_frame_buffer().
|
protected |
Create a fake AIFF header Create a fake AIFF header. Inserts predicted file sizes to allow playback to start directly.
Definition at line 3051 of file ffmpeg_transcoder.cc.
References AIFF_COMMONID, AIFF_FORMID, AIFF_SOUNDATAID, AIFF_FORMCHUNK::m_ckSize, AIFF_SOUNDDATACHUNK::m_ckSize, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_out, predicted_filesize(), read_aiff_chunk(), Buffer::seek(), Buffer::tell(), and Buffer::writeio().
|
protected |
Create a fake WAV header Create a fake WAV header. Inserts predicted file sizes to allow playback to start directly.
Definition at line 2948 of file ffmpeg_transcoder.cc.
References Buffer::copy(), WAV_HEADER::m_audio_format, WAV_FACT::m_chunk_id, WAV_LIST_HEADER::m_data_bytes, WAV_DATA_HEADER::m_data_bytes, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_out, WAV_HEADER::m_wav_size, predicted_filesize(), Buffer::seek(), Buffer::tell(), and Buffer::writeio().
|
protected |
This does not quite work like avcodec_decode_audio4/avcodec_decode_video2. There is the following difference: if you got a frame, you must call it again with pkt=nullptr. pkt==nullptr is treated differently from pkt->size==0 (pkt==nullptr means get more output, pkt->size==0 is a flush/drain packet)
[in] | codec_ctx | - AVCodecContext of input stream. |
[in] | frame | - Decoded frame |
[out] | got_frame | - 1 if a frame was decoded, 0 if not |
[in] | pkt | - Packet to decode |
Definition at line 3168 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), filename(), is_audio_stream(), is_video_stream(), FFmpeg_Transcoder::INPUTFILE::m_audio, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, and stream_exists().
Referenced by decode_audio_frame(), and decode_video_frame().
|
protected |
Decode one audio frame.
[in] | pkt | - Packet to decode. |
[in] | decoded | - 1 if packet was decoded, 0 if it did not contain data. |
Definition at line 3222 of file ffmpeg_transcoder.cc.
References add_samples_to_fifo(), convert_samples(), decode(), Logging::error(), ffmpeg_geterror(), filename(), init_converted_samples(), init_resampler(), FFmpeg_Transcoder::INPUTFILE::m_audio, m_audio_resample_ctx, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_stream_idx, and FFmpeg_Frame::res().
Referenced by decode_frame(), and flush_frames_single().
|
protected |
Decode one frame.
[in] | pkt | - Packet to decode. |
Definition at line 3745 of file ffmpeg_transcoder.cc.
References add_albumart_frame(), Logging::debug(), decode_audio_frame(), decode_subtitle(), decode_video_frame(), DVD, Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), FFMPEGFS_AUDIO, FFMPEGFS_VIDEO, filename(), format_duration(), is_audio_stream(), is_frameset(), is_subtitle_stream(), is_video_stream(), FFmpeg_Transcoder::INPUTFILE::m_album_art, FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::OUTPUTFILE::m_audio_pts, m_copy_audio, m_copy_video, m_cur_audio_ts, m_cur_video_ts, FFMPEGFS_PARAMS::m_decoding_errors, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, m_out, m_reset_pts, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, VIRTUALFILE::m_type, FFmpeg_Transcoder::INPUTFILE::m_video, FFmpeg_Transcoder::OUTPUTFILE::m_video_pts, FFmpeg_Base::m_virtualfile, make_pts(), params, store_packet(), stream_exists(), and virtname().
Referenced by read_decode_convert_and_store().
|
protected |
Decode one subtitle.
[in] | codec_ctx | - AVCodecContext object of output codec context. |
[in] | pkt | - Packet to decode. |
[in] | decoded | - 1 if packet was decoded, 0 if it did not contain data. |
[in] | out_stream_idx | - Output stream index. |
Definition at line 3574 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), filename(), m_frame_map, and FFmpeg_Subtitle::res().
|
protected |
Decode one subtitle.
[in] | pkt | - Packet to decode. |
[in] | decoded | - 1 if packet was decoded, 0 if it did not contain data. |
Definition at line 3542 of file ffmpeg_transcoder.cc.
References decode_subtitle(), Logging::error(), ffmpeg_geterror(), filename(), INVALID_STREAM, m_in, FFmpeg_Transcoder::INPUTFILE::m_subtitle, map_in_to_out_stream(), and virtname().
Referenced by add_external_subtitle_stream(), decode_frame(), and decode_subtitle().
|
protected |
Decode one video frame.
[in] | pkt | - Packet to decode. |
[in] | decoded | - 1 if packet was decoded, 0 if it did not contain data. |
Definition at line 3325 of file ffmpeg_transcoder.cc.
References alloc_picture(), Logging::debug(), decode(), Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q_rnd(), filename(), format_duration(), get_next_segment(), goto_next_segment(), is_hls(), FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_frame_map, m_hwaccel_enable_dec_buffering, m_in, m_insert_keyframe, m_out, FFmpeg_Transcoder::INPUTFILE::m_pix_fmt, m_pos, m_pts, FFmpeg_Transcoder::StreamRef::m_start_time, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, m_sws_ctx, FFmpeg_Transcoder::INPUTFILE::m_video, FFmpeg_Frame::res(), send_filters(), and virtname().
Referenced by decode_frame(), and flush_frames_single().
|
overridevirtual |
Return destination filename.
Implements FFmpeg_Base.
Definition at line 6502 of file ffmpeg_transcoder.cc.
References VIRTUALFILE::m_destfile, and FFmpeg_Base::m_virtualfile.
|
protected |
Actually perform seek for frame. This function ensures that it is positioned at a key frame, so the resulting position may be different from the requested. If e.g. frame no. 24 is a key frame, and frame_no is set to 28, the actual position will be at frame 24.
[in] | frame_no | - Frame number 1...n to seek to. |
Definition at line 5046 of file ffmpeg_transcoder.cc.
References FFmpeg_Base::frame_to_pts(), FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_have_seeked, m_in, m_skip_next_frame, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, and FFmpeg_Transcoder::INPUTFILE::m_video.
Referenced by skip_decoded_frames().
int64_t FFmpeg_Transcoder::duration | ( | ) | const |
Get the file duration.
Definition at line 6159 of file ffmpeg_transcoder.cc.
References FFmpeg_Base::m_virtualfile, and SAFE_VALUE.
Referenced by audio_size(), transcode(), transcode_finish(), transcoder_predict_filesize(), and video_size().
|
protected |
Create one frame worth of audio to the output file.
[in] | frame | - Audio frame to encode |
[in] | data_present | - 1 if frame contained data that could be encoded, 0 if not. |
Definition at line 4256 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_out, FFmpeg_Transcoder::StreamRef::m_stream_idx, produce_audio_dts(), store_packet(), and virtname().
Referenced by flush_delayed_audio(), and process_single_fr().
int FFmpeg_Transcoder::encode_finish | ( | ) |
Encode any remaining PCM data to the given buffer. This should be called after all input data has already been passed to encode_pcm_data().
Definition at line 6179 of file ffmpeg_transcoder.cc.
References Buffer::buffer_watermark(), FFMPEGFS_PARAMS::current_format(), FFmpegfs_Format::fileext(), find_file(), Buffer::finished_segment(), is_frameset(), is_hls(), m_buffer, m_current_segment, VIRTUALFILE::m_destfile, VIRTUALFILE::m_predicted_size, VIRTUALFILE::m_st, FFmpeg_Base::m_virtualfile, make_filename(), params, stat_set_size(), FileIO::virtualfile(), and write_output_file_trailer().
Referenced by start_new_segment(), and transcode_finish().
|
protected |
Encode frame to image.
[in] | frame | - Video frame to encode |
[out] | data_present | - Set to 1 if data was encoded. 0 if not. |
Definition at line 4334 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), FFmpeg_Base::frame_to_pts(), m_buffer, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_current_format, m_fake_frame_no, m_in, m_last_seek_frame_no, m_out, m_skip_next_frame, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::INPUTFILE::m_video, FFmpeg_Transcoder::OUTPUTFILE::m_video_pts, FFmpeg_Base::pts_to_frame(), FFmpeg_Frame::res(), FFmpegfs_Format::video_codec(), virtname(), and Buffer::write_frame().
Referenced by flush_delayed_video(), and process_single_fr().
|
protected |
Encode one subtitle frame to the output file.
[in] | sub | - Subtitle frame to encode |
[in] | out_stream_idx | - Index of stream to encode to. |
[in] | data_present | - 1 if frame contained data that could be encoded, 0 if not. |
Definition at line 4649 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), get_out_subtitle_stream(), FFmpeg_Transcoder::StreamRef::m_codec_ctx, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, store_packet(), and virtname().
Referenced by process_single_fr().
|
protected |
Encode one frame worth of video to the output file.
[in] | frame | - Video frame to encode |
[in] | data_present | - 1 if frame contained data that could be encoded, 0 if not. |
Definition at line 4451 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), hwframe_copy_to_hw(), FFmpeg_Transcoder::StreamRef::m_codec_ctx, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_hwaccel_enable_enc_buffering, m_in, FFmpeg_Transcoder::OUTPUTFILE::m_last_mux_dts, m_out, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, FFmpeg_Transcoder::OUTPUTFILE::m_video_pts, FFmpeg_Frame::res(), store_packet(), Logging::trace(), virtname(), and Logging::warning().
Referenced by flush_delayed_video(), and process_single_fr().
|
overridevirtual |
Return source filename.
Implements FFmpeg_Base.
Definition at line 6497 of file ffmpeg_transcoder.cc.
References VIRTUALFILE::m_origfile, and FFmpeg_Base::m_virtualfile.
Referenced by add_external_subtitle_stream(), add_external_subtitle_streams(), calculate_predicted_filesize(), decode(), decode_audio_frame(), decode_frame(), decode_subtitle(), decode_video_frame(), foreach_subtitle_file(), get_format(), hwframe_copy_from_hw(), open_albumarts(), open_bestmatch_audio(), open_bestmatch_decoder(), open_bestmatch_video(), open_input_file(), open_subtitles(), and transcoder_predict_filesize().
|
staticprotected |
Get the software pixel format for the given hardware acceleration.
[in] | type | - Selected hardware acceleration. |
Definition at line 7459 of file ffmpeg_transcoder.cc.
References m_devicetype_map.
Referenced by get_pix_formats(), and hwframe_ctx_set().
void FFmpeg_Transcoder::flush_buffers | ( | ) |
Flush FFmpeg's input buffers.
Definition at line 5034 of file ffmpeg_transcoder.cc.
References FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_in, and FFmpeg_Transcoder::INPUTFILE::m_video.
Referenced by start_new_segment().
int FFmpeg_Transcoder::flush_delayed_audio | ( | ) |
Flush delayed audio packets, if there are any.
Definition at line 5114 of file ffmpeg_transcoder.cc.
References encode_audio_frame(), Logging::error(), ffmpeg_geterror(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_out, and virtname().
Referenced by process_single_fr().
int FFmpeg_Transcoder::flush_delayed_subtitles | ( | ) |
Flush delayed subtitle packets, if there are any.
Definition at line 5182 of file ffmpeg_transcoder.cc.
Referenced by process_single_fr().
int FFmpeg_Transcoder::flush_delayed_video | ( | ) |
Flush delayed video packets, if there are any.
Definition at line 5144 of file ffmpeg_transcoder.cc.
References encode_image_frame(), encode_video_frame(), Logging::error(), ffmpeg_geterror(), is_frameset(), FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_out, FFmpeg_Transcoder::INPUTFILE::m_video, and virtname().
Referenced by process_single_fr().
|
protected |
Flush the remaining frames for all streams.
Definition at line 4018 of file ffmpeg_transcoder.cc.
References flush_frames_single(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_in, FFmpeg_Transcoder::StreamRef::m_stream_idx, and FFmpeg_Transcoder::INPUTFILE::m_video.
Referenced by read_decode_convert_and_store().
|
protected |
Flush the remaining frames.
[in] | stream_idx | - Stream index to flush. |
[in] | use_flush_packet | - If true, use flush packet. Otherwise pass nullptr to avcodec_receive_frame. |
Definition at line 4043 of file ffmpeg_transcoder.cc.
References decode_audio_frame(), decode_video_frame(), is_audio_stream(), is_frameset(), is_video_stream(), FFmpeg_Transcoder::INPUTFILE::m_audio, m_copy_audio, m_copy_video, m_out, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, and stream_exists().
Referenced by flush_frames_all().
|
inlineprotected |
foreach_subititle_file
[in] | search_path | - Directory with subtitle files |
[in] | regex | - Regular expression to select subtitle files |
[in] | depth | - Recursively scan for subtitles, should be 0. |
[in] | f | - Funtion to be called for each file found |
Definition at line 7570 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), filename(), and foreach_subtitle_file().
Referenced by add_external_subtitle_streams(), and foreach_subtitle_file().
|
protected |
Free filter sinks.
Definition at line 6712 of file ffmpeg_transcoder.cc.
References m_buffer_sink_context, m_buffer_source_context, and m_filter_graph.
Referenced by close_input_file().
|
protected |
Calculate aspect ratio for width/height and sample aspect ratio (sar).
[in] | width | - Video width in pixels. |
[in] | height | - Video height in pixels. |
[in] | sar | - Aspect ratio of input video. |
[in] | ar | - Calulcated aspect ratio, if computeable. |
Definition at line 1457 of file ffmpeg_transcoder.cc.
Referenced by get_video_size().
|
protected |
Callback to negotiate the pixelFormat
[in] | input_codec_ctx | - Input codec context |
[in] | pix_fmts | is the list of formats which are supported by the codec, it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. The first is always the native one. |
Definition at line 6813 of file ffmpeg_transcoder.cc.
References Logging::error(), filename(), FFmpeg_Base::get_pix_fmt_name(), m_dec_hw_pix_fmt, FFMPEGFS_PARAMS::m_hwaccel_dec_device_type, and params.
Referenced by get_format_static().
|
staticprotected |
Callback to negotiate the pixelFormat
[in] | input_codec_ctx | - Input codec context |
[in] | pix_fmts | is the list of formats which are supported by the codec, it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. The first is always the native one. |
Definition at line 6807 of file ffmpeg_transcoder.cc.
References get_format().
Referenced by hwdevice_ctx_add_ref().
|
protected |
Get the hardware codec name as string. This is required, because e.g. the name for the software codec is libx264, but for hardware it is h264_vaapi under VAAPI.
[in] | codec_id | - Id of encoder/decoder codec |
[out] | codec_name | - Returns the name of the codec, may be nullptr if not requitred. |
Tested and working: VA-API, MMAL and OMX.
Some VA-API formats do not yet work, see "fixit"
V4LM2M: implemented, but untested NIVIDA/CUDA: implemented, but untested
Definition at line 7060 of file ffmpeg_transcoder.cc.
References get_hw_mmal_decoder_name(), get_hw_vaapi_codec_name(), FFMPEGFS_PARAMS::m_hwaccel_dec_API, MMAL, params, and VAAPI.
|
protected |
Get the hardware codec name as string. This is required, because e.g. the name for the software codec is libx264, but for hardware it is h264_vaapi under VAAPI.
[in] | codec_id | - Id of encoder/decoder codec |
[out] | codec_name | - Returns the name of the codec, may be nullptr if not requitred. |
Definition at line 7105 of file ffmpeg_transcoder.cc.
References get_hw_omx_encoder_name(), get_hw_vaapi_codec_name(), FFMPEGFS_PARAMS::m_hwaccel_enc_API, OMX, params, and VAAPI.
Referenced by add_stream(), and open_bestmatch_video().
|
protected |
Determine MMAL decoder codec name.
[in] | codec_id | - Id of encoder/decoder codec |
[out] | codec_name | - Name of the codec. |
*** MMAL decoder ***
h264_mmal h264 (mmal) (codec h264) mpeg2_mmal mpeg2 (mmal) (codec mpeg2video) mpeg4_mmal mpeg4 (mmal) (codec mpeg4) vc1_mmal vc1 (mmal) (codec vc1)
Definition at line 7238 of file ffmpeg_transcoder.cc.
Referenced by get_hw_decoder_name().
|
protected |
Determine OMX encoder codec name.
[in] | codec_id | - Id of encoder/decoder codec |
[out] | codec_name | - Name of the codec. |
*** Openmax encoder ***
h264_omx OpenMAX IL H.264 video encoder (codec h264)
Definition at line 7385 of file ffmpeg_transcoder.cc.
Referenced by get_hw_encoder_name().
|
protected |
Determine the hardware pixel format for the codec, if applicable.
[in] | codec | - Input codec used |
[in] | dev_type | - Hardware device type |
[in] | use_device_ctx | - If true checks for pix format if using a hardware device context, for a pix format using a hardware frames context otherwise. |
Definition at line 917 of file ffmpeg_transcoder.cc.
References Logging::debug(), Logging::error(), and hwdevice_get_type_name().
Referenced by add_stream().
|
protected |
Determine video for linux encoder codec name.
[in] | codec_id | - Id of encoder/decoder codec |
[out] | codec_name | - Name of the codec. |
h263_v4l2m2m V4L2 mem2mem H.263 encoder wrapper (codec h263) h264_v4l2m2m V4L2 mem2mem H.264 encoder wrapper (codec h264) hevc_v4l2m2m V4L2 mem2mem HEVC encoder wrapper (codec hevc) mpeg4_v4l2m2m V4L2 mem2mem MPEG4 encoder wrapper (codec mpeg4) vp8_v4l2m2m V4L2 mem2mem VP8 encoder wrapper (codec vp8)
Definition at line 7410 of file ffmpeg_transcoder.cc.
|
protected |
Determine VAAPI codec name.
[in] | codec_id | - Id of encoder/decoder codec |
[out] | codec_name | - Name of the codec. |
*** Intel VAAPI de/encoder ***
h264_vaapi H.264/AVC (VAAPI) (codec h264) hevc_vaapi H.265/HEVC (VAAPI) (codec hevc) mjpeg_vaapi MJPEG (VAAPI) (codec mjpeg) mpeg2_vaapi MPEG-2 (VAAPI) (codec mpeg2video) vp1_vaapi VC1 (VAAPI) (codec vc1) seems to be possible on my hardware vp8_vaapi VP8 (VAAPI) (codec vp8) vp9_vaapi VP9 (VAAPI) (codec vp9)
Program terminated with signal SIGSEGV, Segmentation fault. #0 __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:383 383 ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: Datei oder Verzeichnis nicht gefunden. [Current thread is 1 (Thread 0x7f95a24d4700 (LWP 16179))] (gdb) bt #0 __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:383 #1 0x00007f95903c4e26 in ?? () from /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so #2 0x00007f95aaae80b8 in vaGetImage () from /lib/x86_64-linux-gnu/libva.so.2 #3 0x00007f95af524bb5 in ?? () from /lib/x86_64-linux-gnu/libavutil.so.56 #4 0x00007f95af5250fb in ?? () from /lib/x86_64-linux-gnu/libavutil.so.56 #5 0x00007f95af51c37f in av_hwframe_transfer_data () from /lib/x86_64-linux-gnu/libavutil.so.56 #6 0x00007f95af51c406 in av_hwframe_transfer_data () from /lib/x86_64-linux-gnu/libavutil.so.56 #7 0x0000555da4fde146 in FFmpeg_Transcoder::decode_video_frame (this=0x7f9598002e90, pkt=0x7f95a24d2f90, decoded=0x7f95a24d2ec4) at ffmpeg_transcoder.cc:2655 #8 0x0000555da4fde5cd in FFmpeg_Transcoder::decode_frame (this=0x7f9598002e90, pkt=0x7f95a24d2f90) at ffmpeg_transcoder.cc:2852 #9 0x0000555da4fdea4b in FFmpeg_Transcoder::read_decode_convert_and_store (this=0x7f9598002e90, finished=0x7f95a24d3030) at ffmpeg_transcoder.cc:3189 #10 0x0000555da4fdfa73 in FFmpeg_Transcoder::process_single_fr (this=this@entry=0x7f9598002e90, status=@0x7f95a24d3134: 0) at ffmpeg_transcoder.cc:3987 #11 0x0000555da4f8c997 in transcoder_thread (arg=optimized out) at transcode.cc:874 #12 0x0000555da4fc54ef in thread_pool::loop_function (this=0x7f959c002b40) at thread_pool.cc:78 #13 0x00007f95aeaf4c10 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #14 0x00007f95ae9f0ea7 in start_thread (arg=optimized out) at pthread_create.c:477 #15 0x00007f95ae920d4f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Definition at line 7150 of file ffmpeg_transcoder.cc.
Referenced by get_hw_decoder_name(), and get_hw_encoder_name().
|
protected |
Calculate next HLS segment from position.
[in] | pos | - Current transcoder position in AV_TIMEBASE fractional seconds. |
Definition at line 7506 of file ffmpeg_transcoder.cc.
References FFMPEGFS_PARAMS::m_segment_duration, and params.
Referenced by decode_video_frame(), process_single_fr(), and store_packet().
|
protected |
Get subtitle stream for the stream index.
[in] | stream_idx | - Stream index to get subtitle stream for |
Definition at line 7533 of file ffmpeg_transcoder.cc.
References m_out, and FFmpeg_Transcoder::INPUTFILE::m_subtitle.
Referenced by encode_subtitle(), open_output(), and store_packet().
|
staticprotected |
Calculate output bit rate based on user option.
[in] | input_bit_rate | - Bit rate from input file. |
[in] | max_bit_rate | - Max. bit rate if set by user. |
[in] | output_bit_rate | - Selected output bit rate. |
Definition at line 1437 of file ffmpeg_transcoder.cc.
Referenced by add_stream(), audio_size(), can_copy_stream(), and video_size().
|
staticprotected |
Calculate output sample rate based on user option.
[in] | input_sample_rate | - Sample rate from input file. |
[in] | max_sample_rate | - Max. sample rate if set by user |
[in] | output_sample_rate | - Selected output sample rate. |
Definition at line 1417 of file ffmpeg_transcoder.cc.
Referenced by add_stream(), and audio_size().
|
protected |
Get correct input and output pixel format.
[in] | output_codec_ctx | - Output codec context. |
[out] | in_pix_fmt | - Input pixel format. |
[out] | out_pix_fmt | - Output pixel format. |
Definition at line 7471 of file ffmpeg_transcoder.cc.
References find_sw_fmt_by_hw_type(), FFmpeg_Transcoder::StreamRef::m_codec_ctx, FFMPEGFS_PARAMS::m_hwaccel_dec_device_type, m_hwaccel_enable_dec_buffering, m_hwaccel_enable_enc_buffering, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::INPUTFILE::m_video, and params.
Referenced by open_output_frame_set().
|
staticprotected |
Calculate the appropriate bitrate for a ProRes file given several parameters.
[in] | width | - Video width in pixels. |
[in] | height | - Video height in pixels. |
[in] | framerate | - Video frame rate. |
[in] | interleaved | - If true, video is interleaved; false if not. |
[in] | profile | - Selected ProRes profile. |
Definition at line 5659 of file ffmpeg_transcoder.cc.
References m_prores_bitrate, and MAX_PRORES_FRAMERATE.
Referenced by video_size().
|
protected |
Get the size of the output video based on user selection and apsect ratio.
[in] | output_width | - Output video width. |
[in] | output_height | - Output video height. |
Definition at line 1501 of file ffmpeg_transcoder.cc.
References get_aspect_ratio(), m_in, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::INPUTFILE::m_video, FFMPEGFS_PARAMS::m_videoheight, FFMPEGFS_PARAMS::m_videowidth, and params.
Referenced by add_stream().
|
protected |
Check if segment number is next designated segment.
[in] | next_segment | - Number next current segment |
Definition at line 7511 of file ffmpeg_transcoder.cc.
References m_current_segment.
Referenced by decode_video_frame(), process_single_fr(), and store_packet().
bool FFmpeg_Transcoder::have_seeked | ( | ) | const |
Check if we made a seek operation.
Definition at line 6802 of file ffmpeg_transcoder.cc.
References m_have_seeked.
Referenced by transcode_finish(), and transcoder_thread().
|
protected |
Add reference to hardware device context.
[in] | input_codec_ctx | - Input codec context |
Definition at line 6856 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), get_format_static(), m_hwaccel_dec_device_ctx, and virtname().
|
protected |
Open a device of the specified type and create an AVHWDeviceContext for it.
This is a convenience function intended to cover the simple cases. Callers who need to fine-tune device creation/management should open the device manually and then wrap it in an AVHWDeviceContext using av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init().
The returned context is already initialized and ready for use, the caller should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of the created AVHWDeviceContext are set by this function and should not be touched by the caller.
[out] | hwaccel_enc_device_ctx | - On success, a reference to the newly-created device context will be written here. |
[in] | dev_type | - The type of the device to create. |
[in] | device | - A type-specific string identifying the device to open. |
Definition at line 6837 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), hwdevice_get_type_name(), and virtname().
Referenced by open_bestmatch_video().
|
protected |
Free (remove reference) to hardware device context.
[in,out] | hwaccel_device_ctx | - Hardware device context to free |
Definition at line 6879 of file ffmpeg_transcoder.cc.
Referenced by closeio(), and open_output().
|
protected |
Copy data hardware surface to software.
[in] | output_codec_ctx | - Codec context |
[in,out] | sw_frame | - AVFrame to copy data to |
[in] | hw_frame | - AVFrame to copy data from |
Definition at line 6993 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), and filename().
|
protected |
Copy data software to a hardware surface.
[in] | output_codec_ctx | - Codec context |
[in,out] | hw_frame | - AVFrame to copy data to |
[in] | sw_frame | - AVFrame to copy data from |
Definition at line 7014 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), and virtname().
Referenced by encode_video_frame().
|
protected |
Adds a reference to an existing decoder hardware frame context or allocates a new AVHWFramesContext tied to the given hardware device context if if the decoder runs in software.
[in] | output_codec_ctx | - Encoder codexc context |
[in] | input_codec_ctx | - Decoder codexc context |
[in] | hw_device_ctx | - Existing hardware device context |
Definition at line 6888 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), find_sw_fmt_by_hw_type(), m_enc_hw_pix_fmt, FFMPEGFS_PARAMS::m_hwaccel_enc_device_type, params, and virtname().
Referenced by add_stream().
const ID3v1 * FFmpeg_Transcoder::id3v1tag | ( | ) | const |
Assemble an ID3v1 file tag.
Definition at line 6215 of file ffmpeg_transcoder.cc.
References FFmpeg_Transcoder::OUTPUTFILE::m_id3v1, and m_out.
Referenced by transcode().
|
protected |
Initialise a FIFO buffer for the audio samples to be encoded.
Definition at line 2884 of file ffmpeg_transcoder.cc.
References Logging::error(), FFmpeg_Base::get_channels(), FFmpeg_Transcoder::INPUTFILE::m_audio, m_audio_fifo, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_out, and virtname().
Referenced by open_output().
|
protected |
Initialise one input frame for writing to the output file. The frame will be exactly frame_size samples large.
[in] | frame | - Newly initialised frame. |
[in] | frame_size | - Size of new frame. |
Definition at line 4173 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_out, and virtname().
Referenced by create_audio_frame().
|
protected |
Initialise a temporary storage for the specified number of audio samples. The conversion requires temporary storage due to the different format. The number of audio samples to be allocated is specified in frame_size.
[out] | converted_input_samples | - Memory for input samples. |
[in] | frame_size | - Size of one frame. |
Definition at line 3914 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), FFmpeg_Base::get_channels(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_out, and virtname().
Referenced by decode_audio_frame().
|
protected |
Initialise video filters.
[in] | codec_ctx | - AVCodecContext object of output video. |
[in] | pix_fmt | - Output stream pixel format. |
[in] | avg_frame_rate | - Average output stream frame rate. |
[in] | time_base | - Output stream time base. |
Definition at line 6513 of file ffmpeg_transcoder.cc.
References Logging::debug(), Logging::error(), ffmpeg_geterror(), m_buffer_sink_context, m_buffer_source_context, m_filter_graph, strsprintf(), and virtname().
Referenced by open_output_filestreams(), and open_output_frame_set().
|
protected |
Initialize the audio resampler based on the input and output codec settings. If the input and output sample formats differ, a conversion is required libswresample takes care of this, but requires initialization.
Definition at line 2764 of file ffmpeg_transcoder.cc.
References close_resample(), Logging::debug(), Logging::error(), ffmpeg_geterror(), format_samplerate(), FFmpeg_Base::get_channel_layout_name(), FFmpeg_Base::get_sample_fmt_name(), LAVU_DEP_OLD_CHANNEL_LAYOUT, FFmpeg_Transcoder::INPUTFILE::m_audio, m_audio_resample_ctx, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_cur_ch_layout, m_cur_sample_fmt, m_cur_sample_rate, m_in, m_out, and virtname().
Referenced by decode_audio_frame().
|
protected |
Init image size rescaler and pixel format converter.
[in] | in_pix_fmt | - Input pixel format |
[in] | in_width | - Input image width |
[in] | in_height | - Input image height |
[in] | out_pix_fmt | - Output pixel format |
[in] | out_width | - Output image width |
[in] | out_height | - Output pixel format |
Definition at line 1594 of file ffmpeg_transcoder.cc.
References Logging::debug(), Logging::error(), FFmpeg_Base::get_pix_fmt_name(), m_sws_ctx, Logging::trace(), and virtname().
Referenced by open_output_frame_set().
|
staticprotected |
Custom read function for FFmpeg.
Read from virtual files, may be a physical file but also a DVD, VCD or Blu-ray chapter.
[in] | opaque | - Payload given to FFmpeg, basically the FileIO object |
[in] | data | - Returned data read from file. |
[in] | size | - Size of data buffer. |
Definition at line 6220 of file ffmpeg_transcoder.cc.
References FileIO::eof(), FileIO::error(), Logging::error(), and FileIO::readio().
Referenced by open_input_file().
|
protected |
Check for audio stream.
[in] | stream_idx | - ID of stream to check |
Definition at line 7516 of file ffmpeg_transcoder.cc.
References FFmpeg_Transcoder::INPUTFILE::m_audio, m_in, FFmpeg_Transcoder::StreamRef::m_stream_idx, and stream_exists().
Referenced by decode(), decode_frame(), flush_frames_single(), process_metadata(), and read_decode_convert_and_store().
bool FFmpeg_Transcoder::is_frameset | ( | ) | const |
Check for an export frame format.
Definition at line 6778 of file ffmpeg_transcoder.cc.
References FFmpegfs_Format::is_frameset(), and m_current_format.
Referenced by decode_frame(), encode_finish(), flush_delayed_video(), flush_frames_single(), open_output_file(), process_single_fr(), and transcode().
bool FFmpeg_Transcoder::is_hls | ( | ) | const |
Check for HLS format.
Definition at line 6790 of file ffmpeg_transcoder.cc.
References FFmpegfs_Format::is_hls(), and m_current_format.
Referenced by decode_video_frame(), encode_finish(), open_output(), process_single_fr(), store_packet(), and transcode().
bool FFmpeg_Transcoder::is_multiformat | ( | ) | const |
Check for an export frame format.
Definition at line 6765 of file ffmpeg_transcoder.cc.
References FFmpegfs_Format::is_multiformat(), and m_current_format.
Referenced by transcode_finish().
bool FFmpeg_Transcoder::is_open | ( | ) | const |
Check if input file is already open.
Definition at line 289 of file ffmpeg_transcoder.cc.
References FFmpeg_Transcoder::INPUTFILE::m_format_ctx, and m_in.
Referenced by open_input_file().
|
protected |
Check for subtitle stream.
[in] | stream_idx | - ID of stream to check |
Definition at line 7526 of file ffmpeg_transcoder.cc.
References m_in, and FFmpeg_Transcoder::INPUTFILE::m_subtitle.
Referenced by decode_frame().
|
protected |
FFmpeg handles cover arts like video streams. Try to find out if we have a video stream or a cover art.
Definition at line 277 of file ffmpeg_transcoder.cc.
References is_album_art(), is_video(), FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_in, FFmpeg_Transcoder::StreamRef::m_stream, and FFmpeg_Transcoder::INPUTFILE::m_video.
Referenced by is_video(), and open_bestmatch_video().
|
protected |
Check for video stream.
[in] | stream_idx | - ID of stream to check |
Definition at line 7521 of file ffmpeg_transcoder.cc.
References m_in, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, and stream_exists().
Referenced by decode(), decode_frame(), flush_frames_single(), and process_metadata().
uint32_t FFmpeg_Transcoder::last_seek_frame_no | ( | ) | const |
Current seek frame if available.
Definition at line 7851 of file ffmpeg_transcoder.cc.
References m_last_seek_frame_no.
Referenced by transcoder_thread().
|
protected |
Create PTS/DTS and update the packet. If the update packet lacks time stamps, create a fictitious PTS or DTS and update it. If the packet already has valid time stamps, nothing is changed.
[in,out] | pkt | - Audio/video packet to update. |
[in,out] | cur_ts | - Current time stamp, will be updated to the next position. |
Definition at line 3718 of file ffmpeg_transcoder.cc.
Referenced by decode_frame().
|
protected |
Map input stream index to output stream index.
[in] | in_stream_idx | - Index of input stream |
Definition at line 7558 of file ffmpeg_transcoder.cc.
References INVALID_STREAM, and m_stream_map.
Referenced by add_subtitle_streams(), decode_subtitle(), and open_output().
time_t FFmpeg_Transcoder::mtime | ( | ) | const |
Get last modification time of file.
Definition at line 4877 of file ffmpeg_transcoder.cc.
References m_mtime.
|
protected |
open_albumarts
Definition at line 749 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), filename(), is_album_art(), FFmpeg_Transcoder::INPUTFILE::m_album_art, FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, FFMPEGFS_PARAMS::m_noalbumarts, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, open_decoder(), params, FFmpeg_Transcoder::StreamRef::set_codec_ctx(), and Logging::trace().
Referenced by open_input_file().
|
protected |
Open the best match audio stream.
Definition at line 666 of file ffmpeg_transcoder.cc.
References FFmpeg_Base::audio_info(), BLURAY, DVD, Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), filename(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, VIRTUALFILE::m_type, FFmpeg_Base::m_virtualfile, open_bestmatch_decoder(), FFmpeg_Transcoder::StreamRef::set_codec_ctx(), and stream_exists().
Referenced by open_input_file().
|
protected |
Find best match stream and open codec context for it.
[in] | format_ctx | - Output format context |
[out] | codec_ctx,- | Newly created codec context |
[in] | stream_idx | - Stream index of new stream. |
[in] | type | - Type of media: audio or video. |
Definition at line 889 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), filename(), get_media_type_string(), INVALID_STREAM, and open_decoder().
Referenced by add_external_subtitle_stream(), open_bestmatch_audio(), and open_bestmatch_video().
|
protected |
Open the best match video stream, if present in input file.
Definition at line 578 of file ffmpeg_transcoder.cc.
References BLURAY, Logging::debug(), DVD, Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), filename(), get_codec_name(), get_hw_encoder_name(), get_hwaccel_API_text(), hwdevice_ctx_create(), Logging::info(), is_video(), FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_current_format, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_hwaccel_enable_enc_buffering, FFMPEGFS_PARAMS::m_hwaccel_enc_API, FFMPEGFS_PARAMS::m_hwaccel_enc_device, m_hwaccel_enc_device_ctx, FFMPEGFS_PARAMS::m_hwaccel_enc_device_type, m_in, m_is_video, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, VIRTUALFILE::m_type, FFmpeg_Transcoder::INPUTFILE::m_video, FFmpeg_Base::m_virtualfile, open_bestmatch_decoder(), params, FFmpeg_Transcoder::StreamRef::set_codec_ctx(), stream_exists(), Logging::trace(), FFmpegfs_Format::video_codec(), FFmpeg_Base::video_info(), and virtname().
Referenced by open_input_file().
|
protected |
Open codec context for stream_idx.
[in] | format_ctx | - Output format context |
[out] | codec_ctx | - Newly created codec context |
[in] | stream_idx | - Stream index of new stream. |
[in] | input_codec | - Decoder codec to open, may be nullptr. Will open a matching codec automatically. |
[in] | mediatype | - Type of media: audio or video. |
Definition at line 950 of file ffmpeg_transcoder.cc.
References check_hwaccel_dec_blocked(), Logging::debug(), Logging::error(), ffmpeg_geterror(), get_codec_name(), get_hwaccel_API_text(), get_media_type_string(), Logging::info(), FFMPEGFS_PARAMS::m_hwaccel_dec_API, FFMPEGFS_PARAMS::m_hwaccel_dec_device, FFMPEGFS_PARAMS::m_hwaccel_dec_device_type, params, and Logging::trace().
Referenced by open_albumarts(), open_bestmatch_decoder(), and open_subtitles().
int FFmpeg_Transcoder::open_input_file | ( | LPVIRTUALFILE | virtualfile, |
std::shared_ptr< FileIO > | fio = nullptr |
||
) |
Open the given FFmpeg file and prepare for decoding. Collect information for the file (duration, bitrate, etc.). After this function, the other methods can be used to process the file.
[in,out] | virtualfile | - Virtualfile object for desired file. May be a physical file, a DVD, Blu-ray or video CD |
[in,out] | fio | - Pass an already open fileio object. Normally the file is opened, but if this parameter is not nullptr the already existing object is used. |
Definition at line 294 of file ffmpeg_transcoder.cc.
References FileIO::alloc(), BLURAY, calculate_predicted_filesize(), FFMPEGFS_PARAMS::current_format(), Logging::debug(), FFmpeg_Base::dict_set_with_check(), DVD, Logging::error(), FF_INPUT_BUFFER_PADDING_SIZE, ffmpeg_geterror(), ffmpeg_rescale_q(), filename(), get_filetype_from_list(), input_read(), is_open(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, VIRTUALFILE::m_cuesheet_track, m_current_format, VIRTUALFILE::m_duration, m_fileio, FFmpeg_Transcoder::INPUTFILE::m_filetype, VIRTUALFILE::m_flags, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, VIRTUALFILE::m_framerate, VIRTUALFILE::m_height, m_in, m_mtime, FFMPEGFS_PARAMS::m_no_subtitles, VIRTUALFILE::m_predicted_size, VIRTUALFILE::m_st, VIRTUALFILE::CUESHEET_TRACK::m_start, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, VIRTUALFILE::m_type, FFmpeg_Transcoder::INPUTFILE::m_video, VIRTUALFILE::m_video_frame_count, FFmpeg_Base::m_virtualfile, VIRTUALFILE::m_width, open_albumarts(), open_bestmatch_audio(), open_bestmatch_video(), open_subtitles(), params, seek(), stream_exists(), VCD, VIRTUALFLAG_CUESHEET, and Logging::warning().
Referenced by transcode(), and transcoder_predict_filesize().
|
protected |
Open output file. Data will actually be written to buffer and copied by FUSE when accessed.
[in] | buffer | - Stream buffer to operate on |
Definition at line 1263 of file ffmpeg_transcoder.cc.
References FFmpeg_Base::audio_info(), CACHE_FLAG_RW, close_output_file(), ENABLED, FALLBACK, ffmpeg_rescale_q_rnd(), get_out_subtitle_stream(), VIRTUALFILE::get_segment_count(), hwdevice_ctx_free(), Logging::info(), init_audio_fifo(), is_hls(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::OUTPUTFILE::m_audio_pts, m_buffer, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_current_format, m_current_segment, m_enc_hw_pix_fmt, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_hwaccel_enable_enc_buffering, m_hwaccel_enc_device_ctx, m_hwaccel_enc_mode, m_in, m_insert_keyframe, FFmpeg_Transcoder::OUTPUTFILE::m_last_mux_dts, m_out, FFmpeg_Transcoder::StreamRef::m_start_time, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_subtitle, FFmpeg_Transcoder::INPUTFILE::m_video, FFmpeg_Transcoder::OUTPUTFILE::m_video_pts, FFmpeg_Base::m_virtualfile, map_in_to_out_stream(), Buffer::open_file(), open_output_filestreams(), predicted_filesize(), process_output(), stream_exists(), FFmpeg_Base::subtitle_info(), FFmpegfs_Format::video_codec(), FFmpeg_Base::video_info(), and virtname().
Referenced by open_output_file(), and start_new_segment().
int FFmpeg_Transcoder::open_output_file | ( | Buffer * | buffer | ) |
Open output file. Data will actually be written to buffer and copied by FUSE when accessed.
[in] | buffer | - Cache buffer to be written. |
Definition at line 856 of file ffmpeg_transcoder.cc.
References Logging::debug(), FFmpegfs_Format::desttype(), Logging::error(), FFmpegfs_Format::filetype(), is_frameset(), FFmpeg_Transcoder::INPUTFILE::m_audio, m_current_format, FFmpeg_Transcoder::INPUTFILE::m_filetype, VIRTUALFILE::m_flags, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Base::m_virtualfile, open_output(), open_output_frame_set(), stream_exists(), FFmpegfs_Format::video_codec(), virtname(), and VIRTUALFLAG_HIDDEN.
Referenced by transcode().
|
protected |
Open an output file and the required encoder. Also set some basic encoder parameters. Some of these parameters are based on the input file's parameters.
[in] | buffer | - Stream buffer to operate on |
Definition at line 2563 of file ffmpeg_transcoder.cc.
References add_albumart_stream(), add_external_subtitle_streams(), add_stream(), add_stream_copy(), add_subtitle_streams(), FFmpegfs_Format::albumart_supported(), FFmpegfs_Format::audio_codec(), can_copy_stream(), Logging::debug(), FFmpegfs_Format::desttype(), Logging::error(), FF_INPUT_BUFFER_PADDING_SIZE, FFMPEGFS_AUDIO, FFMPEGFS_VIDEO, FFmpegfs_Format::filetype(), FFmpegfs_Format::format_name(), Logging::info(), init_deinterlace_filters(), INVALID_STREAM, m_active_stream_msk, FFmpeg_Transcoder::INPUTFILE::m_album_art, FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_copy_audio, m_copy_video, m_current_format, FFMPEGFS_PARAMS::m_deinterlace, FFmpeg_Transcoder::INPUTFILE::m_filetype, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, m_inhibit_stream_msk, m_is_video, FFMPEGFS_PARAMS::m_noalbumarts, m_out, FFmpeg_Transcoder::INPUTFILE::m_pix_fmt, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_subtitle, FFmpeg_Transcoder::INPUTFILE::m_video, output_write(), params, seek(), stream_exists(), FFmpegfs_Format::video_codec(), and virtname().
Referenced by open_output().
|
protected |
Open output frame set. Data will actually be written to buffer and copied by FUSE when accessed.
[in] | buffer | - Stream buffer to operate on |
Definition at line 1113 of file ffmpeg_transcoder.cc.
References CACHE_FLAG_RW, Logging::debug(), FFmpeg_Base::dict_set_with_check(), Logging::error(), FFmpeg_Base::get_pix_fmt_name(), get_pix_formats(), init_deinterlace_filters(), init_rescaler(), INVALID_STREAM, FFmpeg_Transcoder::INPUTFILE::m_audio, m_buffer, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_current_format, FFMPEGFS_PARAMS::m_deinterlace, m_have_seeked, m_in, m_out, FFmpeg_Transcoder::INPUTFILE::m_pix_fmt, m_seek_to_fifo, m_seek_to_fifo_mutex, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, Buffer::open_file(), params, predicted_filesize(), FFmpeg_Transcoder::StreamRef::set_codec_ctx(), FFmpegfs_Format::video_codec(), video_frame_count(), and virtname().
Referenced by open_output_file().
|
protected |
Open all subtitles streams, if present in input file and if supported by output file. The input and output codec type must also match: Can only transcode bitmap subtitles into bitmap subtitles or text to text.
Definition at line 705 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), filename(), m_current_format, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_subtitle, open_decoder(), FFmpeg_Transcoder::StreamRef::set_codec_ctx(), FFmpegfs_Format::subtitle_codec(), and FFmpeg_Base::subtitle_info().
Referenced by open_input_file().
|
staticprotected |
Custom write function for FFmpeg.
[in] | opaque | - Payload given to FFmpeg, basically the FileIO object |
[in] | data | - Data to be written |
[in] | size | - Size of data block. |
Definition at line 6248 of file ffmpeg_transcoder.cc.
References Logging::error(), and Buffer::writeio().
Referenced by open_output_filestreams().
size_t FFmpeg_Transcoder::predicted_filesize | ( | ) | const |
Try to predict the recoded file size. This may (better will surely) be inaccurate.
Definition at line 6164 of file ffmpeg_transcoder.cc.
References FFmpeg_Base::m_virtualfile, and SAFE_VALUE.
Referenced by create_fake_aiff_header(), create_fake_wav_header(), open_output(), open_output_frame_set(), transcode(), and transcoder_predict_filesize().
|
protected |
Prepare codec options for a file type.
[in] | opt | - Codec private data. |
[in] | filetype | - File type: MP3, MP4 etc. |
Definition at line 1578 of file ffmpeg_transcoder.cc.
References FFmpeg_Profiles::m_profile, FFMPEGFS_PARAMS::m_profile, params, and update_codec().
|
protected |
Prepare format optimisations.
[in] | dict | - Dictionary to update. |
[in] | filetype | - File type: MP3, MP4 etc. |
Definition at line 2925 of file ffmpeg_transcoder.cc.
References FFmpeg_Profiles::m_profile, FFMPEGFS_PARAMS::m_profile, params, and update_format().
Referenced by write_output_file_header().
|
protected |
Copy all album arts from source to target.
Definition at line 5011 of file ffmpeg_transcoder.cc.
References add_albumart_frame(), FFmpeg_Transcoder::INPUTFILE::m_album_art, m_in, and m_out.
Referenced by process_output().
|
protected |
Copy metadata from source to target.
Definition at line 4959 of file ffmpeg_transcoder.cc.
References copy_metadata(), FFmpeg_Base::dict_set_with_check(), is_audio_stream(), is_video_stream(), VIRTUALFILE::CUESHEET_TRACK::m_album, FFmpeg_Transcoder::INPUTFILE::m_album_art, VIRTUALFILE::CUESHEET_TRACK::m_artist, FFmpeg_Transcoder::INPUTFILE::m_audio, VIRTUALFILE::m_cuesheet_track, VIRTUALFILE::CUESHEET_TRACK::m_date, VIRTUALFILE::m_flags, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, VIRTUALFILE::CUESHEET_TRACK::m_genre, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_stream, VIRTUALFILE::CUESHEET_TRACK::m_title, VIRTUALFILE::CUESHEET_TRACK::m_trackno, VIRTUALFILE::CUESHEET_TRACK::m_tracktotal, FFmpeg_Transcoder::INPUTFILE::m_video, FFmpeg_Base::m_virtualfile, Logging::trace(), virtname(), and VIRTUALFLAG_CUESHEET.
Referenced by process_output().
|
protected |
Process headers of output file Write file header, process meta data and add album arts.
Definition at line 1396 of file ffmpeg_transcoder.cc.
References process_albumarts(), process_metadata(), and write_output_file_header().
Referenced by open_output(), and start_new_segment().
int FFmpeg_Transcoder::process_single_fr | ( | DECODER_STATUS * | status | ) |
Process a single frame of audio data. The encode_pcm_data() method of the Encoder will be used to process the resulting audio data, with the result going into the given Buffer.
[out] | status | - On success, returns DECODER_SUCCESS; if at EOF, returns DECODER_EOF; on error, returns DECODER_ERROR |
Definition at line 5251 of file ffmpeg_transcoder.cc.
References copy_audio_to_frame_buffer(), DEC_EOF, DEC_ERROR, DEC_SUCCESS, encode_audio_frame(), encode_image_frame(), encode_subtitle(), encode_video_frame(), Logging::error(), flush_delayed_audio(), flush_delayed_subtitles(), flush_delayed_video(), get_next_segment(), goto_next_segment(), is_frameset(), is_hls(), m_active_stream_msk, FFmpeg_Transcoder::INPUTFILE::m_audio, m_copy_audio, m_frame_map, m_in, m_inhibit_stream_msk, m_out, FFMPEGFS_PARAMS::m_segment_duration, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Frame::m_stream_idx, FFmpeg_Subtitle::m_stream_idx, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, params, read_decode_convert_and_store(), seek_frame(), start_new_segment(), stream_exists(), and virtname().
Referenced by transcode().
|
protected |
Produce audio dts/pts. This is required because the target codec usually has a different frame size than the source, so the number of packets will not match 1:1.
[in] | pkt | - Packet to add dts/pts to. |
Definition at line 4212 of file ffmpeg_transcoder.cc.
References FFmpegfs_Format::filetype(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::StreamRef::m_codec_ctx, m_current_format, and m_out.
Referenced by encode_audio_frame().
int64_t FFmpeg_Transcoder::pts | ( | ) | const |
Get PTS (presentation time stamp) of decoded audio/video so far.
Definition at line 7837 of file ffmpeg_transcoder.cc.
References m_frame_map.
Referenced by transcode().
|
protected |
Purge FIFO and map buffers and report lost packets/frames/samples.
Definition at line 6359 of file ffmpeg_transcoder.cc.
References FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_out, VIRTUALFILE::m_virtfile, FFmpeg_Base::m_virtualfile, purge_audio_fifo(), purge_hls_fifo(), purge_multiframe_map(), and Logging::warning().
Referenced by close_output_file().
|
protected |
Purge all samples in audio FIFO.
Definition at line 6321 of file ffmpeg_transcoder.cc.
References m_audio_fifo.
Referenced by purge().
|
protected |
Purge all packets in HLS FIFO buffer.
Definition at line 6344 of file ffmpeg_transcoder.cc.
References m_hls_packet_fifo.
Referenced by purge(), and start_new_segment().
|
protected |
Purge all frames in buffer.
Definition at line 6335 of file ffmpeg_transcoder.cc.
References m_frame_map.
Referenced by purge().
|
protected |
Read AIFF chunk.
[in] | buffer | - Cache buffer to read from |
[in,out] | buffoffset | - Byte offset into buffer. Upon return holds offset to the position of the chunk. |
[in] | ID | - Chunk ID (fourCC) |
[out] | chunk | - Buffer for chunk |
[in,out] | size | - Size of chunk. Buffer for chunk must be large enough to hold it. Upon return holds the actual size of the chunk read. |
Definition at line 3006 of file ffmpeg_transcoder.cc.
References AIFF_FORMID, Buffer::copy(), Buffer::eof(), AIFF_CHUNK::m_ckID, and AIFF_CHUNK::m_ckSize.
Referenced by create_fake_aiff_header().
|
protected |
Read frame from source file, decode and store in FIFO.
[in] | finished | - 1 if at EOF. |
<*
Definition at line 4102 of file ffmpeg_transcoder.cc.
References decode_frame(), Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), flush_frames_all(), is_audio_stream(), FFmpeg_Transcoder::INPUTFILE::m_audio, VIRTUALFILE::m_cuesheet_track, VIRTUALFILE::CUESHEET_TRACK::m_duration, VIRTUALFILE::m_flags, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, VIRTUALFILE::CUESHEET_TRACK::m_start, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Base::m_virtualfile, Logging::trace(), virtname(), and VIRTUALFLAG_CUESHEET.
Referenced by copy_audio_to_frame_buffer(), and process_single_fr().
|
staticprotected |
FFmpeg_Transcoder::read_packet.
[in] | opaque | |
[in] | buf | |
[in] | buf_size |
Definition at line 7618 of file ffmpeg_transcoder.cc.
References FFmpeg_Transcoder::BUFFER_DATA::ptr, and FFmpeg_Transcoder::BUFFER_DATA::size.
Referenced by add_external_subtitle_stream().
|
staticprotected |
Custom seek function for FFmpeg.
Write to virtual files, currently only physical files.
[in] | opaque | - Payload given to FFmpeg, basically the FileIO object |
[in] | offset | - Offset to seek to. |
[in] | whence | - One of the regular seek() constants like SEEK_SET/SEEK_END. Additionally FFmpeg constants like AVSEEK_SIZE are supported. |
Definition at line 6274 of file ffmpeg_transcoder.cc.
References Logging::error(), FileIO::seek(), and FileIO::size().
Referenced by open_input_file(), and open_output_filestreams().
|
protected |
Frame sets only: perform seek to a certain frame.
Definition at line 5474 of file ffmpeg_transcoder.cc.
References Buffer::have_frame(), m_buffer, m_last_seek_frame_no, m_seek_to_fifo, m_seek_to_fifo_mutex, and skip_decoded_frames().
Referenced by process_single_fr().
uint32_t FFmpeg_Transcoder::segment_count | ( | ) | const |
Get the number of HLS segments of file.
Definition at line 6174 of file ffmpeg_transcoder.cc.
References FFmpeg_Base::m_virtualfile, and SAFE_VALUE.
Referenced by stack_seek_segment(), transcode(), transcode_finish(), and transcoder_predict_filesize().
|
protected |
Send video frame to the filters.
[in,out] | srcframe | - On input video frame to process, on output video frame that was filtered. |
[in] | ret | - 0 if OK, or negative AVERROR value. |
Definition at line 6655 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), m_buffer_sink_context, m_buffer_source_context, FFmpeg_Frame::m_stream_idx, FFmpeg_Frame::res(), virtname(), and Logging::warning().
Referenced by decode_video_frame().
|
protected |
Skip decoded frames or force seek to frame_no.
[in] | frame_no | - Frame to seek to. |
[in] | forced_seek | - Force seek even if np frames skipped. |
Definition at line 5067 of file ffmpeg_transcoder.cc.
References do_seek_frame(), Logging::error(), ffmpeg_geterror(), FRAME_SEEK_THRESHOLD, Buffer::have_frame(), m_buffer, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_in, m_out, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, VIRTUALFILE::m_video_frame_count, FFmpeg_Transcoder::OUTPUTFILE::m_video_pts, FFmpeg_Base::m_virtualfile, FFmpeg_Base::pts_to_frame(), and virtname().
Referenced by seek_frame().
int FFmpeg_Transcoder::stack_seek_frame | ( | uint32_t | frame_no | ) |
Seek to a specific frame. Does not actually perform the seek, this is done asynchronously by the transcoder thread.
[in] | frame_no | - Frame number to seek 1...n |
Definition at line 6733 of file ffmpeg_transcoder.cc.
References Logging::error(), m_seek_to_fifo, m_seek_to_fifo_mutex, video_frame_count(), and virtname().
Referenced by transcode().
int FFmpeg_Transcoder::stack_seek_segment | ( | uint32_t | segment_no | ) |
Seek to a specific HLS segment. Does not actually perform the seek, this is done asynchronously by the transcoder thread.
[in] | segment_no | - Segment number to seek 1...n |
Definition at line 6749 of file ffmpeg_transcoder.cc.
References Logging::error(), m_seek_to_fifo, m_seek_to_fifo_mutex, segment_count(), video_frame_count(), and virtname().
Referenced by transcode().
|
protected |
HLS only: start a new HLS segment.
Definition at line 5528 of file ffmpeg_transcoder.cc.
References close_output_file(), encode_finish(), Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q(), FFMPEGFS_AUDIO, FFMPEGFS_VIDEO, flush_buffers(), VIRTUALFILE::get_segment_count(), Logging::info(), FFmpeg_Transcoder::INPUTFILE::m_audio, m_buffer, m_current_segment, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_have_seeked, m_hls_packet_fifo, m_in, m_inhibit_stream_msk, m_insert_keyframe, FFMPEGFS_PARAMS::m_min_seek_time_diff, m_out, VIRTUALFILE::m_predicted_size, m_reset_pts, m_seek_to_fifo, FFMPEGFS_PARAMS::m_segment_duration, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, FFmpeg_Base::m_virtualfile, open_output(), params, process_output(), purge_hls_fifo(), Buffer::segment_exists(), Buffer::set_segment(), stream_exists(), Buffer::tell(), and virtname().
Referenced by process_single_fr().
|
protected |
Store packet in output stream.
[in] | pkt | - Packet to store. |
[in] | mediatype | - Typo of packet: audio, video, image (attachment) |
Definition at line 3612 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), ffmpeg_rescale_q_rnd(), FFMPEGFS_AUDIO, FFMPEGFS_VIDEO, format_duration(), get_next_segment(), get_out_subtitle_stream(), goto_next_segment(), is_hls(), FFmpeg_Transcoder::INPUTFILE::m_audio, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_hls_packet_fifo, m_inhibit_stream_msk, m_out, FFmpeg_Transcoder::StreamRef::m_start_time, FFmpeg_Transcoder::StreamRef::m_stream, FFmpeg_Transcoder::INPUTFILE::m_video, Logging::trace(), and virtname().
Referenced by add_albumart_frame(), decode_frame(), encode_audio_frame(), encode_subtitle(), and encode_video_frame().
|
protected |
Check if stream exists.
[in] | stream_idx | - ID of stream to check |
Definition at line 7545 of file ffmpeg_transcoder.cc.
References INVALID_STREAM.
Referenced by calculate_predicted_filesize(), decode(), decode_frame(), flush_frames_single(), is_audio_stream(), is_video_stream(), open_bestmatch_audio(), open_bestmatch_video(), open_input_file(), open_output(), open_output_file(), open_output_filestreams(), process_single_fr(), start_new_segment(), and update_format().
|
protected |
Safely copy a tag to a target buffer. If the input buffer size is larger than output the data will be truncated to avoid overruns. The function never appends a /0 terminator.
[out] | out | - Target buffer |
[in] | in | - Input buffer |
Definition at line 4883 of file ffmpeg_transcoder.cc.
|
protected |
Safely copy a tag to a target buffer. If the input buffer size is larger than output the data will be truncated to avoid overruns. The function never appends a /0 terminator.
[out] | out | - Target buffer |
[in] | in | - Input buffer |
Definition at line 4891 of file ffmpeg_transcoder.cc.
|
static |
Predict overhead in file size. This may (better will surely) be inaccurate.
[out] | filesize | - Predicted file size in bytes, including overhead. |
[in] | filetype | - File type: MP3, TS etc. |
Definition at line 6010 of file ffmpeg_transcoder.cc.
Referenced by calculate_predicted_filesize(), and transcoder_set_filesize().
|
protected |
Prepare codec options.
[in] | opt | - Codec private data. |
[in] | profile_option_vec | - Selected profile option. |
Definition at line 1556 of file ffmpeg_transcoder.cc.
References m_hwaccel_enable_enc_buffering, OPT_HW_ONLY, FFmpeg_Base::opt_set_with_check(), OPT_SW_ONLY, Logging::trace(), and virtname().
Referenced by prepare_codec().
|
protected |
Update format options.
[in] | dict | - Dictionary to update. |
[in] | option_vec | - Profile option to set. |
Definition at line 2896 of file ffmpeg_transcoder.cc.
References FFmpeg_Base::dict_set_with_check(), m_out, FFmpeg_Transcoder::StreamRef::m_stream_idx, FFmpeg_Transcoder::INPUTFILE::m_video, OPT_AUDIO, OPT_VIDEO, stream_exists(), Logging::trace(), and virtname().
Referenced by prepare_format().
uint32_t FFmpeg_Transcoder::video_frame_count | ( | ) | const |
Get the number of video frames in file.
Definition at line 6169 of file ffmpeg_transcoder.cc.
References FFmpeg_Base::m_virtualfile, and SAFE_VALUE.
Referenced by open_output_frame_set(), stack_seek_frame(), stack_seek_segment(), transcode(), transcode_finish(), and transcoder_predict_filesize().
|
static |
Predict video file size. This may (better will surely) be inaccurate.
[out] | filesize | - Predicted file size in bytes, including video stream size. |
[in] | codec_id | - Target codec ID. |
[in] | bit_rate | - Target bit rate. |
[in] | duration | - File duration. |
[in] | width | - Target video width. |
[in] | height- | Target video height. |
[in] | interleaved | - True if target video is interleaved, false if not. |
[in] | framerate | - Frame rate of target video. |
Definition at line 5926 of file ffmpeg_transcoder.cc.
References BITRATE, duration(), get_output_bit_rate(), get_prores_bitrate(), FFMPEGFS_PARAMS::m_level, FFMPEGFS_PARAMS::m_videobitrate, and params.
Referenced by calculate_predicted_filesize(), and transcoder_set_filesize().
|
overridevirtual |
Return virtual filename. Same as destination filename, but with virtual (mount) path..
Implements FFmpeg_Base.
Definition at line 6507 of file ffmpeg_transcoder.cc.
References VIRTUALFILE::m_virtfile, and FFmpeg_Base::m_virtualfile.
Referenced by add_albumart_frame(), add_albumart_stream(), add_samples_to_fifo(), add_stream(), add_stream_copy(), add_subtitle_stream(), alloc_picture(), can_copy_stream(), convert_samples(), copy_metadata(), create_audio_frame(), decode_frame(), decode_subtitle(), decode_video_frame(), encode_audio_frame(), encode_image_frame(), encode_subtitle(), encode_video_frame(), flush_delayed_audio(), flush_delayed_video(), hwdevice_ctx_add_ref(), hwdevice_ctx_create(), hwframe_copy_to_hw(), hwframe_ctx_set(), init_audio_fifo(), init_audio_output_frame(), init_converted_samples(), init_deinterlace_filters(), init_resampler(), init_rescaler(), open_bestmatch_video(), open_output(), open_output_file(), open_output_filestreams(), open_output_frame_set(), process_metadata(), process_single_fr(), read_decode_convert_and_store(), send_filters(), skip_decoded_frames(), stack_seek_frame(), stack_seek_segment(), start_new_segment(), store_packet(), transcode_finish(), transcoder_thread(), update_codec(), update_format(), write_output_file_header(), and write_output_file_trailer().
|
protected |
Write the header of the output file container.
Definition at line 3110 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), FFmpegfs_Format::filetype(), m_current_format, FFmpeg_Transcoder::INPUTFILE::m_filetype, FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_out, prepare_format(), and virtname().
Referenced by process_output().
|
protected |
Write the trailer of the output file container.
Definition at line 4863 of file ffmpeg_transcoder.cc.
References Logging::error(), ffmpeg_geterror(), FFmpeg_Transcoder::INPUTFILE::m_format_ctx, m_out, and virtname().
Referenced by encode_finish().
|
private |
HLS: Currently active streams bit mask. Set FFMPEGFS_AUDIO and/or FFMPEGFS_VIDEO.
Definition at line 1299 of file ffmpeg_transcoder.h.
Referenced by open_output_filestreams(), and process_single_fr().
|
private |
Audio sample FIFO.
Definition at line 1249 of file ffmpeg_transcoder.h.
Referenced by add_samples_to_fifo(), copy_audio_to_frame_buffer(), create_audio_frame(), init_audio_fifo(), and purge_audio_fifo().
|
private |
SwResample context for audio resampling.
Definition at line 1248 of file ffmpeg_transcoder.h.
Referenced by close_resample(), convert_samples(), decode_audio_frame(), and init_resampler().
|
private |
Pointer to cache buffer object.
Definition at line 1277 of file ffmpeg_transcoder.h.
Referenced by encode_finish(), encode_image_frame(), open_output(), open_output_frame_set(), seek_frame(), skip_decoded_frames(), and start_new_segment().
|
private |
Video filter sink context.
Definition at line 1253 of file ffmpeg_transcoder.h.
Referenced by free_filters(), init_deinterlace_filters(), and send_filters().
|
private |
Video filter source context.
Definition at line 1254 of file ffmpeg_transcoder.h.
Referenced by free_filters(), init_deinterlace_filters(), and send_filters().
|
private |
If true, copy audio stream from source to target (just remux, no recode).
Definition at line 1268 of file ffmpeg_transcoder.h.
Referenced by decode_frame(), flush_frames_single(), open_output_filestreams(), and process_single_fr().
|
private |
If true, copy video stream from source to target (just remux, no recode).
Definition at line 1269 of file ffmpeg_transcoder.h.
Referenced by decode_frame(), flush_frames_single(), and open_output_filestreams().
|
private |
If the audio stream is copied and the time stamps are absent from the input stream, we have to generate them.
Definition at line 1272 of file ffmpeg_transcoder.h.
Referenced by decode_frame().
|
private |
Currently selected audio channel layout.
Definition at line 1244 of file ffmpeg_transcoder.h.
Referenced by FFmpeg_Transcoder(), and init_resampler().
|
private |
Currently selected audio sample format.
Definition at line 1241 of file ffmpeg_transcoder.h.
Referenced by calculate_predicted_filesize(), and init_resampler().
|
private |
Currently selected audio sample rate.
Definition at line 1242 of file ffmpeg_transcoder.h.
Referenced by init_resampler().
|
private |
If the video stream is copied and the time stamps are absent from the input stream, we have to generate them.
Definition at line 1273 of file ffmpeg_transcoder.h.
Referenced by decode_frame().
|
private |
Currently used output format(s)
Definition at line 1275 of file ffmpeg_transcoder.h.
Referenced by add_external_subtitle_stream(), add_stream(), add_subtitle_streams(), calculate_predicted_filesize(), can_copy_stream(), encode_image_frame(), is_frameset(), is_hls(), is_multiformat(), open_bestmatch_video(), open_input_file(), open_output(), open_output_file(), open_output_filestreams(), open_output_frame_set(), open_subtitles(), produce_audio_dts(), and write_output_file_header().
|
private |
HLS only: Segment file number currently being encoded.
Definition at line 1264 of file ffmpeg_transcoder.h.
Referenced by encode_finish(), goto_next_segment(), open_output(), and start_new_segment().
|
private |
Requested decoder hardware pixel format.
Definition at line 1293 of file ffmpeg_transcoder.h.
Referenced by get_format().
|
staticprivate |
List of AVPixelFormats mapped to hardware acceleration types.
Definition at line 1285 of file ffmpeg_transcoder.h.
Referenced by find_sw_fmt_by_hw_type().
|
private |
Requested encoder hardware pixel format.
Definition at line 1292 of file ffmpeg_transcoder.h.
Referenced by add_stream(), hwframe_ctx_set(), and open_output().
|
private |
The MJEPG codec requires monotonically growing PTS values so we fake some to avoid them going backwards after seeks.
Definition at line 1280 of file ffmpeg_transcoder.h.
Referenced by encode_image_frame().
|
private |
FileIO object of input file.
Definition at line 1229 of file ffmpeg_transcoder.h.
Referenced by calculate_predicted_filesize(), close_input_file(), and open_input_file().
|
private |
Video filter graph.
Definition at line 1255 of file ffmpeg_transcoder.h.
Referenced by free_filters(), and init_deinterlace_filters().
|
private |
Audio/video/subtitle frame map.
Definition at line 1238 of file ffmpeg_transcoder.h.
Referenced by create_audio_frame(), decode_subtitle(), decode_video_frame(), process_single_fr(), pts(), and purge_multiframe_map().
|
private |
After seek operations this is set to make sure the trancoding result is marked RESULTCODE_INCOMPLETE to start transcoding over next access to fill the gaps.
Definition at line 1234 of file ffmpeg_transcoder.h.
Referenced by do_seek_frame(), have_seeked(), open_output_frame_set(), and start_new_segment().
|
private |
HLS packet FIFO.
Definition at line 1301 of file ffmpeg_transcoder.h.
Referenced by purge_hls_fifo(), start_new_segment(), and store_packet().
|
private |
Hardware acceleration device context for decoder.
Definition at line 1291 of file ffmpeg_transcoder.h.
Referenced by closeio(), and hwdevice_ctx_add_ref().
|
private |
Current hardware acceleration mode for decoder.
Definition at line 1287 of file ffmpeg_transcoder.h.
|
private |
Enable hardware acceleration frame buffers for decoder.
Definition at line 1289 of file ffmpeg_transcoder.h.
Referenced by decode_video_frame(), and get_pix_formats().
|
private |
Enable hardware acceleration frame buffers for encoder.
Definition at line 1288 of file ffmpeg_transcoder.h.
Referenced by add_stream(), encode_video_frame(), get_pix_formats(), open_bestmatch_video(), open_output(), and update_codec().
|
private |
Hardware acceleration device context for encoder.
Definition at line 1290 of file ffmpeg_transcoder.h.
Referenced by add_stream(), closeio(), open_bestmatch_video(), and open_output().
|
private |
Current hardware acceleration mode for encoder.
Definition at line 1286 of file ffmpeg_transcoder.h.
Referenced by add_stream(), and open_output().
|
private |
Input file information.
Definition at line 1260 of file ffmpeg_transcoder.h.
Referenced by add_albumart_stream(), add_stream(), add_stream_copy(), add_subtitle_stream(), add_subtitle_streams(), calculate_predicted_filesize(), can_copy_stream(), close_input_file(), convert_samples(), create_audio_frame(), decode(), decode_audio_frame(), decode_frame(), decode_subtitle(), decode_video_frame(), do_seek_frame(), encode_image_frame(), encode_video_frame(), flush_buffers(), flush_frames_all(), get_pix_formats(), get_video_size(), init_resampler(), is_audio_stream(), is_open(), is_subtitle_stream(), is_video(), is_video_stream(), open_albumarts(), open_bestmatch_audio(), open_bestmatch_video(), open_input_file(), open_output(), open_output_file(), open_output_filestreams(), open_output_frame_set(), open_subtitles(), process_albumarts(), process_metadata(), process_single_fr(), read_decode_convert_and_store(), skip_decoded_frames(), and start_new_segment().
|
private |
HLS: Currently inhibited streams bit mask. Packets temporarly go to m_hls_packet_fifo and will be prepended to next segment. Set FFMPEGFS_AUDIO and/or FFMPEGFS_VIDEO.
Definition at line 1300 of file ffmpeg_transcoder.h.
Referenced by open_output_filestreams(), process_single_fr(), start_new_segment(), and store_packet().
|
private |
HLS only: Allow insertion of 1 keyframe.
Definition at line 1265 of file ffmpeg_transcoder.h.
Referenced by decode_video_frame(), open_output(), and start_new_segment().
|
private |
true if input is a video file
Definition at line 1236 of file ffmpeg_transcoder.h.
Referenced by calculate_predicted_filesize(), open_bestmatch_video(), and open_output_filestreams().
|
private |
If not 0, this is the last frame that we seeked to. Video sources only.
Definition at line 1233 of file ffmpeg_transcoder.h.
Referenced by encode_image_frame(), last_seek_frame_no(), and seek_frame().
|
private |
Modified time of input file.
Definition at line 1230 of file ffmpeg_transcoder.h.
Referenced by FFmpeg_Transcoder(), mtime(), and open_input_file().
|
private |
Output file information.
Definition at line 1261 of file ffmpeg_transcoder.h.
Referenced by add_albumart_stream(), add_stream(), add_stream_copy(), add_subtitle_stream(), close_output_file(), convert_samples(), copy_audio_to_frame_buffer(), copy_metadata(), create_audio_frame(), create_fake_aiff_header(), create_fake_wav_header(), decode(), decode_audio_frame(), decode_frame(), decode_video_frame(), encode_audio_frame(), encode_image_frame(), encode_video_frame(), FFmpeg_Transcoder(), flush_delayed_audio(), flush_delayed_video(), flush_frames_single(), get_out_subtitle_stream(), get_pix_formats(), id3v1tag(), init_audio_fifo(), init_audio_output_frame(), init_converted_samples(), init_resampler(), open_output(), open_output_file(), open_output_filestreams(), open_output_frame_set(), process_albumarts(), process_metadata(), process_single_fr(), produce_audio_dts(), purge(), skip_decoded_frames(), start_new_segment(), store_packet(), update_format(), write_output_file_header(), and write_output_file_trailer().
|
private |
Generated position.
Definition at line 1257 of file ffmpeg_transcoder.h.
Referenced by decode_video_frame().
|
staticprivate |
ProRes bitrate table. Used for file size prediction.
Definition at line 1282 of file ffmpeg_transcoder.h.
Referenced by get_prores_bitrate().
|
private |
Generated PTS.
Definition at line 1256 of file ffmpeg_transcoder.h.
Referenced by decode_video_frame().
|
private |
We have to reset audio/video pts to the new position.
Definition at line 1279 of file ffmpeg_transcoder.h.
Referenced by decode_frame(), and start_new_segment().
|
private |
Stack of seek requests. Will be processed FIFO.
Definition at line 1232 of file ffmpeg_transcoder.h.
Referenced by open_output_frame_set(), seek_frame(), stack_seek_frame(), stack_seek_segment(), and start_new_segment().
|
private |
Access mutex for seek FIFO.
Definition at line 1231 of file ffmpeg_transcoder.h.
Referenced by open_output_frame_set(), seek_frame(), stack_seek_frame(), and stack_seek_segment().
|
private |
After seek, skip next video frame.
Definition at line 1235 of file ffmpeg_transcoder.h.
Referenced by do_seek_frame(), and encode_image_frame().
|
private |
Input stream to output stream map.
Definition at line 1262 of file ffmpeg_transcoder.h.
Referenced by add_stream_map(), and map_in_to_out_stream().
|
private |
Context for video filtering.
Definition at line 1252 of file ffmpeg_transcoder.h.
Referenced by close_output_file(), decode_video_frame(), and init_rescaler().