FFmpegfs Fuse Multi Media Filesystem 2.16
transcode.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2006-2008 David Collett @n
3 * Copyright (C) 2008-2013 K. Henriksson @n
4 * Copyright (C) 2017-2024 FFmpeg support by Norbert Schlia (nschlia@oblivion-software.de)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 *
20 * On Debian systems, the complete text of the GNU General Public License
21 * Version 3 can be found in `/usr/share/common-licenses/GPL-3'.
22 */
23
36#ifndef TRANSCODE_H
37#define TRANSCODE_H
38
39#pragma once
40
41#include "ffmpegfs.h"
42#include "fileio.h"
43
50bool transcoder_cached_filesize(LPVIRTUALFILE virtualfile, struct stat *stbuf);
66bool 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);
73bool transcoder_predict_filesize(LPVIRTUALFILE virtualfile, Cache_Entry* cache_entry = nullptr);
74
75// Functions for doing transcoding, called by main program body
86Cache_Entry* transcoder_new(LPVIRTUALFILE virtualfile, bool begin_transcode);
99bool transcoder_read(Cache_Entry* cache_entry, char* buff, size_t offset, size_t len, int *bytes_read, uint32_t segment_no);
113bool transcoder_read_frame(Cache_Entry* cache_entry, char* buff, size_t offset, size_t len, uint32_t frame_no, int * bytes_read, LPVIRTUALFILE virtualfile);
123void transcoder_delete(Cache_Entry* cache_entry);
133size_t transcoder_get_size(Cache_Entry* cache_entry);
144size_t transcoder_buffer_watermark(Cache_Entry* cache_entry, uint32_t segment_no);
151size_t transcoder_buffer_tell(Cache_Entry* cache_entry, uint32_t segment_no);
157void transcoder_exit();
158
159#endif
The Cache_Entry class.
Definition: cache_entry.h:49
#define BITRATE
For FFmpeg bit rate is an int.
Definition: ffmpeg_utils.h:145
Main include for FFmpegfs project.
FileIO class.
Virtual file definition.
Definition: fileio.h:123
Cache_Entry * transcoder_new(LPVIRTUALFILE virtualfile, bool begin_transcode)
Allocate and initialise the transcoder.
Definition: transcode.cc:353
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.
Definition: transcode.cc:288
size_t transcoder_buffer_tell(Cache_Entry *cache_entry, uint32_t segment_no)
Return the current file position in the file.
Definition: transcode.cc:733
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.
Definition: transcode.cc:469
void transcoder_exit()
Exit transcoding.
Definition: transcode.cc:738
size_t transcoder_get_size(Cache_Entry *cache_entry)
Return size of output file, as computed by encoder.
Definition: transcode.cc:723
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.
Definition: transcode.cc:603
size_t transcoder_buffer_watermark(Cache_Entry *cache_entry, uint32_t segment_no)
Return the current watermark of the file while transcoding.
Definition: transcode.cc:728
bool transcoder_cached_filesize(LPVIRTUALFILE virtualfile, struct stat *stbuf)
Simply get encoded file size (do not create the whole encoder/decoder objects)
Definition: transcode.cc:261
void transcoder_delete(Cache_Entry *cache_entry)
Free the cache entry structure.
Definition: transcode.cc:718
bool transcoder_predict_filesize(LPVIRTUALFILE virtualfile, Cache_Entry *cache_entry=nullptr)
Predict file size.
Definition: transcode.cc:328