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 "demux.h"
32 #include "internal.h"
33 
34 typedef struct ModPlugContext {
35  const AVClass *class;
36  ModPlugFile *f;
37  uint8_t *buf; ///< input file content
38 
39  /* options */
47 
48  int max_size; ///< max file size to allocate
49 
50  /* optional video stream */
51  double ts_per_packet; ///< used to define the pts/dts using packet_count;
52  int packet_count; ///< total number of audio packets
53  int print_textinfo; ///< bool flag for printing speed, tempo, order, ...
54  int video_stream; ///< 1 if the user want a video stream, otherwise 0
55  int w; ///< video stream width in char (one char = 8x8px)
56  int h; ///< video stream height in char (one char = 8x8px)
57  int video_switch; ///< 1 if current packet is video, otherwise 0
58  int fsize; ///< constant frame size
59  int linesize; ///< line size in bytes
60  char *color_eval; ///< color eval user input expression
61  AVExpr *expr; ///< parsed color eval expression
63 
64 static const char * const var_names[] = {
65  "x", "y",
66  "w", "h",
67  "t",
68  "speed", "tempo", "order", "pattern", "row",
69  NULL
70 };
71 
72 enum var_name {
78 };
79 
80 #define FF_MODPLUG_MAX_FILE_SIZE (100 * 1<<20) // 100M
81 #define FF_MODPLUG_DEF_FILE_SIZE ( 5 * 1<<20) // 5M
82 
83 #define OFFSET(x) offsetof(ModPlugContext, x)
84 #define D AV_OPT_FLAG_DECODING_PARAM
85 static const AVOption options[] = {
86  {"noise_reduction", "Enable noise reduction 0(off)-1(on)", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D},
87  {"reverb_depth", "Reverb level 0(quiet)-100(loud)", OFFSET(reverb_depth), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100, D},
88  {"reverb_delay", "Reverb delay in ms, usually 40-200ms", OFFSET(reverb_delay), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D},
89  {"bass_amount", "XBass level 0(quiet)-100(loud)", OFFSET(bass_amount), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100, D},
90  {"bass_range", "XBass cutoff in Hz 10-100", OFFSET(bass_range), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100, D},
91  {"surround_depth", "Surround level 0(quiet)-100(heavy)", OFFSET(surround_depth), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100, D},
92  {"surround_delay", "Surround delay in ms, usually 5-40ms", OFFSET(surround_delay), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D},
93  {"max_size", "Max file size supported (in bytes). Default is 5MB. Set to 0 for no limit (not recommended)",
95  {"video_stream_expr", "Color formula", OFFSET(color_eval), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, D},
96  {"video_stream", "Make demuxer output a video stream", OFFSET(video_stream), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, D},
97  {"video_stream_w", "Video stream width in char (one char = 8x8px)", OFFSET(w), AV_OPT_TYPE_INT, {.i64 = 30}, 20, 512, D},
98  {"video_stream_h", "Video stream height in char (one char = 8x8px)", OFFSET(h), AV_OPT_TYPE_INT, {.i64 = 30}, 20, 512, D},
99  {"video_stream_ptxt", "Print speed, tempo, order, ... in video stream", OFFSET(print_textinfo), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, D},
100  {NULL},
101 };
102 
104 {
105  ModPlugContext *modplug = s->priv_data;
106  ModPlug_Unload(modplug->f);
107  av_freep(&modplug->buf);
108  return 0;
109 }
110 
111 #define SET_OPT_IF_REQUESTED(libopt, opt, flag) do { \
112  if (modplug->opt) { \
113  settings.libopt = modplug->opt; \
114  settings.mFlags |= flag; \
115  } \
116 } while (0)
117 
118 #define ADD_META_MULTIPLE_ENTRIES(entry_name, fname) do { \
119  if (n_## entry_name ##s) { \
120  unsigned i, n = 0; \
121  \
122  for (i = 0; i < n_## entry_name ##s; i++) { \
123  char item_name[64] = {0}; \
124  fname(f, i, item_name); \
125  if (!*item_name) \
126  continue; \
127  if (n) \
128  av_dict_set(&s->metadata, #entry_name, "\n", AV_DICT_APPEND); \
129  av_dict_set(&s->metadata, #entry_name, item_name, AV_DICT_APPEND); \
130  n++; \
131  } \
132  \
133  extra = av_asprintf(", %u/%u " #entry_name "%s", \
134  n, n_## entry_name ##s, n > 1 ? "s" : ""); \
135  if (!extra) \
136  return AVERROR(ENOMEM); \
137  av_dict_set(&s->metadata, "extra info", extra, AV_DICT_APPEND); \
138  av_free(extra); \
139  } \
140 } while (0)
141 
143 {
144  ModPlugContext *modplug = s->priv_data;
145  ModPlugFile *f = modplug->f;
146  char *extra;
147  const char *name = ModPlug_GetName(f);
148  const char *msg = ModPlug_GetMessage(f);
149 
150  unsigned n_instruments = ModPlug_NumInstruments(f);
151  unsigned n_samples = ModPlug_NumSamples(f);
152  unsigned n_patterns = ModPlug_NumPatterns(f);
153  unsigned n_channels = ModPlug_NumChannels(f);
154 
155  if (name && *name) av_dict_set(&s->metadata, "name", name, 0);
156  if (msg && *msg) av_dict_set(&s->metadata, "message", msg, 0);
157 
158  extra = av_asprintf("%u pattern%s, %u channel%s",
159  n_patterns, n_patterns > 1 ? "s" : "",
160  n_channels, n_channels > 1 ? "s" : "");
161  if (!extra)
162  return AVERROR(ENOMEM);
163  av_dict_set(&s->metadata, "extra info", extra, AV_DICT_DONT_STRDUP_VAL);
164 
165  ADD_META_MULTIPLE_ENTRIES(instrument, ModPlug_InstrumentName);
166  ADD_META_MULTIPLE_ENTRIES(sample, ModPlug_SampleName);
167 
168  return 0;
169 }
170 
171 #define AUDIO_PKT_SIZE 512
172 
174 {
175  AVStream *st;
176  AVIOContext *pb = s->pb;
177  ModPlug_Settings settings;
178  ModPlugContext *modplug = s->priv_data;
179  int64_t sz = avio_size(pb);
180  int ret;
181 
182  if (sz < 0) {
183  av_log(s, AV_LOG_WARNING, "Could not determine file size\n");
184  sz = modplug->max_size;
185  } else if (modplug->max_size && sz > modplug->max_size) {
186  sz = modplug->max_size;
187  av_log(s, AV_LOG_WARNING, "Max file size reach%s, allocating %"PRIi64"B "
188  "but demuxing is likely to fail due to incomplete buffer\n",
189  sz == FF_MODPLUG_DEF_FILE_SIZE ? " (see -max_size)" : "", sz);
190  }
191 
192  if (modplug->color_eval) {
193  int r = av_expr_parse(&modplug->expr, modplug->color_eval, var_names,
194  NULL, NULL, NULL, NULL, 0, s);
195  if (r < 0)
196  return r;
197  }
198 
199  modplug->buf = av_malloc(modplug->max_size);
200  if (!modplug->buf)
201  return AVERROR(ENOMEM);
202  sz = avio_read(pb, modplug->buf, sz);
203 
204  ModPlug_GetSettings(&settings);
205  settings.mChannels = 2;
206  settings.mBits = 16;
207  settings.mFrequency = 44100;
208  settings.mResamplingMode = MODPLUG_RESAMPLE_FIR; // best quality
209  settings.mLoopCount = 0; // prevents looping forever
210 
211  if (modplug->noise_reduction) settings.mFlags |= MODPLUG_ENABLE_NOISE_REDUCTION;
212  SET_OPT_IF_REQUESTED(mReverbDepth, reverb_depth, MODPLUG_ENABLE_REVERB);
213  SET_OPT_IF_REQUESTED(mReverbDelay, reverb_delay, MODPLUG_ENABLE_REVERB);
214  SET_OPT_IF_REQUESTED(mBassAmount, bass_amount, MODPLUG_ENABLE_MEGABASS);
215  SET_OPT_IF_REQUESTED(mBassRange, bass_range, MODPLUG_ENABLE_MEGABASS);
216  SET_OPT_IF_REQUESTED(mSurroundDepth, surround_depth, MODPLUG_ENABLE_SURROUND);
217  SET_OPT_IF_REQUESTED(mSurroundDelay, surround_delay, MODPLUG_ENABLE_SURROUND);
218 
219  if (modplug->reverb_depth) settings.mReverbDepth = modplug->reverb_depth;
220  if (modplug->reverb_delay) settings.mReverbDelay = modplug->reverb_delay;
221  if (modplug->bass_amount) settings.mBassAmount = modplug->bass_amount;
222  if (modplug->bass_range) settings.mBassRange = modplug->bass_range;
223  if (modplug->surround_depth) settings.mSurroundDepth = modplug->surround_depth;
224  if (modplug->surround_delay) settings.mSurroundDelay = modplug->surround_delay;
225 
226  ModPlug_SetSettings(&settings);
227 
228  modplug->f = ModPlug_Load(modplug->buf, sz);
229  if (!modplug->f) {
230  av_freep(&modplug->buf);
231  return AVERROR_INVALIDDATA;
232  }
233  st = avformat_new_stream(s, NULL);
234  if (!st) {
235  ret = AVERROR(ENOMEM);
236  goto fail;
237  }
238  avpriv_set_pts_info(st, 64, 1, 1000);
239  st->duration = ModPlug_GetLength(modplug->f);
242  st->codecpar->ch_layout.nb_channels = settings.mChannels;
243  st->codecpar->sample_rate = settings.mFrequency;
244 
245  // timebase = 1/1000, 2ch 16bits 44.1kHz-> 2*2*44100
246  modplug->ts_per_packet = 1000*AUDIO_PKT_SIZE / (4*44100.);
247 
248  if (modplug->video_stream) {
250  if (!vst) {
251  ret = AVERROR(ENOMEM);
252  goto fail;
253  }
254  avpriv_set_pts_info(vst, 64, 1, 1000);
255  vst->duration = st->duration;
258  vst->codecpar->width = modplug->w << 3;
259  vst->codecpar->height = modplug->h << 3;
260  modplug->linesize = modplug->w * 3;
261  modplug->fsize = modplug->linesize * modplug->h;
262  }
263 
265  if (ret < 0)
266  goto fail;
267  return 0;
268 fail:
270  return ret;
271 }
272 
273 static void write_text(uint8_t *dst, const char *s, int linesize, int x, int y)
274 {
275  int i;
276  dst += y*linesize + x*3;
277  for (i = 0; s[i]; i++, dst += 3) {
278  dst[0] = 0x0; // count - 1
279  dst[1] = s[i]; // char
280  dst[2] = 0x0f; // background / foreground
281  }
282 }
283 
284 #define PRINT_INFO(line, name, idvalue) do { \
285  snprintf(intbuf, sizeof(intbuf), "%.0f", var_values[idvalue]); \
286  write_text(pkt->data, name ":", modplug->linesize, 0+1, line+1); \
287  write_text(pkt->data, intbuf, modplug->linesize, 10+1, line+1); \
288 } while (0)
289 
291 {
292  ModPlugContext *modplug = s->priv_data;
293  int ret;
294 
295  if (modplug->video_stream) {
296  modplug->video_switch ^= 1; // one video packet for one audio packet
297  if (modplug->video_switch) {
298  double var_values[VAR_VARS_NB];
299 
300  var_values[VAR_W ] = modplug->w;
301  var_values[VAR_H ] = modplug->h;
302  var_values[VAR_TIME ] = modplug->packet_count * modplug->ts_per_packet;
303  var_values[VAR_SPEED ] = ModPlug_GetCurrentSpeed (modplug->f);
304  var_values[VAR_TEMPO ] = ModPlug_GetCurrentTempo (modplug->f);
305  var_values[VAR_ORDER ] = ModPlug_GetCurrentOrder (modplug->f);
306  var_values[VAR_PATTERN] = ModPlug_GetCurrentPattern(modplug->f);
307  var_values[VAR_ROW ] = ModPlug_GetCurrentRow (modplug->f);
308 
309  if ((ret = av_new_packet(pkt, modplug->fsize)) < 0)
310  return ret;
311  pkt->stream_index = 1;
312  memset(pkt->data, 0, modplug->fsize);
313 
314  if (modplug->print_textinfo) {
315  char intbuf[32];
316  PRINT_INFO(0, "speed", VAR_SPEED);
317  PRINT_INFO(1, "tempo", VAR_TEMPO);
318  PRINT_INFO(2, "order", VAR_ORDER);
319  PRINT_INFO(3, "pattern", VAR_PATTERN);
320  PRINT_INFO(4, "row", VAR_ROW);
321  PRINT_INFO(5, "ts", VAR_TIME);
322  }
323 
324  if (modplug->expr) {
325  int x, y;
326  for (y = 0; y < modplug->h; y++) {
327  for (x = 0; x < modplug->w; x++) {
328  double color;
329  var_values[VAR_X] = x;
330  var_values[VAR_Y] = y;
331  color = av_expr_eval(modplug->expr, var_values, NULL);
332  pkt->data[y*modplug->linesize + x*3 + 2] |= av_clip((int)color, 0, 0xf)<<4;
333  }
334  }
335  }
336  pkt->pts = pkt->dts = var_values[VAR_TIME];
338  return 0;
339  }
340  }
341 
342  if ((ret = av_new_packet(pkt, AUDIO_PKT_SIZE)) < 0)
343  return ret;
344 
345  if (modplug->video_stream)
346  pkt->pts = pkt->dts = modplug->packet_count++ * modplug->ts_per_packet;
347 
348  pkt->size = ModPlug_Read(modplug->f, pkt->data, AUDIO_PKT_SIZE);
349  if (pkt->size <= 0) {
350  return pkt->size == 0 ? AVERROR_EOF : AVERROR(EIO);
351  }
352  return 0;
353 }
354 
355 static int modplug_read_seek(AVFormatContext *s, int stream_idx, int64_t ts, int flags)
356 {
357  ModPlugContext *modplug = s->priv_data;
358  ModPlug_Seek(modplug->f, (int)ts);
359  if (modplug->video_stream)
360  modplug->packet_count = ts / modplug->ts_per_packet;
361  return 0;
362 }
363 
364 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";
365 
366 static int modplug_probe(const AVProbeData *p)
367 {
369  if (p->buf_size < 16384)
370  return AVPROBE_SCORE_EXTENSION/2-1;
371  else
373  }
374  return 0;
375 }
376 
377 static const AVClass modplug_class = {
378  .class_name = "ModPlug demuxer",
379  .item_name = av_default_item_name,
380  .option = options,
381  .version = LIBAVUTIL_VERSION_INT,
382 };
383 
385  .p.name = "libmodplug",
386  .p.long_name = NULL_IF_CONFIG_SMALL("ModPlug demuxer"),
387  .p.extensions = modplug_extensions,
388  .p.priv_class = &modplug_class,
389  .priv_data_size = sizeof(ModPlugContext),
395 };
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:328
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
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:98
VAR_ORDER
@ VAR_ORDER
Definition: libmodplug.c:76
r
const char * r
Definition: vf_curves.c:126
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:85
var_name
var_name
Definition: noise.c:46
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
color
Definition: vf_paletteuse.c:511
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
SET_OPT_IF_REQUESTED
#define SET_OPT_IF_REQUESTED(libopt, opt, flag)
Definition: libmodplug.c:111
av_asprintf
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:115
ModPlugContext::surround_depth
int surround_depth
Definition: libmodplug.c:45
w
uint8_t w
Definition: llviddspenc.c:38
AVPacket::data
uint8_t * data
Definition: packet.h:522
AVOption
AVOption.
Definition: opt.h:346
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:313
avio_size
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:322
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:577
VAR_VARS_NB
@ VAR_VARS_NB
Definition: libmodplug.c:77
ModPlugContext::linesize
int linesize
line size in bytes
Definition: libmodplug.c:59
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:290
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:711
modplug_probe
static int modplug_probe(const AVProbeData *p)
Definition: libmodplug.c:366
ModPlugContext::print_textinfo
int print_textinfo
bool flag for printing speed, tempo, order, ...
Definition: libmodplug.c:53
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:853
write_text
static void write_text(uint8_t *dst, const char *s, int linesize, int x, int y)
Definition: libmodplug.c:273
fail
#define fail()
Definition: checkasm.h:179
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:40
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:384
VAR_TEMPO
@ VAR_TEMPO
Definition: libmodplug.c:76
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:802
modplug_read_close
static int modplug_read_close(AVFormatContext *s)
Definition: libmodplug.c:103
VAR_TIME
@ VAR_TIME
Definition: libmodplug.c:75
ModPlugContext::reverb_depth
int reverb_depth
Definition: libmodplug.c:41
D
#define D
Definition: libmodplug.c:84
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:46
pkt
AVPacket * pkt
Definition: movenc.c:59
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:41
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: avpacket.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:55
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:42
av_expr_eval
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition: eval.c:793
AVExpr
Definition: eval.c:159
ModPlugContext::packet_count
int packet_count
total number of audio packets
Definition: libmodplug.c:52
OFFSET
#define OFFSET(x)
Definition: libmodplug.c:83
AVFormatContext
Format I/O context.
Definition: avformat.h:1255
VAR_PATTERN
@ VAR_PATTERN
Definition: libmodplug.c:76
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:766
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:550
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
ModPlugContext::fsize
int fsize
constant frame size
Definition: libmodplug.c:58
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:355
ADD_META_MULTIPLE_ENTRIES
#define ADD_META_MULTIPLE_ENTRIES(entry_name, fname)
Definition: libmodplug.c:118
ModPlugContext::ts_per_packet
double ts_per_packet
used to define the pts/dts using packet_count;
Definition: libmodplug.c:51
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:81
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
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:43
VAR_X
@ VAR_X
Definition: libmodplug.c:73
VAR_ROW
@ VAR_ROW
Definition: libmodplug.c:76
ModPlugContext::buf
uint8_t * buf
input file content
Definition: libmodplug.c:37
ModPlugContext::expr
AVExpr * expr
parsed color eval expression
Definition: libmodplug.c:61
eval.h
f
f
Definition: af_crystalizer.c:121
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
AVPacket::size
int size
Definition: packet.h:523
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:106
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:74
AUDIO_PKT_SIZE
#define AUDIO_PKT_SIZE
Definition: libmodplug.c:171
ModPlugContext::max_size
int max_size
max file size to allocate
Definition: libmodplug.c:48
ModPlugContext::video_stream
int video_stream
1 if the user want a video stream, otherwise 0
Definition: libmodplug.c:54
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:35
var_names
static const char *const var_names[]
Definition: libmodplug.c:64
ModPlugContext::f
ModPlugFile * f
Definition: libmodplug.c:36
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:521
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:528
ModPlugContext::reverb_delay
int reverb_delay
Definition: libmodplug.c:42
VAR_SPEED
@ VAR_SPEED
Definition: libmodplug.c:76
VAR_Y
@ VAR_Y
Definition: libmodplug.c:73
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:515
VAR_H
@ VAR_H
Definition: libmodplug.c:74
AVCodecParameters::height
int height
Definition: codec_par.h:135
xf
#define xf(width, name, var, range_min, range_max, subs,...)
Definition: cbs_av1.c:590
modplug_class
static const AVClass modplug_class
Definition: libmodplug.c:377
demux.h
ModPlugContext::video_switch
int video_switch
1 if current packet is video, otherwise 0
Definition: libmodplug.c:57
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:743
ModPlugContext::h
int h
video stream height in char (one char = 8x8px)
Definition: libmodplug.c:56
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:71
avformat.h
ModPlugContext::bass_range
int bass_range
Definition: libmodplug.c:44
modplug_read_header
static int modplug_read_header(AVFormatContext *s)
Definition: libmodplug.c:173
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:611
AVPacket::stream_index
int stream_index
Definition: packet.h:524
AV_CODEC_ID_XBIN
@ AV_CODEC_ID_XBIN
Definition: codec_id.h:583
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:364
FF_MODPLUG_MAX_FILE_SIZE
#define FF_MODPLUG_MAX_FILE_SIZE
Definition: libmodplug.c:80
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:499
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:60
FFInputFormat
Definition: demux.h:31
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
PRINT_INFO
#define PRINT_INFO(line, name, idvalue)
Definition: libmodplug.c:284
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:2038
avstring.h
ModPlugContext
Definition: libmodplug.c:34
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239
modplug_load_metadata
static int modplug_load_metadata(AVFormatContext *s)
Definition: libmodplug.c:142