|
FFmpegfs Fuse Multi Media Filesystem 2.19
|
File transcoder interface implementation. More...
#include "transcode.h"#include "ffmpegfs.h"#include "ffmpeg_transcoder.h"#include "buffer.h"#include "cache.h"#include "logging.h"#include "cache_entry.h"#include "thread_pool.h"#include <unistd.h>#include <atomic>#include <chrono>#include <cstdio>
Go to the source code of this file.
Classes | |
| struct | THREAD_DATA |
| THREAD_DATA struct to pass data from parent to child thread. More... | |
Typedefs | |
| typedef struct THREAD_DATA | THREAD_DATA |
| THREAD_DATA struct to pass data from parent to child thread. | |
Functions | |
| static bool | transcode (std::shared_ptr< THREAD_DATA > thread_data, Cache_Entry *cache_entry, FFmpeg_Transcoder &transcoder, bool *timeout) |
| Actually transcode file. | |
| static int | transcoder_thread (std::shared_ptr< THREAD_DATA > thread_data) |
| Transcoding thread. | |
| static int | start_transcoder_thread (Cache_Entry *cache_entry) |
| Start the transcoder thread for an existing cache entry. | |
| static bool | transcode_until (Cache_Entry *cache_entry, size_t offset, size_t len, uint32_t segment_no) |
| Transcode the buffer until the buffer has enough or until an error occurs. The buffer needs at least 'end' bytes before transcoding stops. Returns true if no errors and false otherwise. | |
| static int | transcode_finish (Cache_Entry *cache_entry, FFmpeg_Transcoder &transcoder) |
| Close the input file and free everything but the initial buffer. | |
| static void | reopen_finished_incomplete_cache (Cache_Entry *cache_entry, uint32_t item_no, const char *item_name) |
| Re-open an incomplete multi-format cache for an on-demand repair run. | |
| static bool | cached_item_available (Cache_Entry *cache_entry, size_t offset, size_t len, uint32_t segment_no) |
| Check whether the requested cache data is available and physically readable. | |
| static bool | invalidate_stale_cache_file (Cache_Entry *cache_entry, uint32_t segment_no, uint32_t item_no, const char *item_name) |
| Invalidate a stale physical cache file and make the entry eligible for recoding. | |
| void | transcoder_cache_path (std::string *path) |
| Get transcoder cache path. | |
| bool | transcoder_init () |
| Initialise transcoder, create cache. | |
| void | transcoder_free () |
| Free transcoder. | |
| bool | transcoder_cached_filesize (LPVIRTUALFILE virtualfile, struct stat *stbuf) |
| Simply get encoded file size (do not create the whole encoder/decoder objects) | |
| bool | transcoder_set_filesize (LPVIRTUALFILE virtualfile, int64_t duration, BITRATE audio_bit_rate, int channels, int sample_rate, AVSampleFormat sample_format, BITRATE video_bit_rate, int width, int height, bool interleaved, const AVRational &framerate) |
| Set the file size. | |
| bool | transcoder_predict_filesize (LPVIRTUALFILE virtualfile, Cache_Entry *cache_entry) |
| Predict file size. | |
| Cache_Entry * | transcoder_new (LPVIRTUALFILE virtualfile, bool begin_transcode) |
| Allocate and initialise the transcoder. | |
| bool | transcoder_read (Cache_Entry *cache_entry, char *buff, size_t offset, size_t len, int *bytes_read, uint32_t segment_no) |
| Read some bytes from the internal buffer and into the given buffer. | |
| bool | transcoder_read_frame (Cache_Entry *cache_entry, char *buff, size_t offset, size_t len, uint32_t frame_no, int *bytes_read, LPVIRTUALFILE virtualfile) |
| Read one image frame from the internal buffer and into the given buffer. | |
| void | transcoder_delete (Cache_Entry *cache_entry) |
| Free the cache entry structure. | |
| size_t | transcoder_get_size (Cache_Entry *cache_entry) |
| Return size of output file, as computed by encoder. | |
| size_t | transcoder_buffer_watermark (Cache_Entry *cache_entry, uint32_t segment_no) |
| Return the current watermark of the file while transcoding. | |
| size_t | transcoder_buffer_tell (Cache_Entry *cache_entry, uint32_t segment_no) |
| Return the current file position in the file. | |
| void | transcoder_exit () |
| Exit transcoding. | |
| bool | transcoder_cache_maintenance () |
| Run cache maintenance. | |
| bool | transcoder_cache_clear () |
| Clear transcoder cache. | |
| static void | log_transcoding_result (Cache_Entry *cache_entry, const FFmpeg_Transcoder &transcoder, bool timeout, bool success, const std::chrono::steady_clock::time_point &start_time) |
| Log the final result of a transcoder worker run. | |
Variables | |
| const int | GRANULARITY = 250 |
| Image frame conversion: ms between checks if a picture frame is available. | |
| const int | FRAME_TIMEOUT = 60 |
| Image frame conversion: timout seconds to wait if a picture frame is available. | |
| const int | TOTAL_RETRIES = FRAME_TIMEOUT*1000/GRANULARITY |
| Number of retries. | |
| static std::unique_ptr< Cache > | cache |
| Global cache manager object. | |
| static std::atomic_bool | thread_exit |
| Used for shutdown: if true, forcibly exit all threads. | |
File transcoder interface implementation.
Definition in file transcode.cc.
|
static |
Check whether the requested cache data is available and physically readable.
This combines the logical cache state (finished cache, finished HLS segment, or enough bytes already written) with a physical cache-file check. A stale database entry must not result in an empty file being served to the client.
| [in,out] | cache_entry | Cache entry to check. |
| [in] | offset | Requested byte offset. |
| [in] | len | Requested byte count. |
| [in] | segment_no | HLS segment number, or 0 for normal files/frame sets. |
Definition at line 306 of file transcode.cc.
References invalidate_stale_cache_file(), Cache_Entry::is_finished(), and Cache_Entry::m_buffer.
Referenced by transcode_until().
|
static |
Invalidate a stale physical cache file and make the entry eligible for recoding.
The cache database/in-memory state may still say that a file or segment is available even though the physical cache file has been deleted or truncated. In that case the on-disk state wins: the affected cache item is invalidated and the cache entry is re-opened for transcoding/repair.
| [in,out] | cache_entry | Cache entry containing the stale cache file. |
| [in] | segment_no | HLS segment number, or 0 for the single cache file used by normal files and frame sets. |
| [in] | item_no | Human-readable item number used in the log message. |
| [in] | item_name | Human-readable item name used in the log message. |
Definition at line 246 of file transcode.cc.
References FFMPEGFS_PARAMS::current_format(), FFmpegfs_Format::is_multiformat(), CACHE_INFO::m_averror, Cache_Entry::m_buffer, Cache_Entry::m_cache_info, CACHE_INFO::m_encoded_filesize, CACHE_INFO::m_errno, CACHE_INFO::m_error, CACHE_INFO::m_result, Cache_Entry::m_seek_to_no, Cache_Entry::m_suspend_timeout, NONE, params, Cache_Entry::virtname(), Cache_Entry::virtualfile(), and Logging::warning().
Referenced by cached_item_available(), transcoder_read(), and transcoder_read_frame().
|
static |
Log the final result of a transcoder worker run.
Emits exactly one final status message for a transcoder thread after the worker has finished, timed out, been asked to exit, or failed.
Successful transcodes include the elapsed runtime in milliseconds. Timeout, thread-exit, and error cases keep their specific diagnostic messages, with system and FFmpeg error details emitted when available in the cache entry.
| cache_entry | Cache entry associated with the transcoder worker. If this is nullptr, no message is emitted. |
| transcoder | Transcoder instance associated with the worker run. Used to obtain the virtual file name for final status logging. |
| timeout | Set to true if transcoding was aborted because the inactivity timeout expired. |
| success | Set to true if transcoding completed successfully. |
| start_time | Monotonic start time captured when the transcoder worker started; used to calculate elapsed runtime for successful transcodes. |
Definition at line 1392 of file transcode.cc.
References Logging::error(), ffmpeg_geterror(), Logging::info(), CACHE_INFO::m_averror, Cache_Entry::m_cache_info, CACHE_INFO::m_errno, FFMPEGFS_PARAMS::m_max_inactive_abort, params, thread_exit, Cache_Entry::virtname(), and Logging::warning().
Referenced by transcoder_thread().
|
static |
Re-open an incomplete multi-format cache for an on-demand repair run.
HLS and frame-set caches may intentionally be marked FINISHED_INCOMPLETE after a seek/direct access reached EOF. That state means that existing segments/frames are usable, but missing items may still be generated later. Before starting such a repair worker, clear only the finished/error state; do not clear the buffer, because the already valid segments/frames must be kept.
| [in,out] | cache_entry | Cache entry to re-open. |
| [in] | item_no | Requested HLS segment or frame number. |
| [in] | item_name | Human-readable item name for logging. |
Definition at line 214 of file transcode.cc.
References Cache_Entry::is_finished_incomplete(), CACHE_INFO::m_averror, Cache_Entry::m_cache_info, CACHE_INFO::m_errno, CACHE_INFO::m_error, CACHE_INFO::m_result, NONE, Cache_Entry::virtname(), and Logging::warning().
Referenced by transcoder_read(), and transcoder_read_frame().
|
static |
Start the transcoder thread for an existing cache entry.
For HLS/frame-set partial cache repair, the caller may already have placed the requested segment/frame number in m_seek_to_no. In that case transcode() keeps existing segment files and starts directly at the requested item.
| [in,out] | cache_entry | Cache entry to transcode. |
Definition at line 504 of file transcode.cc.
References FFMPEGFS_PARAMS::current_format(), Logging::debug(), Cache_Entry::filename(), VIRTUALFILE::get_segment_count(), FFmpegfs_Format::is_multiformat(), Cache_Entry::m_active_mutex, Cache_Entry::m_cache_info, CACHE_INFO::m_errno, CACHE_INFO::m_error, Cache_Entry::m_is_decoding, CACHE_INFO::m_segment_count, params, tp, transcoder_predict_filesize(), transcoder_thread(), Cache_Entry::virtname(), Cache_Entry::virtualfile(), and Logging::warning().
Referenced by transcoder_new(), transcoder_read(), and transcoder_read_frame().
|
static |
Actually transcode file.
| [in,out] | thread_data | - Thread data with lock objects |
| [in,out] | cache_entry | - Underlying thread entry |
| [in] | transcoder | - Transcoder object for transcoding |
| [out] | timeout | - True if transcoding timed out, false if not |
Definition at line 1116 of file transcode.cc.
References cache, Cache_Entry::clear(), FFmpeg_Transcoder::closeio(), FFMPEGFS_PARAMS::current_format(), Logging::debug(), DEC_EOF, DEC_ERROR, DEC_SUCCESS, Cache_Entry::decode_timeout(), FFmpegfs_Format::desttype(), FFmpeg_Transcoder::duration(), Cache_Entry::filename(), format_size(), format_time(), GRANULARITY, FFmpeg_Transcoder::id3v1tag(), Logging::info(), Cache_Entry::is_finished(), FFmpeg_Transcoder::is_frameset(), FFmpeg_Transcoder::is_hls(), FFmpegfs_Format::is_multiformat(), CACHE_INFO::m_averror, Cache_Entry::m_buffer, Cache_Entry::m_cache_info, CACHE_INFO::m_duration, CACHE_INFO::m_errno, CACHE_INFO::m_error, Cache_Entry::m_id3v1, Cache_Entry::m_is_decoding, FFMPEGFS_PARAMS::m_max_inactive_suspend, FFMPEGFS_PARAMS::m_prebuffer_size, FFMPEGFS_PARAMS::m_prebuffer_time, CACHE_INFO::m_predicted_filesize, CACHE_INFO::m_result, Cache_Entry::m_seek_to_no, CACHE_INFO::m_segment_count, Cache_Entry::m_suspend_timeout, CACHE_INFO::m_video_frame_count, mssleep(), NONE, FFmpeg_Transcoder::open_input_file(), FFmpeg_Transcoder::open_output_file(), Cache_Entry::openio(), params, FFmpeg_Transcoder::predicted_filesize(), FFmpeg_Transcoder::process_single_fr(), FFmpeg_Transcoder::pts(), Cache_Entry::ref_count(), FFmpeg_Transcoder::segment_count(), FFmpeg_Transcoder::stack_seek_frame(), FFmpeg_Transcoder::stack_seek_segment(), Cache_Entry::suspend_timeout(), thread_exit, transcode_finish(), Cache_Entry::update_access(), FFmpeg_Transcoder::video_frame_count(), Cache_Entry::virtname(), and Cache_Entry::virtualfile().
Referenced by transcoder_thread().
|
static |
Close the input file and free everything but the initial buffer.
| [in] | cache_entry | - corresponding cache entry |
| [in] | transcoder | - Current FFmpeg_Transcoder object. |
Definition at line 161 of file transcode.cc.
References Logging::debug(), FFmpeg_Transcoder::duration(), FFmpeg_Transcoder::encode_finish(), FINISHED_INCOMPLETE, FINISHED_SUCCESS, Cache_Entry::flush(), format_result_size_ex(), format_size_ex(), FFmpeg_Transcoder::have_seeked(), FFmpeg_Transcoder::is_multiformat(), CACHE_INFO::m_averror, Cache_Entry::m_buffer, Cache_Entry::m_cache_info, CACHE_INFO::m_duration, CACHE_INFO::m_encoded_filesize, CACHE_INFO::m_errno, Cache_Entry::m_is_decoding, CACHE_INFO::m_predicted_filesize, CACHE_INFO::m_result, CACHE_INFO::m_segment_count, CACHE_INFO::m_video_frame_count, FFmpeg_Transcoder::segment_count(), FFmpeg_Transcoder::video_frame_count(), and FFmpeg_Transcoder::virtname().
Referenced by transcode().
|
static |
Transcode the buffer until the buffer has enough or until an error occurs. The buffer needs at least 'end' bytes before transcoding stops. Returns true if no errors and false otherwise.
| [in] | cache_entry | - corresponding cache entry |
| [in] | offset | - byte offset to start reading at |
| [in] | len | - length of data chunk to be read. |
| [in] | segment_no | - HLS segment file number. |
Definition at line 87 of file transcode.cc.
References cached_item_available(), Logging::info(), Cache_Entry::m_cache_info, CACHE_INFO::m_error, Cache_Entry::m_is_decoding, mssleep(), thread_exit, Logging::trace(), Cache_Entry::virtname(), and Logging::warning().
Referenced by transcoder_read().
| size_t transcoder_buffer_tell | ( | Cache_Entry * | cache_entry, |
| uint32_t | segment_no | ||
| ) |
Return the current file position in the file.
| [in] | cache_entry | - corresponding cache entry |
| [in] | segment_no | - HLS segment file number. |
Definition at line 1074 of file transcode.cc.
References Cache_Entry::m_buffer.
| size_t transcoder_buffer_watermark | ( | Cache_Entry * | cache_entry, |
| uint32_t | segment_no | ||
| ) |
Return the current watermark of the file while transcoding.
While transcoding, this value reflects the current size of the transcoded file. This is the maximum byte offset until the file can be read so far.
| [in] | cache_entry | - corresponding cache entry |
| [in] | segment_no | - HLS segment file number. |
Definition at line 1069 of file transcode.cc.
References Cache_Entry::m_buffer.
| bool transcoder_cache_clear | ( | ) |
Clear transcoder cache.
Definition at line 1096 of file transcode.cc.
References cache.
Referenced by main().
| bool transcoder_cache_maintenance | ( | ) |
Run cache maintenance.
Definition at line 1084 of file transcode.cc.
References cache.
Referenced by main(), and maintenance_handler().
| void transcoder_cache_path | ( | std::string * | path | ) |
Get transcoder cache path.
| [out] | path | - Path to transcoder cache. |
Definition at line 336 of file transcode.cc.
References append_sep(), expand_path(), FFMPEGFS_PARAMS::m_cachepath, and params.
Referenced by Cache::load_index(), Buffer::make_cachefile_name(), print_params(), and Logging::Logger::~Logger().
| bool transcoder_cached_filesize | ( | LPVIRTUALFILE | virtualfile, |
| struct stat * | stbuf | ||
| ) |
Simply get encoded file size (do not create the whole encoder/decoder objects)
| [in] | virtualfile | - virtual file object to open |
| [out] | stbuf | - stat struct filled in with the size of the cached file |
Definition at line 402 of file transcode.cc.
References cache, Cache_Entry::m_cache_info, CACHE_INFO::m_encoded_filesize, CACHE_INFO::m_predicted_filesize, Cache_Entry::openio(), and stat_set_size().
Referenced by create_bluray_virtualfile(), create_cuesheet_virtualfile(), create_dvd_virtualfile(), and ffmpegfs_getattr().
| void transcoder_delete | ( | Cache_Entry * | cache_entry | ) |
Free the cache entry structure.
Call this to free the cache entry structure.
The structure is reference counted, after calling this function, if the cache entry is not use by another thread, the cache entry may no longer be valid.
| [in] | cache_entry | - corresponding cache entry |
Definition at line 1059 of file transcode.cc.
References cache.
Referenced by ffmpegfs_getattr(), ffmpegfs_release(), get_source_properties(), and kick_next().
| void transcoder_exit | ( | ) |
Exit transcoding.
Send signal to exit transcoding (ending all transcoder threads).
Definition at line 1079 of file transcode.cc.
References thread_exit.
Referenced by ffmpegfs_destroy(), and sighandler().
| void transcoder_free | ( | ) |
Free transcoder.
Definition at line 392 of file transcode.cc.
References cache, and Logging::debug().
Referenced by ffmpegfs_destroy().
| size_t transcoder_get_size | ( | Cache_Entry * | cache_entry | ) |
Return size of output file, as computed by encoder.
Returns the file size, either the predicted size (which may be inaccurate) or the real size (which is only available once the file was completely recoded).
| [in] | cache_entry | - corresponding cache entry |
Definition at line 1064 of file transcode.cc.
References Cache_Entry::size().
Referenced by ffmpegfs_getattr().
| bool transcoder_init | ( | ) |
Initialise transcoder, create cache.
Definition at line 370 of file transcode.cc.
References cache, Logging::debug(), and Logging::error().
Referenced by main().
| Cache_Entry * transcoder_new | ( | LPVIRTUALFILE | virtualfile, |
| bool | begin_transcode | ||
| ) |
Allocate and initialise the transcoder.
Opens a file and starts the decoding thread if begin_transcode is true. File will be scanned to detect bit rate, duration etc. only if begin_transcode is false.
| [in] | virtualfile | - virtual file object to open |
| [in] | begin_transcode | - if true, transcoding starts, if false file will be scanned only |
Definition at line 590 of file transcode.cc.
References cache, CACHE_CLOSE_DELETE, Cache_Entry::clear(), FFMPEGFS_PARAMS::current_format(), Cache_Entry::filename(), VIRTUALFILE::get_segment_count(), Cache_Entry::is_finished_success(), FFmpegfs_Format::is_multiformat(), Cache_Entry::lock(), Cache_Entry::m_cache_info, FFMPEGFS_PARAMS::m_disable_cache, CACHE_INFO::m_duration, VIRTUALFILE::m_duration, Cache_Entry::m_is_decoding, CACHE_INFO::m_predicted_filesize, VIRTUALFILE::m_predicted_size, CACHE_INFO::m_video_frame_count, VIRTUALFILE::m_video_frame_count, Cache_Entry::openio(), Cache_Entry::outdated(), params, start_transcoder_thread(), Logging::trace(), transcoder_predict_filesize(), Cache_Entry::unlock(), and Cache_Entry::virtname().
Referenced by ffmpegfs_getattr(), ffmpegfs_open(), get_source_properties(), and kick_next().
| bool transcoder_predict_filesize | ( | LPVIRTUALFILE | virtualfile, |
| Cache_Entry * | cache_entry = nullptr |
||
| ) |
Predict file size.
| [in] | virtualfile | - virtual file object to open |
| [in] | cache_entry | - corresponding cache entry |
Definition at line 469 of file transcode.cc.
References FFmpeg_Transcoder::closeio(), FFmpeg_Transcoder::duration(), FFmpeg_Transcoder::filename(), format_size_ex(), Cache_Entry::m_cache_info, CACHE_INFO::m_duration, CACHE_INFO::m_predicted_filesize, CACHE_INFO::m_segment_count, CACHE_INFO::m_video_frame_count, FFmpeg_Transcoder::open_input_file(), FFmpeg_Transcoder::predicted_filesize(), FFmpeg_Transcoder::segment_count(), Logging::trace(), and FFmpeg_Transcoder::video_frame_count().
Referenced by start_transcoder_thread(), and transcoder_new().
| bool transcoder_read | ( | Cache_Entry * | cache_entry, |
| char * | buff, | ||
| size_t | offset, | ||
| size_t | len, | ||
| int * | bytes_read, | ||
| uint32_t | segment_no | ||
| ) |
Read some bytes from the internal buffer and into the given buffer.
| [in] | cache_entry | - corresponding cache entry |
| [out] | buff | - will be filled in with data read |
| [in] | offset | - byte offset to start reading at |
| [in] | len | - length of data chunk to be read. |
| [out] | bytes_read | - Bytes read from transcoder. |
| [in] | segment_no | - HLS segment file number. |
Definition at line 677 of file transcode.cc.
References CACHE_FLAG_RO, check_ignore(), FFMPEGFS_PARAMS::current_format(), FFmpegfs_Format::filetype(), ID3V1_TAG_LENGTH, invalidate_stale_cache_file(), Cache_Entry::is_finished(), Cache_Entry::is_finished_incomplete(), Cache_Entry::is_finished_success(), Cache_Entry::m_buffer, Cache_Entry::m_cache_info, CACHE_INFO::m_errno, CACHE_INFO::m_error, Cache_Entry::m_id3v1, Cache_Entry::m_is_decoding, FFMPEGFS_PARAMS::m_min_seek_time_diff, Cache_Entry::m_seek_to_no, FFMPEGFS_PARAMS::m_segment_duration, FFMPEGFS_PARAMS::m_win_smb_fix, params, Cache_Entry::read_count(), reopen_finished_incomplete_cache(), Cache_Entry::size(), start_transcoder_thread(), Logging::trace(), transcode_until(), Cache_Entry::update_access(), Cache_Entry::update_read_count(), Cache_Entry::virtname(), Cache_Entry::virtualfile(), and Logging::warning().
Referenced by ffmpegfs_read().
| bool transcoder_read_frame | ( | Cache_Entry * | cache_entry, |
| char * | buff, | ||
| size_t | offset, | ||
| size_t | len, | ||
| uint32_t | frame_no, | ||
| int * | bytes_read, | ||
| LPVIRTUALFILE | virtualfile | ||
| ) |
Read one image frame from the internal buffer and into the given buffer.
| [in] | cache_entry | - corresponding cache entry |
| [out] | buff | - will be filled in with data read |
| [in] | offset | - byte offset to start reading at |
| [in] | len | - length of data chunk to be read. |
| [in] | frame_no | - Number of frame to return. |
| [out] | bytes_read | - Bytes read from transcoder. |
| [in,out] | virtualfile | - Birtual file object of image, may be modified. |
Definition at line 892 of file transcode.cc.
References CACHE_FLAG_RO, Logging::error(), GRANULARITY, invalidate_stale_cache_file(), Cache_Entry::is_finished(), Cache_Entry::m_buffer, Cache_Entry::m_cache_info, CACHE_INFO::m_error, Cache_Entry::m_is_decoding, Cache_Entry::m_seek_to_no, VIRTUALFILE::m_st, Cache_Entry::m_suspend_timeout, mssleep(), reopen_finished_incomplete_cache(), start_transcoder_thread(), stat_set_size(), thread_exit, TOTAL_RETRIES, Logging::trace(), Cache_Entry::update_access(), Cache_Entry::update_read_count(), Cache_Entry::virtname(), and Logging::warning().
Referenced by ffmpegfs_read().
| bool transcoder_set_filesize | ( | LPVIRTUALFILE | virtualfile, |
| int64_t | duration, | ||
| BITRATE | audio_bit_rate, | ||
| int | channels, | ||
| int | sample_rate, | ||
| AVSampleFormat | sample_format, | ||
| BITRATE | video_bit_rate, | ||
| int | width, | ||
| int | height, | ||
| bool | interleaved, | ||
| const AVRational & | framerate | ||
| ) |
Set the file size.
| [in] | virtualfile | - virtual file object to open. |
| [in] | duration | - duration of the file, in AV_TIME_BASE fractional seconds. |
| [in] | audio_bit_rate | - average bitrate of audio data (in bits per second). |
| [in] | channels | - number of channels (1: mono, 2: stereo, or more). |
| [in] | sample_rate | - number of audio samples per second. |
| [in] | sample_format | - Selected sample format |
| [in] | video_bit_rate | - average bitrate of video data (in bits per second). |
| [in] | width | - video width in pixels. |
| [in] | height | - video height in pixels. |
| [in] | interleaved | - true if video is interleaved, false if not. |
| [in] | framerate | - frame rate per second (e.g. 24, 25, 30...). |
Definition at line 429 of file transcode.cc.
References FFmpegfs_Format::audio_codec(), FFmpeg_Transcoder::audio_size(), cache, FFMPEGFS_PARAMS::current_format(), FFmpegfs_Format::desttype(), Logging::error(), FFmpegfs_Format::filetype(), format_size_ex(), get_codec_name(), get_filetype_text(), Cache_Entry::m_cache_info, CACHE_INFO::m_predicted_filesize, VIRTUALFILE::m_predicted_size, Cache_Entry::openio(), params, FFmpeg_Transcoder::total_overhead(), Logging::trace(), FFmpegfs_Format::video_codec(), FFmpeg_Transcoder::video_size(), Cache_Entry::virtname(), and Logging::warning().
Referenced by create_bluray_virtualfile(), create_cuesheet_virtualfile(), and create_dvd_virtualfile().
|
static |
Transcoding thread.
| [in] | thread_data | - Corresponding thread data object. |
Definition at line 1455 of file transcode.cc.
References cache, CACHE_CLOSE_DELETE, CACHE_CLOSE_NOOPT, Logging::error(), FFmpeg_Transcoder::have_seeked(), FFmpeg_Transcoder::is_multiformat(), FFmpeg_Transcoder::last_seek_frame_no(), log_transcoding_result(), Cache_Entry::m_active_mutex, CACHE_INFO::m_averror, Cache_Entry::m_cache_info, CACHE_INFO::m_errno, CACHE_INFO::m_error, Cache_Entry::m_is_decoding, Cache_Entry::m_restart_mutex, Cache_Entry::m_seek_to_no, thread_exit, transcode(), and FFmpeg_Transcoder::virtname().
Referenced by start_transcoder_thread().
|
static |
Global cache manager object.
Definition at line 65 of file transcode.cc.
Referenced by transcode(), transcoder_cache_clear(), transcoder_cache_maintenance(), transcoder_cached_filesize(), transcoder_delete(), transcoder_free(), transcoder_init(), transcoder_new(), transcoder_set_filesize(), and transcoder_thread().
| const int FRAME_TIMEOUT = 60 |
Image frame conversion: timout seconds to wait if a picture frame is available.
Definition at line 51 of file transcode.cc.
| const int GRANULARITY = 250 |
Image frame conversion: ms between checks if a picture frame is available.
Definition at line 50 of file transcode.cc.
Referenced by transcode(), and transcoder_read_frame().
|
static |
Used for shutdown: if true, forcibly exit all threads.
Definition at line 66 of file transcode.cc.
Referenced by log_transcoding_result(), transcode(), transcode_until(), transcoder_exit(), transcoder_read_frame(), and transcoder_thread().
| const int TOTAL_RETRIES = FRAME_TIMEOUT*1000/GRANULARITY |
Number of retries.
Definition at line 52 of file transcode.cc.
Referenced by transcoder_read_frame().