FFmpegfs Fuse Multi Media Filesystem 2.14
Functions
blurayparser.cc File Reference

Blu-ray disk parser implementation. More...

#include "ffmpegfs.h"
#include "blurayparser.h"
#include "transcode.h"
#include "logging.h"
#include "libbluray/bluray.h"
#include "libbluray/bluray-version.h"
#include <libavutil/rational.h>
Include dependency graph for blurayparser.cc:

Go to the source code of this file.

Functions

static bool audio_stream_info (const std::string &path, BLURAY_STREAM_INFO *ss, int *channels, int *sample_rate)
 Get information about Blu-ray stream. More...
 
static bool video_stream_info (const std::string &path, BLURAY_STREAM_INFO *ss, int *width, int *height, AVRational *framerate, bool *interleaved)
 Get information about Blu-ray stream. More...
 
static int parse_find_best_audio_stream ()
 Find best match audio stream. More...
 
static int parse_find_best_video_stream ()
 Find best match video stream. More...
 
static bool create_bluray_virtualfile (BLURAY *bd, const BLURAY_TITLE_INFO *ti, const std::string &path, const struct stat *statbuf, void *buf, fuse_fill_dir_t filler, bool is_main_title, bool full_title, uint32_t title_idx, uint32_t chapter_idx)
 Create a virtual file entry of a Blu-ray chapter or title. More...
 
static int parse_bluray (const std::string &path, const struct stat *statbuf, void *buf, fuse_fill_dir_t filler)
 Parse Blu-ray directory and get all Blu-ray titles and chapters as virtual files. More...
 
int check_bluray (const std::string &path, void *buf, fuse_fill_dir_t filler)
 Get number of titles on Blu-ray. More...
 

Detailed Description

Blu-ray disk parser implementation.

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

Definition in file blurayparser.cc.

Function Documentation

◆ audio_stream_info()

static bool audio_stream_info ( const std::string &  path,
BLURAY_STREAM_INFO *  ss,
int *  channels,
int *  sample_rate 
)
static

Get information about Blu-ray stream.

Parameters
[in]path- Path to Blu-ray disk.
[in]ss- BLURAY_STREAM_INFO object.
[out]channels- Number of audio channels in stream.
[out]sample_rate- Sample rate of stream.
Returns
Returns true if stream has video, false if not.

Definition at line 61 of file blurayparser.cc.

References Logging::error().

Referenced by create_bluray_virtualfile().

◆ check_bluray()

int check_bluray ( const std::string &  path,
void *  buf = nullptr,
fuse_fill_dir_t  filler = nullptr 
)

Get number of titles on Blu-ray.

