FFmpeg
libmodplug.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 /**
20 * @file
21 * ModPlug demuxer
22 * @todo better probing than extensions matching
23 */
24 
25 #define MODPLUG_STATIC
26 #include <libmodplug/modplug.h>
27 #include "libavutil/avstring.h"
28 #include "libavutil/eval.h"
29 #include "libavutil/mem.h"
30 #include "libavutil/opt.h"
31 #include "avformat.h"
32 #include "demux.h"
33 #include "internal.h"
34 
35 typedef struct ModPlugContext {
36  const AVClass *class;
37  ModPlugFile *f;
38  uint8_t *buf; ///< input file content
39 
40  /* options */
48 
49  int max_size; ///< max file size to allocate
50 
51  /* optional video stream */
52  double ts_per_packet; ///< used to define the pts/dts using packet_count;
53  int packet_count; ///< total number of audio packets
54  int print_textinfo; ///< bool flag for printing speed, tempo, order, ...
55  int video_stream; ///< 1 if the user want a video stream, otherwise 0
56  int w; ///< video stream width in char (one char = 8x8px)
57  int h; ///< video stream height in char (one char = 8x8px)
58  int video_switch; ///< 1 if current packet is video, otherwise 0
59  int fsize; ///< constant frame size
60  int linesize; ///< line size in bytes
61  char *color_eval; ///< color eval user input expression
62  AVExpr *expr; ///< parsed color eval expression
64 
65 static const char * const var_names[] = {
66  "x", "y",
67  "w", "h",
68  "t",
69  "speed", "tempo", "order", "pattern", "row",
70  NULL
71 };
72 
73 enum var_name {
79 };
80 
81 #define FF_MODPLUG_MAX_FILE_SIZE (100 * 1<<20) // 100M
82 #define FF_MODPLUG_DEF_FILE_SIZE ( 5 * 1<<20) // 5M
83 
84 #define OFFSET(x) offsetof(ModPlugContext, x)
85 #define D AV_OPT_FLAG_DECODING_PARAM
86 static const AVOption options[] = {
87  {"noise_reduction", "Enable noise reduction 0(off)-1(on)", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D},
88  {"reverb_depth", "Reverb level 0(quiet)-100(loud)", OFFSET(reverb_depth), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100, D},
89  {"reverb_delay", "Reverb delay in ms, usually 40-200ms", OFFSET(reverb_delay), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D},
90  {"bass_amount", "XBass level 0(quiet)-100(loud)", OFFSET(bass_amount), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100, D},
91  {"bass_range", "XBass cutoff in Hz 10-100", OFFSET(bass_range), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100, D},
92  {"surround_depth", "Surround level 0(quiet)-100(heavy)", OFFSET(surround_depth), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100, D},
93  {"surround_delay", "Surround delay in ms, usually 5-40ms", OFFSET(surround_delay), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D},
94  {"max_size", "Max file size supported (in bytes). Default is 5MB. Set to 0 for no limit (not recommended)",
96  {"video_stream_expr", "Color formula", OFFSET(color_eval), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, D},
97  {"video_stream", "Make demuxer output a video stream", OFFSET(video_stream), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D},
98  {"video_stream_w", "Video stream width in char (one char = 8x8px)", OFFSET(w), AV_OPT_TYPE_INT, {.i64 = 30}, 20, 512, D},
99  {"video_stream_h", "Video stream height in char (one char = 8x8px)", OFFSET(h), AV_OPT_TYPE_INT, {.i64 = 30}, 20, 512, D},
100  {"video_stream_ptxt", "Print speed, tempo, order, ... in video stream", OFFSET(print_textinfo), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, D},
101  {NULL},
102 };
103 
105 {
106  ModPlugContext *modplug = s->priv_data;
107  ModPlug_Unload(modplug->f);
108  av_freep(&modplug->buf);
109  return 0;
110 }
111 
112 #define SET_OPT_IF_REQUESTED(libopt, opt, flag) do { \
113  if (modplug->opt) { \
114  settings.libopt = modplug->opt; \
115  settings.mFlags |= flag; \
116  } \
117 } while (0)
118 
119 #define ADD_META_MULTIPLE_ENTRIES(entry_name, fname) do { \
120  if (n_## entry_name ##s) { \
121  unsigned i, n = 0; \
122  \
123  for (i = 0; i < n_## entry_name ##s; i++) { \
124  char item_name[64] = {0}; \
125  fname(f, i, item_name); \
126  if (!*item_name) \
127  continue; \
128  if (n) \
129  av_dict_set(&s->metadata, #entry_name, "\n", AV_DICT_APPEND); \
130  av_dict_set(&s->metadata, #entry_name, item_name, AV_DICT_APPEND); \
131  n++; \
132  } \
133  \
134  extra = av_asprintf(", %u/%u " #entry_name "%s", \
135  n, n_## entry_name ##s, n > 1 ? "s" : ""); \
136  if (!extra) \
137  return AVERROR(ENOMEM); \
138  av_dict_set(&s->metadata, "extra info", extra, AV_DICT_APPEND); \
139  av_free(extra); \
140  } \
141 } while (0)
142 
144 {
145  ModPlugContext *modplug = s->priv_data;
146  ModPlugFile *f = modplug->f;
147  char *extra;
148  const char *name = ModPlug_GetName(f);
149  const char *msg = ModPlug_GetMessage(f);
150 
151  unsigned n_instruments = ModPlug_NumInstruments(f);
152  unsigned n_samples = ModPlug_NumSamples(f);
153  unsigned n_patterns = ModPlug_NumPatterns(f);
154  unsigned n_channels = ModPlug_NumChannels(f);
155 
156  if (name && *name) av_dict_set(&s->metadata, "name", name, 0);
157  if (msg && *msg) av_dict_set(&s->metadata, "message", msg, 0);
158 
159  extra = av_asprintf("%u pattern%s, %u channel%s",
160  n_patterns, n_patterns > 1 ? "s" : "",
161  n_channels, n_channels > 1 ? "s" : "");
162  if (!extra)
163  return AVERROR(ENOMEM);
164  av_dict_set(&s->metadata, "extra info", extra, AV_DICT_DONT_STRDUP_VAL);
165 
166  ADD_META_MULTIPLE_ENTRIES(instrument, ModPlug_InstrumentName);
167  ADD_META_MULTIPLE_ENTRIES(sample, ModPlug_SampleName);
168 
169  return 0;
170 }
171 
172 #define AUDIO_PKT_SIZE 512
173 
175 {
176  AVStream *st;
177  AVIOContext *pb = s->pb;
178  ModPlug_Settings settings;
179  ModPlugContext *modplug = s->priv_data;
180  int64_t sz = avio_size(pb);
181  int ret;
182 
183  if (sz < 0) {
184  av_log(s, AV_LOG_WARNING, "Could not determine file size\n");
185  sz = modplug->max_size;
186  } else if (modplug->max_size && sz > modplug->max_size) {
187  sz = modplug->max_size;
188  av_log(s, AV_LOG_WARNING, "Max file size reach%s, allocating %"PRIi64"B "
189  "but demuxing is likely to fail due to incomplete buffer\n",
190  sz == FF_MODPLUG_DEF_FILE_SIZE ? " (see -max_size)" : "", sz);
191  }
192 
193  if (modplug->color_eval) {
194  int r = av_expr_parse(&modplug->expr, modplug->color_eval, var_names,
195  NULL, NULL, NULL, NULL, 0, s);
196  if (r < 0)
197  return r;
198  }
199 
200  modplug->buf = av_malloc(modplug->max_size);
201  if (!modplug->buf)
202  return AVERROR(ENOMEM);
203  sz = avio_read(pb, modplug->buf, sz);
204 
205  ModPlug_GetSettings(&settings);
206  settings.mChannels = 2;
207  settings.mBits = 16;
208  settings.mFrequency = 44100;
209  settings.mResamplingMode = MODPLUG_RESAMPLE_FIR; // best quality
210  settings.mLoopCount = 0; // prevents looping forever
211 
212  if (modplug->noise_reduction) settings.mFlags |= MODPLUG_ENABLE_NOISE_REDUCTION;
213  SET_OPT_IF_REQUESTED(mReverbDepth, reverb_depth, MODPLUG_ENABLE_REVERB);
214  SET_OPT_IF_REQUESTED(mReverbDelay, reverb_delay, MODPLUG_ENABLE_REVERB);
215  SET_OPT_IF_REQUESTED(mBassAmount, bass_amount, MODPLUG_ENABLE_MEGABASS);
216  SET_OPT_IF_REQUESTED(mBassRange, bass_range, MODPLUG_ENABLE_MEGABASS);
217  SET_OPT_IF_REQUESTED(mSurroundDepth, surround_depth, MODPLUG_ENABLE_SURROUND);
218  SET_OPT_IF_REQUESTED(mSurroundDelay, surround_delay, MODPLUG_ENABLE_SURROUND);
219 
220  if (modplug->reverb_depth) settings.mReverbDepth = modplug->reverb_depth;
221  if (modplug->reverb_delay) settings.mReverbDelay = modplug->reverb_delay;
222  if (modplug->bass_amount) settings.mBassAmount = modplug->bass_amount;
223  if (modplug->bass_range) settings.mBassRange = modplug->bass_range;
224  if (modplug->surround_depth) settings.mSurroundDepth = modplug->surround_depth;
225  if (modplug->surround_delay) settings.mSurroundDelay = modplug->surround_delay;
226 
227  ModPlug_SetSettings(&settings);
228 
229  modplug->f = ModPlug_Load(modplug->buf, sz);
230  if (!modplug->f) {
231  av_freep(&modplug->buf);
232  return AVERROR_INVALIDDATA;
233  }
234  st = avformat_new_stream(s, NULL);
235  if (!st) {
236  ret = AVERROR(ENOMEM);
237  goto fail;
238  }
239  avpriv_set_pts_info(st, 64, 1, 1000);
240  st->duration = ModPlug_GetLength(modplug->f);
243  st->codecpar->ch_layout.nb_channels = settings.mChannels;
244  st->codecpar->sample_rate = settings.mFrequency;
245 
246  // timebase = 1/1000, 2ch 16bits 44.1kHz-> 2*2*44100
247  modplug->ts_per_packet = 1000*AUDIO_PKT_SIZE / (4*44100.);
248 
249  if (modplug->video_stream) {
251  if (!vst) {
252  ret = AVERROR(ENOMEM);
253  goto fail;
254  }
255  avpriv_set_pts_info(vst, 64, 1, 1000);
256  vst->duration = st->duration;
259  vst->codecpar->width = modplug->w << 3;
260  vst->codecpar->height = modplug->h << 3;
261  modplug->linesize = modplug->w * 3;
262  modplug->fsize = modplug->linesize * modplug->h;
263  }
264 
266  if (ret < 0)
267  goto fail;
268  return 0;
269 fail:
271  return ret;
272 }
273 
274 static void write_text(uint8_t *dst, const char *s, int linesize, int x, int y)
275 {
276  int i;
277  dst += y*linesize + x*3;
278  for (i = 0; s[i]; i++, dst += 3) {
279  dst[0] = 0x0; // count - 1
280  dst[1] = s[i]; // char
281  dst[2] = 0x0f; // background / foreground
282  }
283 }
284 
285 #define PRINT_INFO(line, name, idvalue) do { \
286  snprintf(intbuf, sizeof(intbuf), "%.0f", var_values[idvalue]); \
287  write_text(pkt->data, name ":", modplug->linesize, 0+1, line+1); \
288  write_text(pkt->data, intbuf, modplug->linesize, 10+1, line+1); \
289 } while (0)
290 
292 {
293  ModPlugContext *modplug = s->priv_data;
294  int ret;
295 
296  if (modplug->video_stream) {
297  modplug->video_switch ^= 1; // one video packet for one audio packet
298  if (modplug->video_switch) {
299  double var_values[VAR_VARS_NB];
300 
301  var_values[VAR_W ] = modplug->w;
302  var_values[VAR_H ] = modplug->h;
303  var_values[VAR_TIME ] = modplug->packet_count * modplug->ts_per_packet;
304  var_values[VAR_SPEED ] = ModPlug_GetCurrentSpeed (modplug->f);
305  var_values[VAR_TEMPO ] = ModPlug_GetCurrentTempo (modplug->f);
306  var_values[VAR_ORDER ] = ModPlug_GetCurrentOrder (modplug->f);
307  var_values[VAR_PATTERN] = ModPlug_GetCurrentPattern(modplug->f);
308  var_values[VAR_ROW ] = ModPlug_GetCurrentRow (modplug->f);
309 
310  if ((ret = av_new_packet(pkt, modplug->fsize)) < 0)
311  return ret;
312  pkt->stream_index = 1;
313  memset(pkt->data, 0, modplug->fsize);
314 
315  if (modplug->print_textinfo) {
316  char intbuf[32];
317  PRINT_INFO(0, "speed", VAR_SPEED);
318  PRINT_INFO(1, "tempo", VAR_TEMPO);
319  PRINT_INFO(2, "order", VAR_ORDER);
320  PRINT_INFO(3, "pattern", VAR_PATTERN);
321  PRINT_INFO(4, "row", VAR_ROW);
322  PRINT_INFO(5, "ts", VAR_TIME);
323  }
324 
325  if (modplug->expr) {
326  int x, y;
327  for (y = 0; y < modplug->h; y++) {
328  for (x = 0; x < modplug->w; x++) {
329  double color;
330  var_values[VAR_X] = x;
331  var_values[VAR_Y] = y;
332  color = av_expr_eval(modplug->expr, var_values, NULL);
333  pkt->data[y*modplug->linesize + x*3 + 2] |= av_clip((int)color, 0, 0xf)<<4;
334  }
335  }
336  }
337  pkt->pts = pkt->dts = var_values[VAR_TIME];
339  return 0;
340  }
341  }
342 
343  if ((ret = av_new_packet(pkt, AUDIO_PKT_SIZE)) < 0)
344  return ret;
345 
346  if (modplug->video_stream)
347  pkt->pts = pkt->dts = modplug->packet_count++ * modplug->ts_per_packet;
348 
349  pkt->size = ModPlug_Read(modplug->f, pkt->data, AUDIO_PKT_SIZE);
350  if (pkt->size <= 0) {
351  return pkt->size == 0 ? AVERROR_EOF : AVERROR(EIO);
352  }
353  return 0;
354 }
355 
356 static int modplug_read_seek(AVFormatContext *s, int stream_idx, int64_t ts, int flags)
357 {
358  ModPlugContext *modplug = s->priv_data;
359  ModPlug_Seek(modplug->f, (int)ts);
360  if (modplug->video_stream)
361  modplug->packet_count = ts / modplug->ts_per_packet;
362  return 0;
363 }
364 
365 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";
366 
367 static int modplug_probe(const AVProbeData *p)
368 {
370  if (p->buf_size < 16384)
371  return AVPROBE_SCORE_EXTENSION/2-1;
372  else
374  }
375  return 0;
376 }
377 
378 static const AVClass modplug_class = {
379  .class_name = "ModPlug demuxer",
380  .item_name = av_default_item_name,
381  .option = options,
382  .version = LIBAVUTIL_VERSION_INT,
383 };
384 
386  .p.name = "libmodplug",
387  .p.long_name = NULL_IF_CONFIG_SMALL("ModPlug demuxer"),
388  .p.extensions = modplug_extensions,
389  .p.priv_class = &modplug_class,
390  .priv_data_size = sizeof(ModPlugContext),
396 };
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:334
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:215
name
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
Definition: writing_filters.txt:88
av_clip
#define av_clip
Definition: common.h:100
VAR_ORDER
@ VAR_ORDER
Definition: libmodplug.c:77
r
const char * r
Definition: vf_curves.c:127
AVERROR
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
opt.h
options
static const AVOption options[]
Definition: libmodplug.c:86
var_name
var_name
Definition: noise.c:47
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
color
Definition: vf_paletteuse.c:513
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
int64_t
long long int64_t
Definition: coverity.c:34
SET_OPT_IF_REQUESTED
#define SET_OPT_IF_REQUESTED(libopt, opt, flag)
Definition: libmodplug.c:112
av_asprintf
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:115
ModPlugContext::surround_depth
int surround_depth
Definition: libmodplug.c:46
w
uint8_t w
Definition: llviddspenc.c:38
AVPacket::data
uint8_t * data
Definition: packet.h:539
AVOption
AVOption.
Definition: opt.h:429
AVProbeData::buf_size
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:454
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:327
avio_size
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:323
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:594
VAR_VARS_NB
@ VAR_VARS_NB
Definition: libmodplug.c:78
ModPlugContext::linesize
int linesize
line size in bytes
Definition: libmodplug.c:60
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
modplug_read_packet
static int modplug_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: libmodplug.c:291
av_expr_parse
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.
Definition: eval.c:710
modplug_probe
static int modplug_probe(const AVProbeData *p)
Definition: libmodplug.c:367
ModPlugContext::print_textinfo
int print_textinfo
bool flag for printing speed, tempo, order, ...
Definition: libmodplug.c:54
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: avformat.c:867
write_text
static void write_text(uint8_t *dst, const char *s, int linesize, int x, int y)
Definition: libmodplug.c:274
fail
#define fail()
Definition: checkasm.h:193
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:151
ModPlugContext::noise_reduction
int noise_reduction
Definition: libmodplug.c:41
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
ff_libmodplug_demuxer
const FFInputFormat ff_libmodplug_demuxer
Definition: libmodplug.c:385
VAR_TEMPO
@ VAR_TEMPO
Definition: libmodplug.c:77
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:807
modplug_read_close
static int modplug_read_close(AVFormatContext *s)
Definition: libmodplug.c:104
VAR_TIME
@ VAR_TIME
Definition: libmodplug.c:76
ModPlugContext::reverb_depth
int reverb_depth
Definition: libmodplug.c:42
D
#define D
Definition: libmodplug.c:85
AV_DICT_DONT_STRDUP_VAL
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
Definition: dict.h:79
ModPlugContext::surround_delay
int surround_delay
Definition: libmodplug.c:47
pkt
AVPacket * pkt
Definition: movenc.c:60
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
s
#define s(width, name)
Definition: cbs_vp9.c:198
av_new_packet
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: packet.c:98
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:553
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:134
video_stream
static AVStream * video_stream
Definition: demux_decode.c:42
AVProbeData::filename
const char * filename
Definition: avformat.h:452
ModPlugContext::w
int w
video stream width in char (one char = 8x8px)
Definition: libmodplug.c:56
av_match_ext
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.
Definition: format.c:41
av_expr_eval
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition: eval.c:792
AVExpr
Definition: eval.c:158
ModPlugContext::packet_count
int packet_count
total number of audio packets
Definition: libmodplug.c:53
OFFSET
#define OFFSET(x)
Definition: libmodplug.c:84
AVFormatContext
Format I/O context.
Definition: avformat.h:1300
VAR_PATTERN
@ VAR_PATTERN
Definition: libmodplug.c:77
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:771
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:540
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
ModPlugContext::fsize
int fsize
constant frame size
Definition: libmodplug.c:59
NULL
#define NULL
Definition: coverity.c:32
modplug_read_seek
static int modplug_read_seek(AVFormatContext *s, int stream_idx, int64_t ts, int flags)
Definition: libmodplug.c:356
ADD_META_MULTIPLE_ENTRIES
#define ADD_META_MULTIPLE_ENTRIES(entry_name, fname)
Definition: libmodplug.c:119
ModPlugContext::ts_per_packet
double ts_per_packet
used to define the pts/dts using packet_count;
Definition: libmodplug.c:52
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
FF_MODPLUG_DEF_FILE_SIZE
#define FF_MODPLUG_DEF_FILE_SIZE
Definition: libmodplug.c:82
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
options
Definition: swscale.c:42
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:180
AVPROBE_SCORE_EXTENSION
#define AVPROBE_SCORE_EXTENSION
score for file extension
Definition: avformat.h:461
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:184
ModPlugContext::bass_amount
int bass_amount
Definition: libmodplug.c:44
VAR_X
@ VAR_X
Definition: libmodplug.c:74
VAR_ROW
@ VAR_ROW
Definition: libmodplug.c:77
ModPlugContext::buf
uint8_t * buf
input file content
Definition: libmodplug.c:38
ModPlugContext::expr
AVExpr * expr
parsed color eval expression
Definition: libmodplug.c:62
eval.h
f
f
Definition: af_crystalizer.c:122
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
AVPacket::size
int size
Definition: packet.h:540
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
sample
#define sample
Definition: flacdsp_template.c:44
color
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
Definition: log.c:94
VAR_W
@ VAR_W
Definition: libmodplug.c:75
AUDIO_PKT_SIZE
#define AUDIO_PKT_SIZE
Definition: libmodplug.c:172
ModPlugContext::max_size
int max_size
max file size to allocate
Definition: libmodplug.c:49
ModPlugContext::video_stream
int video_stream
1 if the user want a video stream, otherwise 0
Definition: libmodplug.c:55
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:46
var_names
static const char *const var_names[]
Definition: libmodplug.c:65
ModPlugContext::f
ModPlugFile * f
Definition: libmodplug.c:37
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:538
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:545
ModPlugContext::reverb_delay
int reverb_delay
Definition: libmodplug.c:43
VAR_SPEED
@ VAR_SPEED
Definition: libmodplug.c:77
VAR_Y
@ VAR_Y
Definition: libmodplug.c:74
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:532
VAR_H
@ VAR_H
Definition: libmodplug.c:75
AVCodecParameters::height
int height
Definition: codec_par.h:135
xf
#define xf(width, name, var, range_min, range_max, subs,...)
Definition: cbs_av1.c:598
modplug_class
static const AVClass modplug_class
Definition: libmodplug.c:378
demux.h
ModPlugContext::video_switch
int video_switch
1 if current packet is video, otherwise 0
Definition: libmodplug.c:58
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:748
ModPlugContext::h
int h
video stream height in char (one char = 8x8px)
Definition: libmodplug.c:57
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:80
avformat.h
ModPlugContext::bass_range
int bass_range
Definition: libmodplug.c:45
modplug_read_header
static int modplug_read_header(AVFormatContext *s)
Definition: libmodplug.c:174
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:612
AVPacket::stream_index
int stream_index
Definition: packet.h:541
AV_CODEC_ID_XBIN
@ AV_CODEC_ID_XBIN
Definition: codec_id.h:590
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
modplug_extensions
static const char modplug_extensions[]
Definition: libmodplug.c:365
FF_MODPLUG_MAX_FILE_SIZE
#define FF_MODPLUG_MAX_FILE_SIZE
Definition: libmodplug.c:81
mem.h
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
AVPacket
This structure stores compressed data.
Definition: packet.h:516
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
av_dict_set
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:88
ModPlugContext::color_eval
char * color_eval
color eval user input expression
Definition: libmodplug.c:61
FFInputFormat
Definition: demux.h:42
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
PRINT_INFO
#define PRINT_INFO(line, name, idvalue)
Definition: libmodplug.c:285
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
h
h
Definition: vp9dsp_template.c:2070
avstring.h
ModPlugContext
Definition: libmodplug.c:35
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
modplug_load_metadata
static int modplug_load_metadata(AVFormatContext *s)
Definition: libmodplug.c:143