Go to the documentation of this file.
25 #define MODPLUG_STATIC
26 #include <libmodplug/modplug.h>
67 "speed",
"tempo",
"order",
"pattern",
"row",
79 #define FF_MODPLUG_MAX_FILE_SIZE (100 * 1<<20) // 100M
80 #define FF_MODPLUG_DEF_FILE_SIZE ( 5 * 1<<20) // 5M
82 #define OFFSET(x) offsetof(ModPlugContext, x)
83 #define D AV_OPT_FLAG_DECODING_PARAM
85 {
"noise_reduction",
"Enable noise reduction 0(off)-1(on)",
OFFSET(noise_reduction),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1,
D},
86 {
"reverb_depth",
"Reverb level 0(quiet)-100(loud)",
OFFSET(reverb_depth),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100,
D},
87 {
"reverb_delay",
"Reverb delay in ms, usually 40-200ms",
OFFSET(reverb_delay),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX,
D},
88 {
"bass_amount",
"XBass level 0(quiet)-100(loud)",
OFFSET(bass_amount),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100,
D},
90 {
"surround_depth",
"Surround level 0(quiet)-100(heavy)",
OFFSET(surround_depth),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100,
D},
91 {
"surround_delay",
"Surround delay in ms, usually 5-40ms",
OFFSET(surround_delay),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX,
D},
92 {
"max_size",
"Max file size supported (in bytes). Default is 5MB. Set to 0 for no limit (not recommended)",
96 {
"video_stream_w",
"Video stream width in char (one char = 8x8px)",
OFFSET(
w),
AV_OPT_TYPE_INT, {.i64 = 30}, 20, 512,
D},
97 {
"video_stream_h",
"Video stream height in char (one char = 8x8px)",
OFFSET(
h),
AV_OPT_TYPE_INT, {.i64 = 30}, 20, 512,
D},
98 {
"video_stream_ptxt",
"Print speed, tempo, order, ... in video stream",
OFFSET(print_textinfo),
AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1,
D},
102 #define SET_OPT_IF_REQUESTED(libopt, opt, flag) do { \
103 if (modplug->opt) { \
104 settings.libopt = modplug->opt; \
105 settings.mFlags |= flag; \
109 #define ADD_META_MULTIPLE_ENTRIES(entry_name, fname) do { \
110 if (n_## entry_name ##s) { \
113 for (i = 0; i < n_## entry_name ##s; i++) { \
114 char item_name[64] = {0}; \
115 fname(f, i, item_name); \
119 av_dict_set(&s->metadata, #entry_name, "\n", AV_DICT_APPEND); \
120 av_dict_set(&s->metadata, #entry_name, item_name, AV_DICT_APPEND); \
124 extra = av_asprintf(", %u/%u " #entry_name "%s", \
125 n, n_## entry_name ##s, n > 1 ? "s" : ""); \
127 return AVERROR(ENOMEM); \
128 av_dict_set(&s->metadata, "extra info", extra, AV_DICT_APPEND); \
136 ModPlugFile *
f = modplug->
f;
138 const char *
name = ModPlug_GetName(
f);
139 const char *msg = ModPlug_GetMessage(
f);
141 unsigned n_instruments = ModPlug_NumInstruments(
f);
142 unsigned n_samples = ModPlug_NumSamples(
f);
143 unsigned n_patterns = ModPlug_NumPatterns(
f);
144 unsigned n_channels = ModPlug_NumChannels(
f);
147 if (msg && *msg)
av_dict_set(&
s->metadata,
"message", msg, 0);
150 n_patterns, n_patterns > 1 ?
"s" :
"",
151 n_channels, n_channels > 1 ?
"s" :
"");
162 #define AUDIO_PKT_SIZE 512
168 ModPlug_Settings settings;
178 "but demuxing is likely to fail due to incomplete buffer\n",
194 ModPlug_GetSettings(&settings);
195 settings.mChannels = 2;
197 settings.mFrequency = 44100;
198 settings.mResamplingMode = MODPLUG_RESAMPLE_FIR;
199 settings.mLoopCount = 0;
201 if (modplug->
noise_reduction) settings.mFlags |= MODPLUG_ENABLE_NOISE_REDUCTION;
216 ModPlug_SetSettings(&settings);
218 modplug->
f = ModPlug_Load(modplug->
buf, sz);
227 st->
duration = ModPlug_GetLength(modplug->
f);
256 dst += y*linesize +
x*3;
257 for (
i = 0;
s[
i];
i++, dst += 3) {
264 #define PRINT_INFO(line, name, idvalue) do { \
265 snprintf(intbuf, sizeof(intbuf), "%.0f", var_values[idvalue]); \
266 write_text(pkt->data, name ":", modplug->linesize, 0+1, line+1); \
267 write_text(pkt->data, intbuf, modplug->linesize, 10+1, line+1); \
280 var_values[
VAR_W ] = modplug->
w;
281 var_values[
VAR_H ] = modplug->
h;
283 var_values[
VAR_SPEED ] = ModPlug_GetCurrentSpeed (modplug->
f);
284 var_values[
VAR_TEMPO ] = ModPlug_GetCurrentTempo (modplug->
f);
285 var_values[
VAR_ORDER ] = ModPlug_GetCurrentOrder (modplug->
f);
286 var_values[
VAR_PATTERN] = ModPlug_GetCurrentPattern(modplug->
f);
287 var_values[
VAR_ROW ] = ModPlug_GetCurrentRow (modplug->
f);
306 for (y = 0; y < modplug->
h; y++) {
307 for (
x = 0;
x < modplug->
w;
x++) {
310 var_values[
VAR_Y] = y;
338 ModPlug_Unload(modplug->
f);
346 ModPlug_Seek(modplug->
f, (
int)ts);
352 static const char modplug_extensions[] =
"669,abc,amf,ams,dbm,dmf,dsm,far,it,mdl,med,mid,mod,mt2,mtm,okt,psm,ptm,s3m,stm,ult,umx,xm,itgz,itr,itz,mdgz,mdr,mdz,s3gz,s3r,s3z,xmgz,xmr,xmz";
373 .
name =
"libmodplug",
#define AV_LOG_WARNING
Something somehow does not look correct.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static const AVOption options[]
enum AVMediaType codec_type
General type of the encoded data.
#define AVERROR_EOF
End of file.
#define SET_OPT_IF_REQUESTED(libopt, opt, flag)
char * av_asprintf(const char *fmt,...)
int buf_size
Size of buf except extra allocated bytes.
int64_t avio_size(AVIOContext *s)
Get the filesize.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int linesize
line size in bytes
static int modplug_read_packet(AVFormatContext *s, AVPacket *pkt)
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
static int modplug_probe(const AVProbeData *p)
int print_textinfo
bool flag for printing speed, tempo, order, ...
static void write_text(uint8_t *dst, const char *s, int linesize, int x, int y)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
static av_cold int read_close(AVFormatContext *ctx)
int64_t duration
Decoding: duration of the stream, in stream time base.
static int modplug_read_close(AVFormatContext *s)
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
int w
video stream width in char (one char = 8x8px)
int av_match_ext(const char *filename, const char *extensions)
Return a positive value if the given filename has one of the given extensions, 0 otherwise.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
int packet_count
total number of audio packets
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
static int read_header(FFV1Context *f)
Describe the class of an AVClass context structure.
int fsize
constant frame size
static int modplug_read_seek(AVFormatContext *s, int stream_idx, int64_t ts, int flags)
#define ADD_META_MULTIPLE_ENTRIES(entry_name, fname)
double ts_per_packet
used to define the pts/dts using packet_count;
const char * av_default_item_name(void *ptr)
Return the context name.
#define FF_MODPLUG_DEF_FILE_SIZE
This structure contains the data a format has to probe a file.
int sample_rate
Audio only.
uint8_t * buf
input file content
AVExpr * expr
parsed color eval expression
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
int max_size
max file size to allocate
int video_stream
1 if the user want a video stream, otherwise 0
static const char *const var_names[]
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int flags
A combination of AV_PKT_FLAG values.
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define xf(width, name, var, range_min, range_max, subs,...)
static const AVClass modplug_class
int video_switch
1 if current packet is video, otherwise 0
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int h
video stream height in char (one char = 8x8px)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static AVStream * video_stream
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
AVInputFormat ff_libmodplug_demuxer
static int modplug_read_header(AVFormatContext *s)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static const char modplug_extensions[]
#define FF_MODPLUG_MAX_FILE_SIZE
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
char * color_eval
color eval user input expression
#define flags(name, subs,...)
#define PRINT_INFO(line, name, idvalue)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int modplug_load_metadata(AVFormatContext *s)