Parameters
[in]path- Path to check
[in,out]buf- The buffer passed to the readdir() operation.
[in,out]filler- Function to add an entry in a readdir() operation (see https://libfuse.github.io/doxygen/fuse_8h.html#a7dd132de66a5cc2add2a4eff5d435660)
Note
buf and filler can be nullptr. In that case, the call will run faster, so these parameters should only be passed if they are to be filled in.
Returns
-errno or number of titles on Blu-ray.

Definition at line 623 of file blurayparser.cc.

References add_dotdot(), append_sep(), check_path(), load_path(), parse_bluray(), and Logging::trace().

Referenced by ffmpegfs_getattr(), and ffmpegfs_readdir().

◆ create_bluray_virtualfile()

static bool create_bluray_virtualfile ( BLURAY bd,
const BLURAY_TITLE_INFO *  ti,
const std::string &  path,
const struct stat *  statbuf,
void *  buf,
fuse_fill_dir_t  filler,
bool  is_main_title,
bool  full_title,
uint32_t  title_idx,
uint32_t  chapter_idx 
)
static

Create a virtual file entry of a Blu-ray chapter or title.

Parameters
[in]bd- Blu-ray disk clip info.
[in]ti- Blu-ray disk title info.
[in]path- Path to check.
[in]statbuf- File status structure of original file.
[in,out]buf- The buffer passed to the readdir() operation.
[in,out]filler- Function to add an entry in a readdir() operation (see https://libfuse.github.io/doxygen/fuse_8h.html#a7dd132de66a5cc2add2a4eff5d435660)
[in]is_main_title- true if title_idx is the main title
[in]full_title- If true, create virtual file of all title. If false, include single chapter only.
[in]title_idx- Zero-based title index on Blu-ray
[in]chapter_idx- Zero-based chapter index on Blu-ray
Note
buf and filler can be nullptr. In that case the call will run faster, so these parameters should only be passed if to be filled in.
Returns
On error, returns false. On success, returns true.
Todo:
We actually calculate the overall Blu-ray bitrate here, including all audio streams, not just the video bitrate. This should be the video bitrate alone. We should also calculate the audio bitrate for the selected stream.

Definition at line 432 of file blurayparser.cc.

References add_fuse_entry(), audio_stream_info(), BITRATE, Logging::error(), ffmpeg_format, format_bitrate(), format_duration(), format_samplerate(), format_size(), insert_dir(), insert_file(), VIRTUALFILE::BLURAY_CHAPTER::m_angle_no, VIRTUALFILE::m_bluray, VIRTUALFILE::m_channels, VIRTUALFILE::BLURAY_CHAPTER::m_chapter_no, VIRTUALFILE::m_duration, VIRTUALFILE::m_format_idx, VIRTUALFILE::m_framerate, VIRTUALFILE::m_full_title, VIRTUALFILE::m_height, VIRTUALFILE::BLURAY_CHAPTER::m_playlist_no, VIRTUALFILE::m_predicted_size, VIRTUALFILE::m_sample_rate, VIRTUALFILE::m_st, VIRTUALFILE::BLURAY_CHAPTER::m_title_no, VIRTUALFILE::m_video_frame_count, VIRTUALFILE::m_width, parse_find_best_audio_stream(), parse_find_best_video_stream(), replace_all(), strsprintf(), Logging::trace(), transcoder_cached_filesize(), transcoder_set_filesize(), video_stream_info(), and VIRTUALTYPE_BLURAY.

Referenced by parse_bluray().

◆ parse_bluray()

static int parse_bluray ( const std::string &  path,
const struct stat *  statbuf,
void *  buf,
fuse_fill_dir_t  filler 
)
static

Parse Blu-ray directory and get all Blu-ray titles and chapters as virtual files.

Parameters
[in]path- Path to check.
[in]statbuf- File status structure of original file.
[in,out]buf- The buffer passed to the readdir() operation.
[in,out]filler- Function to add an entry in a readdir() operation (see https://libfuse.github.io/doxygen/fuse_8h.html#a7dd132de66a5cc2add2a4eff5d435660)
Returns
On success, returns number of chapters found. On error, returns -errno.

Definition at line 568 of file blurayparser.cc.

References create_bluray_virtualfile(), Logging::debug(), and Logging::trace().

Referenced by check_bluray().

◆ parse_find_best_audio_stream()

static int parse_find_best_audio_stream ( )
static

Find best match audio stream.

Todo:
Returning 0 is not necessarily the best match. Probably better to parse. For "The life of Brian", e.g., this is the Hungarian audio track. No big deal, though, I can recite mostly all dialogs in English and German (and Latin :), but should be fixed anyway.
Returns
Returns index of best match stream.

Definition at line 401 of file blurayparser.cc.

Referenced by create_bluray_virtualfile().

◆ parse_find_best_video_stream()

static int parse_find_best_video_stream ( )
static

Find best match video stream.

Todo:
Returning 0 is not necessarily the best match. Probably better to parse. Most DVDs contain only one video track anyway, so this does not hurt at the moment.
Returns
Returns index of best match stream.

Definition at line 412 of file blurayparser.cc.

Referenced by create_bluray_virtualfile().

◆ video_stream_info()

static bool video_stream_info ( const std::string &  path,
BLURAY_STREAM_INFO *  ss,
int *  width,
int *  height,
AVRational *  framerate,
bool *  interleaved 
)
static

Get information about Blu-ray stream.

Parameters
[in]path- Path to Blu-ray disk.
[in]ss- BLURAY_STREAM_INFO object.
[out]width- Width of video stream.
[out]height- Height of video stream.
[out]framerate- Frame rate of video stream.
[out]interleaved- true: video stream is interleaved, false: video stream is not interleaved.
Returns
Returns true if stream has video, false if not.

Definition at line 193 of file blurayparser.cc.

References Logging::error().

Referenced by create_bluray_virtualfile().