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/opt.h"
30 #include "avformat.h"
31 #include "internal.h"
32 
33 typedef struct ModPlugContext {
34  const AVClass *class;
35  ModPlugFile *f;
36  uint8_t *buf; ///< input file content
37 
38  /* options */
46 
47  int max_size; ///< max file size to allocate
48 
49  /* optional video stream */
50  double ts_per_packet; ///< used to define the pts/dts using packet_count;
51  int packet_count; ///< total number of audio packets
52  int print_textinfo; ///< bool flag for printing speed, tempo, order, ...
53  int video_stream; ///< 1 if the user want a video stream, otherwise 0
54  int w; ///< video stream width in char (one char = 8x8px)
55  int h; ///< video stream height in char (one char = 8x8px)
56  int video_switch; ///< 1 if current packet is video, otherwise 0
57  int fsize; ///< constant frame size
58  int linesize; ///< line size in bytes
59  char *color_eval; ///< color eval user input expression
60  AVExpr *expr; ///< parsed color eval expression
62 
63 static const char * const var_names[] = {
64  "x", "y",
65  "w", "h",
66  "t",
67  "speed", "tempo", "order", "pattern", "row",
68  NULL
69 };
70 
71 enum var_name {
77 };
78 
79 #define FF_MODPLUG_MAX_FILE_SIZE (100 * 1<<20) // 100M
80 #define FF_MODPLUG_DEF_FILE_SIZE ( 5 * 1<<20) // 5M
81 
82 #define OFFSET(x) offsetof(ModPlugContext, x)
83 #define D AV_OPT_FLAG_DECODING_PARAM
84 static const AVOption options[] = {
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},
89  {"bass_range", "XBass cutoff in Hz 10-100", OFFSET(bass_range), 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)",
94  {"video_stream_expr", "Color formula", OFFSET(color_eval), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, D},
95  {"video_stream", "Make demuxer output a video stream", OFFSET(video_stream), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D},
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},
99  {NULL},
100 };
101 
102 #define SET_OPT_IF_REQUESTED(libopt, opt, flag) do { \
103  if (modplug->opt) { \
104  settings.libopt = modplug->opt; \
105  settings.mFlags |= flag; \
106  } \
107 } while (0)
108 
109 #define ADD_META_MULTIPLE_ENTRIES(entry_name, fname) do { \
110  if (n_## entry_name ##s) { \
111  unsigned i, n = 0; \
112  \
113  for (i = 0; i < n_## entry_name ##s; i++) { \
114  char item_name[64] = {0}; \
115  fname(f, i, item_name); \
116  if (!*item_name) \
117  continue; \
118  if (n) \
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); \
121  n++; \
122  } \
123  \
124  extra = av_asprintf(", %u/%u " #entry_name "%s", \
125  n, n_## entry_name ##s, n > 1 ? "s" : ""); \
126  if (!extra) \
127  return AVERROR(ENOMEM); \
128  av_dict_set(&s->metadata, "extra info", extra, AV_DICT_APPEND); \
129  av_free(extra); \
130  } \
131 } while (0)
132 
134 {
135  ModPlugContext *modplug = s->priv_data;
136  ModPlugFile *f = modplug->f;
137  char *extra;
138  const char *name = ModPlug_GetName(f);
139  const char *msg = ModPlug_GetMessage(f);
140 
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);
145 
146  if (name && *name) av_dict_set(&s->metadata, "name", name, 0);
147  if (msg && *msg) av_dict_set(&s->metadata, "message", msg, 0);
148 
149  extra = av_asprintf("%u pattern%s, %u channel%s",
150  n_patterns, n_patterns > 1 ? "s" : "",
151  n_channels, n_channels > 1 ? "s" : "");
152  if (!extra)
153  return AVERROR(ENOMEM);
154  av_dict_set(&s->metadata, "extra info", extra, AV_DICT_DONT_STRDUP_VAL);
155 
156  ADD_META_MULTIPLE_ENTRIES(instrument, ModPlug_InstrumentName);
157  ADD_META_MULTIPLE_ENTRIES(sample, ModPlug_SampleName);
158 
159  return 0;
160 }
161 
162 #define AUDIO_PKT_SIZE 512
163 
165 {
166  AVStream *st;
167  AVIOContext *pb = s->pb;
168  ModPlug_Settings settings;
169  ModPlugContext *modplug = s->priv_data;
170  int64_t sz = avio_size(pb);
171 
172  if (sz < 0) {
173  av_log(s, AV_LOG_WARNING, "Could not determine file size\n");
174  sz = modplug->max_size;
175  } else if (modplug->max_size && sz > modplug->max_size) {
176  sz = modplug->max_size;
177  av_log(s, AV_LOG_WARNING, "Max file size reach%s, allocating %"PRIi64"B "
178  "but demuxing is likely to fail due to incomplete buffer\n",
179  sz == FF_MODPLUG_DEF_FILE_SIZE ? " (see -max_size)" : "", sz);
180  }
181 
182  if (modplug->color_eval) {
183  int r = av_expr_parse(&modplug->expr, modplug->color_eval, var_names,
184  NULL, NULL, NULL, NULL, 0, s);
185  if (r < 0)
186  return r;
187  }
188 
189  modplug->buf = av_malloc(modplug->max_size);
190  if (!modplug->buf)
191  return AVERROR(ENOMEM);
192  sz = avio_read(pb, modplug->buf, sz);
193 
194  ModPlug_GetSettings(&settings);
195  settings.mChannels = 2;
196  settings.mBits = 16;
197  settings.mFrequency = 44100;
198  settings.mResamplingMode = MODPLUG_RESAMPLE_FIR; // best quality
199  settings.mLoopCount = 0; // prevents looping forever
200 
201  if (modplug->noise_reduction) settings.mFlags |= MODPLUG_ENABLE_NOISE_REDUCTION;
202  SET_OPT_IF_REQUESTED(mReverbDepth, reverb_depth, MODPLUG_ENABLE_REVERB);
203  SET_OPT_IF_REQUESTED(mReverbDelay, reverb_delay, MODPLUG_ENABLE_REVERB);
204  SET_OPT_IF_REQUESTED(mBassAmount, bass_amount, MODPLUG_ENABLE_MEGABASS);
205  SET_OPT_IF_REQUESTED(mBassRange, bass_range, MODPLUG_ENABLE_MEGABASS);
206  SET_OPT_IF_REQUESTED(mSurroundDepth, surround_depth, MODPLUG_ENABLE_SURROUND);
207  SET_OPT_IF_REQUESTED(mSurroundDelay, surround_delay, MODPLUG_ENABLE_SURROUND);
208 
209  if (modplug->reverb_depth) settings.mReverbDepth = modplug->reverb_depth;
210  if (modplug->reverb_delay) settings.mReverbDelay = modplug->reverb_delay;
211  if (modplug->bass_amount) settings.mBassAmount = modplug->bass_amount;
212  if (modplug->bass_range) settings.mBassRange = modplug->bass_range;
213  if (modplug->surround_depth) settings.mSurroundDepth = modplug->surround_depth;
214  if (modplug->surround_delay) settings.mSurroundDelay = modplug->surround_delay;
215 
216  ModPlug_SetSettings(&settings);
217 
218  modplug->f = ModPlug_Load(modplug->buf, sz);
219  if (!modplug->f)
220  return AVERROR_INVALIDDATA;
221 
222  st = avformat_new_stream(s, NULL);
223  if (!st)
224  return AVERROR(ENOMEM);
225  avpriv_set_pts_info(st, 64, 1, 1000);
226  st->duration = ModPlug_GetLength(modplug->f);
229  st->codecpar->channels = settings.mChannels;
230  st->codecpar->sample_rate = settings.mFrequency;
231 
232  // timebase = 1/1000, 2ch 16bits 44.1kHz-> 2*2*44100
233  modplug->ts_per_packet = 1000*AUDIO_PKT_SIZE / (4*44100.);
234 
235  if (modplug->video_stream) {
237  if (!vst)
238  return AVERROR(ENOMEM);
239  avpriv_set_pts_info(vst, 64, 1, 1000);
240  vst->duration = st->duration;
243  vst->codecpar->width = modplug->w << 3;
244  vst->codecpar->height = modplug->h << 3;
245  modplug->linesize = modplug->w * 3;
246  modplug->fsize = modplug->linesize * modplug->h;
247  }
248 
249  return modplug_load_metadata(s);
250 }
251 
252 static void write_text(uint8_t *dst, const char *s, int linesize, int x, int y)
253 {
254  int i;
255  dst += y*linesize + x*3;
256  for (i = 0; s[i]; i++, dst += 3) {
257  dst[0] = 0x0; // count - 1
258  dst[1] = s[i]; // char
259  dst[2] = 0x0f; // background / foreground
260  }
261 }
262 
263 #define PRINT_INFO(line, name, idvalue) do { \
264  snprintf(intbuf, sizeof(intbuf), "%.0f", var_values[idvalue]); \
265  write_text(pkt->data, name ":", modplug->linesize, 0+1, line+1); \
266  write_text(pkt->data, intbuf, modplug->linesize, 10+1, line+1); \
267 } while (0)
268 
270 {
271  ModPlugContext *modplug = s->priv_data;
272 
273  if (modplug->video_stream) {
274  modplug->video_switch ^= 1; // one video packet for one audio packet
275  if (modplug->video_switch) {
276  double var_values[VAR_VARS_NB];
277 
278  var_values[VAR_W ] = modplug->w;
279  var_values[VAR_H ] = modplug->h;
280  var_values[VAR_TIME ] = modplug->packet_count * modplug->ts_per_packet;
281  var_values[VAR_SPEED ] = ModPlug_GetCurrentSpeed (modplug->f);
282  var_values[VAR_TEMPO ] = ModPlug_GetCurrentTempo (modplug->f);
283  var_values[VAR_ORDER ] = ModPlug_GetCurrentOrder (modplug->f);
284  var_values[VAR_PATTERN] = ModPlug_GetCurrentPattern(modplug->f);
285  var_values[VAR_ROW ] = ModPlug_GetCurrentRow (modplug->f);
286 
287  if (av_new_packet(pkt, modplug->fsize) < 0)
288  return AVERROR(ENOMEM);
289  pkt->stream_index = 1;
290  memset(pkt->data, 0, modplug->fsize);
291 
292  if (modplug->print_textinfo) {
293  char intbuf[32];
294  PRINT_INFO(0, "speed", VAR_SPEED);
295  PRINT_INFO(1, "tempo", VAR_TEMPO);
296  PRINT_INFO(2, "order", VAR_ORDER);
297  PRINT_INFO(3, "pattern", VAR_PATTERN);
298  PRINT_INFO(4, "row", VAR_ROW);
299  PRINT_INFO(5, "ts", VAR_TIME);
300  }
301 
302  if (modplug->expr) {
303  int x, y;
304  for (y = 0; y < modplug->h; y++) {
305  for (x = 0; x < modplug->w; x++) {
306  double color;
307  var_values[VAR_X] = x;
308  var_values[VAR_Y] = y;
309  color = av_expr_eval(modplug->expr, var_values, NULL);
310  pkt->data[y*modplug->linesize + x*3 + 2] |= av_clip((int)color, 0, 0xf)<<4;
311  }
312  }
313  }
314  pkt->pts = pkt->dts = var_values[VAR_TIME];
316  return 0;
317  }
318  }
319 
320  if (av_new_packet(pkt, AUDIO_PKT_SIZE) < 0)
321  return AVERROR(ENOMEM);
322 
323  if (modplug->video_stream)
324  pkt->pts = pkt->dts = modplug->packet_count++ * modplug->ts_per_packet;
325 
326  pkt->size = ModPlug_Read(modplug->f, pkt->data, AUDIO_PKT_SIZE);
327  if (pkt->size <= 0) {
329  return pkt->size == 0 ? AVERROR_EOF : AVERROR(EIO);
330  }
331  return 0;
332 }
333 
335 {
336  ModPlugContext *modplug = s->priv_data;
337  ModPlug_Unload(modplug->f);
338  av_freep(&modplug->buf);
339  return 0;
340 }
341 
342 static int modplug_read_seek(AVFormatContext *s, int stream_idx, int64_t ts, int flags)
343 {
344  ModPlugContext *modplug = s->priv_data;
345  ModPlug_Seek(modplug->f, (int)ts);
346  if (modplug->video_stream)
347  modplug->packet_count = ts / modplug->ts_per_packet;
348  return 0;
349 }
350 
351 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";
352 
353 static int modplug_probe(const AVProbeData *p)
354 {
356  if (p->buf_size < 16384)
357  return AVPROBE_SCORE_EXTENSION/2-1;
358  else
360  }
361  return 0;
362 }
363 
364 static const AVClass modplug_class = {
365  .class_name = "ModPlug demuxer",
366  .item_name = av_default_item_name,
367  .option = options,
368  .version = LIBAVUTIL_VERSION_INT,
369 };
370 
372  .name = "libmodplug",
373  .long_name = NULL_IF_CONFIG_SMALL("ModPlug demuxer"),
374  .priv_data_size = sizeof(ModPlugContext),
380  .extensions = modplug_extensions,
381  .priv_class = &modplug_class,
382 };
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: avcodec.h:463
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:599
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
VAR_ORDER
@ VAR_ORDER
Definition: libmodplug.c:75
r
const char * r
Definition: vf_curves.c:114
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
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:4480
options
static const AVOption options[]
Definition: libmodplug.c:84
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: avcodec.h:3953
color
Definition: vf_paletteuse.c:588
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:55
SET_OPT_IF_REQUESTED
#define SET_OPT_IF_REQUESTED(libopt, opt, flag)
Definition: libmodplug.c:102
av_asprintf
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:113
ModPlugContext::surround_depth
int surround_depth
Definition: libmodplug.c:44
w
uint8_t w
Definition: llviddspenc.c:38
name
const char * name
Definition: avisynth_c.h:867
AVPacket::data
uint8_t * data
Definition: avcodec.h:1477
AVOption
AVOption.
Definition: opt.h:246
AVProbeData::buf_size
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:449
avio_size
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:336
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1509
VAR_VARS_NB
@ VAR_VARS_NB
Definition: libmodplug.c:76
ModPlugContext::linesize
int linesize
line size in bytes
Definition: libmodplug.c:58
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:31
modplug_read_packet
static int modplug_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: libmodplug.c:269
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:679
modplug_probe
static int modplug_probe(const AVProbeData *p)
Definition: libmodplug.c:353
ModPlugContext::print_textinfo
int print_textinfo
bool flag for printing speed, tempo, order, ...
Definition: libmodplug.c:52
AVCodecParameters::channels
int channels
Audio only.
Definition: avcodec.h:4063
write_text
static void write_text(uint8_t *dst, const char *s, int linesize, int x, int y)
Definition: libmodplug.c:252
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:153
ModPlugContext::noise_reduction
int noise_reduction
Definition: libmodplug.c:39
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
VAR_TEMPO
@ VAR_TEMPO
Definition: libmodplug.c:75
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:919
modplug_read_close
static int modplug_read_close(AVFormatContext *s)
Definition: libmodplug.c:334
VAR_TIME
@ VAR_TIME
Definition: libmodplug.c:74
ModPlugContext::reverb_depth
int reverb_depth
Definition: libmodplug.c:40
D
#define D
Definition: libmodplug.c:83
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:74
ModPlugContext::surround_delay
int surround_delay
Definition: libmodplug.c:45
AVInputFormat
Definition: avformat.h:640
s
#define s(width, name)
Definition: cbs_vp9.c:257
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: avpacket.c:86
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:645
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVCodecParameters::width
int width
Video only.
Definition: avcodec.h:4023
AVProbeData::filename
const char * filename
Definition: avformat.h:447
ModPlugContext::w
int w
video stream width in char (one char = 8x8px)
Definition: libmodplug.c:54
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:38
av_expr_eval
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition: eval.c:734
AVExpr
Definition: eval.c:157
ModPlugContext::packet_count
int packet_count
total number of audio packets
Definition: libmodplug.c:51
f
#define f(width, name)
Definition: cbs_vp9.c:255
OFFSET
#define OFFSET(x)
Definition: libmodplug.c:82
AVFormatContext
Format I/O context.
Definition: avformat.h:1342
VAR_PATTERN
@ VAR_PATTERN
Definition: libmodplug.c:75
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1017
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:530
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
ModPlugContext::fsize
int fsize
constant frame size
Definition: libmodplug.c:57
NULL
#define NULL
Definition: coverity.c:32
read_probe
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
modplug_read_seek
static int modplug_read_seek(AVFormatContext *s, int stream_idx, int64_t ts, int flags)
Definition: libmodplug.c:342
ADD_META_MULTIPLE_ENTRIES
#define ADD_META_MULTIPLE_ENTRIES(entry_name, fname)
Definition: libmodplug.c:109
ModPlugContext::ts_per_packet
double ts_per_packet
used to define the pts/dts using packet_count;
Definition: libmodplug.c:50
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
FF_MODPLUG_DEF_FILE_SIZE
#define FF_MODPLUG_DEF_FILE_SIZE
Definition: libmodplug.c:80
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:446
AVPROBE_SCORE_EXTENSION
#define AVPROBE_SCORE_EXTENSION
score for file extension
Definition: avformat.h:456
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: avcodec.h:4067
ModPlugContext::bass_amount
int bass_amount
Definition: libmodplug.c:42
VAR_X
@ VAR_X
Definition: libmodplug.c:72
VAR_ROW
@ VAR_ROW
Definition: libmodplug.c:75
ModPlugContext::buf
uint8_t * buf
input file content
Definition: libmodplug.c:36
ModPlugContext::expr
AVExpr * expr
parsed color eval expression
Definition: libmodplug.c:60
eval.h
AVIOContext
Bytestream IO Context.
Definition: avio.h:161
AVPacket::size
int size
Definition: avcodec.h:1478
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:188
var_name
var_name
Definition: aeval.c:46
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: utils.c:4910
sample
#define sample
Definition: flacdsp_template.c:44
color
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
Definition: log.c:92
VAR_W
@ VAR_W
Definition: libmodplug.c:73
AUDIO_PKT_SIZE
#define AUDIO_PKT_SIZE
Definition: libmodplug.c:162
ModPlugContext::max_size
int max_size
max file size to allocate
Definition: libmodplug.c:47
ModPlugContext::video_stream
int video_stream
1 if the user want a video stream, otherwise 0
Definition: libmodplug.c:53
var_names
static const char *const var_names[]
Definition: libmodplug.c:63
ModPlugContext::f
ModPlugFile * f
Definition: libmodplug.c:35
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: avcodec.h:1476
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1483
ModPlugContext::reverb_delay
int reverb_delay
Definition: libmodplug.c:41
VAR_SPEED
@ VAR_SPEED
Definition: libmodplug.c:75
VAR_Y
@ VAR_Y
Definition: libmodplug.c:72
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1470
VAR_H
@ VAR_H
Definition: libmodplug.c:73
AVCodecParameters::height
int height
Definition: avcodec.h:4024
xf
#define xf(width, name, var, range_min, range_max, subs,...)
Definition: cbs_av1.c:668
uint8_t
uint8_t
Definition: audio_convert.c:194
modplug_class
static const AVClass modplug_class
Definition: libmodplug.c:364
ModPlugContext::video_switch
int video_switch
1 if current packet is video, otherwise 0
Definition: libmodplug.c:56
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
AVStream
Stream structure.
Definition: avformat.h:870
ModPlugContext::h
int h
video stream height in char (one char = 8x8px)
Definition: libmodplug.c:55
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:72
video_stream
static AVStream * video_stream
Definition: demuxing_decoding.c:41
avformat.h
ff_libmodplug_demuxer
AVInputFormat ff_libmodplug_demuxer
Definition: libmodplug.c:371
ModPlugContext::bass_range
int bass_range
Definition: libmodplug.c:43
pkt
static AVPacket pkt
Definition: demuxing_decoding.c:54
modplug_read_header
static int modplug_read_header(AVFormatContext *s)
Definition: libmodplug.c:164
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:647
AVPacket::stream_index
int stream_index
Definition: avcodec.h:1479
AV_CODEC_ID_XBIN
@ AV_CODEC_ID_XBIN
Definition: avcodec.h:692
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
modplug_extensions
static const char modplug_extensions[]
Definition: libmodplug.c:351
FF_MODPLUG_MAX_FILE_SIZE
#define FF_MODPLUG_MAX_FILE_SIZE
Definition: libmodplug.c:79
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: avcodec.h:3957
AVPacket
This structure stores compressed data.
Definition: avcodec.h:1454
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
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:70
ModPlugContext::color_eval
char * color_eval
color eval user input expression
Definition: libmodplug.c:59
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
PRINT_INFO
#define PRINT_INFO(line, name, idvalue)
Definition: libmodplug.c:263
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
h
h
Definition: vp9dsp_template.c:2038
avstring.h
ModPlugContext
Definition: libmodplug.c:33
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227
modplug_load_metadata
static int modplug_load_metadata(AVFormatContext *s)
Definition: libmodplug.c:133