FFmpeg  4.4.6
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 
103 {
104  ModPlugContext *modplug = s->priv_data;
105  ModPlug_Unload(modplug->f);
106  av_freep(&modplug->buf);
107  return 0;
108 }
109 
110 #define SET_OPT_IF_REQUESTED(libopt, opt, flag) do { \
111  if (modplug->opt) { \
112  settings.libopt = modplug->opt; \
113  settings.mFlags |= flag; \
114  } \
115 } while (0)
116 
117 #define ADD_META_MULTIPLE_ENTRIES(entry_name, fname) do { \
118  if (n_## entry_name ##s) { \
119  unsigned i, n = 0; \
120  \
121  for (i = 0; i < n_## entry_name ##s; i++) { \
122  char item_name[64] = {0}; \
123  fname(f, i, item_name); \
124  if (!*item_name) \
125  continue; \
126  if (n) \
127  av_dict_set(&s->metadata, #entry_name, "\n", AV_DICT_APPEND); \
128  av_dict_set(&s->metadata, #entry_name, item_name, AV_DICT_APPEND); \
129  n++; \
130  } \
131  \
132  extra = av_asprintf(", %u/%u " #entry_name "%s", \
133  n, n_## entry_name ##s, n > 1 ? "s" : ""); \
134  if (!extra) \
135  return AVERROR(ENOMEM); \
136  av_dict_set(&s->metadata, "extra info", extra, AV_DICT_APPEND); \
137  av_free(extra); \
138  } \
139 } while (0)
140 
142 {
143  ModPlugContext *modplug = s->priv_data;
144  ModPlugFile *f = modplug->f;
145  char *extra;
146  const char *name = ModPlug_GetName(f);
147  const char *msg = ModPlug_GetMessage(f);
148 
149  unsigned n_instruments = ModPlug_NumInstruments(f);
150  unsigned n_samples = ModPlug_NumSamples(f);
151  unsigned n_patterns = ModPlug_NumPatterns(f);
152  unsigned n_channels = ModPlug_NumChannels(f);
153 
154  if (name && *name) av_dict_set(&s->metadata, "name", name, 0);
155  if (msg && *msg) av_dict_set(&s->metadata, "message", msg, 0);
156 
157  extra = av_asprintf("%u pattern%s, %u channel%s",
158  n_patterns, n_patterns > 1 ? "s" : "",
159  n_channels, n_channels > 1 ? "s" : "");
160  if (!extra)
161  return AVERROR(ENOMEM);
162  av_dict_set(&s->metadata, "extra info", extra, AV_DICT_DONT_STRDUP_VAL);
163 
164  ADD_META_MULTIPLE_ENTRIES(instrument, ModPlug_InstrumentName);
165  ADD_META_MULTIPLE_ENTRIES(sample, ModPlug_SampleName);
166 
167  return 0;
168 }
169 
170 #define AUDIO_PKT_SIZE 512
171 
173 {
174  AVStream *st;
175  AVIOContext *pb = s->pb;
176  ModPlug_Settings settings;
177  ModPlugContext *modplug = s->priv_data;
178  int64_t sz = avio_size(pb);
179  int ret;
180 
181  if (sz < 0) {
182  av_log(s, AV_LOG_WARNING, "Could not determine file size\n");
183  sz = modplug->max_size;
184  } else if (modplug->max_size && sz > modplug->max_size) {
185  sz = modplug->max_size;
186  av_log(s, AV_LOG_WARNING, "Max file size reach%s, allocating %"PRIi64"B "
187  "but demuxing is likely to fail due to incomplete buffer\n",
188  sz == FF_MODPLUG_DEF_FILE_SIZE ? " (see -max_size)" : "", sz);
189  }
190 
191  if (modplug->color_eval) {
192  int r = av_expr_parse(&modplug->expr, modplug->color_eval, var_names,
193  NULL, NULL, NULL, NULL, 0, s);
194  if (r < 0)
195  return r;
196  }
197 
198  modplug->buf = av_malloc(modplug->max_size);
199  if (!modplug->buf)
200  return AVERROR(ENOMEM);
201  sz = avio_read(pb, modplug->buf, sz);
202 
203  ModPlug_GetSettings(&settings);
204  settings.mChannels = 2;
205  settings.mBits = 16;
206  settings.mFrequency = 44100;
207  settings.mResamplingMode = MODPLUG_RESAMPLE_FIR; // best quality
208  settings.mLoopCount = 0; // prevents looping forever
209 
210  if (modplug->noise_reduction) settings.mFlags |= MODPLUG_ENABLE_NOISE_REDUCTION;
211  SET_OPT_IF_REQUESTED(mReverbDepth, reverb_depth, MODPLUG_ENABLE_REVERB);
212  SET_OPT_IF_REQUESTED(mReverbDelay, reverb_delay, MODPLUG_ENABLE_REVERB);
213  SET_OPT_IF_REQUESTED(mBassAmount, bass_amount, MODPLUG_ENABLE_MEGABASS);
214  SET_OPT_IF_REQUESTED(mBassRange, bass_range, MODPLUG_ENABLE_MEGABASS);
215  SET_OPT_IF_REQUESTED(mSurroundDepth, surround_depth, MODPLUG_ENABLE_SURROUND);
216  SET_OPT_IF_REQUESTED(mSurroundDelay, surround_delay, MODPLUG_ENABLE_SURROUND);
217 
218  if (modplug->reverb_depth) settings.mReverbDepth = modplug->reverb_depth;
219  if (modplug->reverb_delay) settings.mReverbDelay = modplug->reverb_delay;
220  if (modplug->bass_amount) settings.mBassAmount = modplug->bass_amount;
221  if (modplug->bass_range) settings.mBassRange = modplug->bass_range;
222  if (modplug->surround_depth) settings.mSurroundDepth = modplug->surround_depth;
223  if (modplug->surround_delay) settings.mSurroundDelay = modplug->surround_delay;
224 
225  ModPlug_SetSettings(&settings);
226 
227  modplug->f = ModPlug_Load(modplug->buf, sz);
228  if (!modplug->f) {
229  av_freep(&modplug->buf);
230  return AVERROR_INVALIDDATA;
231  }
232  st = avformat_new_stream(s, NULL);
233  if (!st) {
234  ret = AVERROR(ENOMEM);
235  goto fail;
236  }
237  avpriv_set_pts_info(st, 64, 1, 1000);
238  st->duration = ModPlug_GetLength(modplug->f);
241  st->codecpar->channels = settings.mChannels;
242  st->codecpar->sample_rate = settings.mFrequency;
243 
244  // timebase = 1/1000, 2ch 16bits 44.1kHz-> 2*2*44100
245  modplug->ts_per_packet = 1000*AUDIO_PKT_SIZE / (4*44100.);
246 
247  if (modplug->video_stream) {
249  if (!vst) {
250  ret = AVERROR(ENOMEM);
251  goto fail;
252  }
253  avpriv_set_pts_info(vst, 64, 1, 1000);
254  vst->duration = st->duration;
257  vst->codecpar->width = modplug->w << 3;
258  vst->codecpar->height = modplug->h << 3;
259  modplug->linesize = modplug->w * 3;
260  modplug->fsize = modplug->linesize * modplug->h;
261  }
262 
263  ret = modplug_load_metadata(s);
264  if (ret < 0)
265  goto fail;
266  return 0;
267 fail:
269  return ret;
270 }
271 
272 static void write_text(uint8_t *dst, const char *s, int linesize, int x, int y)
273 {
274  int i;
275  dst += y*linesize + x*3;
276  for (i = 0; s[i]; i++, dst += 3) {
277  dst[0] = 0x0; // count - 1
278  dst[1] = s[i]; // char
279  dst[2] = 0x0f; // background / foreground
280  }
281 }
282 
283 #define PRINT_INFO(line, name, idvalue) do { \
284  snprintf(intbuf, sizeof(intbuf), "%.0f", var_values[idvalue]); \
285  write_text(pkt->data, name ":", modplug->linesize, 0+1, line+1); \
286  write_text(pkt->data, intbuf, modplug->linesize, 10+1, line+1); \
287 } while (0)
288 
290 {
291  ModPlugContext *modplug = s->priv_data;
292  int ret;
293 
294  if (modplug->video_stream) {
295  modplug->video_switch ^= 1; // one video packet for one audio packet
296  if (modplug->video_switch) {
297  double var_values[VAR_VARS_NB];
298 
299  var_values[VAR_W ] = modplug->w;
300  var_values[VAR_H ] = modplug->h;
301  var_values[VAR_TIME ] = modplug->packet_count * modplug->ts_per_packet;
302  var_values[VAR_SPEED ] = ModPlug_GetCurrentSpeed (modplug->f);
303  var_values[VAR_TEMPO ] = ModPlug_GetCurrentTempo (modplug->f);
304  var_values[VAR_ORDER ] = ModPlug_GetCurrentOrder (modplug->f);
305  var_values[VAR_PATTERN] = ModPlug_GetCurrentPattern(modplug->f);
306  var_values[VAR_ROW ] = ModPlug_GetCurrentRow (modplug->f);
307 
308  if ((ret = av_new_packet(pkt, modplug->fsize)) < 0)
309  return ret;
310  pkt->stream_index = 1;
311  memset(pkt->data, 0, modplug->fsize);
312 
313  if (modplug->print_textinfo) {
314  char intbuf[32];
315  PRINT_INFO(0, "speed", VAR_SPEED);
316  PRINT_INFO(1, "tempo", VAR_TEMPO);
317  PRINT_INFO(2, "order", VAR_ORDER);
318  PRINT_INFO(3, "pattern", VAR_PATTERN);
319  PRINT_INFO(4, "row", VAR_ROW);
320  PRINT_INFO(5, "ts", VAR_TIME);
321  }
322 
323  if (modplug->expr) {
324  int x, y;
325  for (y = 0; y < modplug->h; y++) {
326  for (x = 0; x < modplug->w; x++) {
327  double color;
328  var_values[VAR_X] = x;
329  var_values[VAR_Y] = y;
330  color = av_expr_eval(modplug->expr, var_values, NULL);
331  pkt->data[y*modplug->linesize + x*3 + 2] |= av_clip((int)color, 0, 0xf)<<4;
332  }
333  }
334  }
335  pkt->pts = pkt->dts = var_values[VAR_TIME];
337  return 0;
338  }
339  }
340 
341  if ((ret = av_new_packet(pkt, AUDIO_PKT_SIZE)) < 0)
342  return ret;
343 
344  if (modplug->video_stream)
345  pkt->pts = pkt->dts = modplug->packet_count++ * modplug->ts_per_packet;
346 
347  pkt->size = ModPlug_Read(modplug->f, pkt->data, AUDIO_PKT_SIZE);
348  if (pkt->size <= 0) {
349  return pkt->size == 0 ? AVERROR_EOF : AVERROR(EIO);
350  }
351  return 0;
352 }
353 
354 static int modplug_read_seek(AVFormatContext *s, int stream_idx, int64_t ts, int flags)
355 {
356  ModPlugContext *modplug = s->priv_data;
357  ModPlug_Seek(modplug->f, (int)ts);
358  if (modplug->video_stream)
359  modplug->packet_count = ts / modplug->ts_per_packet;
360  return 0;
361 }
362 
363 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";
364 
365 static int modplug_probe(const AVProbeData *p)
366 {
368  if (p->buf_size < 16384)
369  return AVPROBE_SCORE_EXTENSION/2-1;
370  else
372  }
373  return 0;
374 }
375 
376 static const AVClass modplug_class = {
377  .class_name = "ModPlug demuxer",
378  .item_name = av_default_item_name,
379  .option = options,
380  .version = LIBAVUTIL_VERSION_INT,
381 };
382 
384  .name = "libmodplug",
385  .long_name = NULL_IF_CONFIG_SMALL("ModPlug demuxer"),
386  .priv_data_size = sizeof(ModPlugContext),
392  .extensions = modplug_extensions,
393  .priv_class = &modplug_class,
394 };
uint8_t
Main libavformat public API header.
#define AVPROBE_SCORE_EXTENSION
score for file extension
Definition: avformat.h:451
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:342
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:633
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:113
#define flags(name, subs,...)
Definition: cbs_av1.c:572
#define s(width, name)
Definition: cbs_vp9.c:257
#define f(width, name)
Definition: cbs_vp9.c:255
#define fail()
Definition: checkasm.h:133
#define av_clip
Definition: common.h:122
#define NULL
Definition: coverity.c:32
long long int64_t
Definition: coverity.c:34
static AVStream * video_stream
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition: eval.c:766
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:685
simple arithmetic expression evaluator
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:545
#define sample
@ AV_OPT_TYPE_INT
Definition: opt.h:225
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:313
@ AV_CODEC_ID_XBIN
Definition: codec_id.h:558
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:410
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:99
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:4509
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
#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
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
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
#define AVERROR_EOF
End of file.
Definition: error.h:55
#define AVERROR(e)
Definition: error.h:43
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:200
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
int i
Definition: input.c:407
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:4945
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:153
@ VAR_H
Definition: libmodplug.c:73
@ VAR_TIME
Definition: libmodplug.c:74
@ VAR_SPEED
Definition: libmodplug.c:75
@ VAR_TEMPO
Definition: libmodplug.c:75
@ VAR_W
Definition: libmodplug.c:73
@ VAR_VARS_NB
Definition: libmodplug.c:76
@ VAR_PATTERN
Definition: libmodplug.c:75
@ VAR_X
Definition: libmodplug.c:72
@ VAR_ORDER
Definition: libmodplug.c:75
@ VAR_ROW
Definition: libmodplug.c:75
@ VAR_Y
Definition: libmodplug.c:72
static int modplug_read_header(AVFormatContext *s)
Definition: libmodplug.c:172
static const char modplug_extensions[]
Definition: libmodplug.c:363
static int modplug_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: libmodplug.c:289
static const AVOption options[]
Definition: libmodplug.c:84
static int modplug_read_close(AVFormatContext *s)
Definition: libmodplug.c:102
#define AUDIO_PKT_SIZE
Definition: libmodplug.c:170
#define PRINT_INFO(line, name, idvalue)
Definition: libmodplug.c:283
static int modplug_read_seek(AVFormatContext *s, int stream_idx, int64_t ts, int flags)
Definition: libmodplug.c:354
#define SET_OPT_IF_REQUESTED(libopt, opt, flag)
Definition: libmodplug.c:110
static void write_text(uint8_t *dst, const char *s, int linesize, int x, int y)
Definition: libmodplug.c:272
static const AVClass modplug_class
Definition: libmodplug.c:376
#define FF_MODPLUG_MAX_FILE_SIZE
Definition: libmodplug.c:79
static const char *const var_names[]
Definition: libmodplug.c:63
static int modplug_load_metadata(AVFormatContext *s)
Definition: libmodplug.c:141
static int modplug_probe(const AVProbeData *p)
Definition: libmodplug.c:365
#define OFFSET(x)
Definition: libmodplug.c:82
#define ADD_META_MULTIPLE_ENTRIES(entry_name, fname)
Definition: libmodplug.c:117
AVInputFormat ff_libmodplug_demuxer
Definition: libmodplug.c:383
#define FF_MODPLUG_DEF_FILE_SIZE
Definition: libmodplug.c:80
#define D
Definition: libmodplug.c:83
uint8_t w
Definition: llviddspenc.c:39
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
Definition: log.c:92
AVOptions.
const char * name
Definition: qsvenc.c:46
var_name
Definition: setts_bsf.c:50
Describe the class of an AVClass context structure.
Definition: log.h:67
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
int channels
Audio only.
Definition: codec_par.h:166
int width
Video only.
Definition: codec_par.h:126
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:56
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:60
int sample_rate
Audio only.
Definition: codec_par.h:170
Definition: eval.c:157
Format I/O context.
Definition: avformat.h:1232
Bytestream IO Context.
Definition: avio.h:161
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:645
AVOption.
Definition: opt.h:248
This structure stores compressed data.
Definition: packet.h:346
int stream_index
Definition: packet.h:371
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:375
int size
Definition: packet.h:370
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:362
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:368
uint8_t * data
Definition: packet.h:369
This structure contains the data a format has to probe a file.
Definition: avformat.h:441
const char * filename
Definition: avformat.h:442
int buf_size
Size of buf except extra allocated bytes.
Definition: avformat.h:444
Stream structure.
Definition: avformat.h:873
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1038
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:922
int print_textinfo
bool flag for printing speed, tempo, order, ...
Definition: libmodplug.c:52
ModPlugFile * f
Definition: libmodplug.c:35
double ts_per_packet
used to define the pts/dts using packet_count;
Definition: libmodplug.c:50
AVExpr * expr
parsed color eval expression
Definition: libmodplug.c:60
int surround_depth
Definition: libmodplug.c:44
int h
video stream height in char (one char = 8x8px)
Definition: libmodplug.c:55
int linesize
line size in bytes
Definition: libmodplug.c:58
int surround_delay
Definition: libmodplug.c:45
char * color_eval
color eval user input expression
Definition: libmodplug.c:59
int w
video stream width in char (one char = 8x8px)
Definition: libmodplug.c:54
int max_size
max file size to allocate
Definition: libmodplug.c:47
int noise_reduction
Definition: libmodplug.c:39
int fsize
constant frame size
Definition: libmodplug.c:57
int video_switch
1 if current packet is video, otherwise 0
Definition: libmodplug.c:56
int packet_count
total number of audio packets
Definition: libmodplug.c:51
uint8_t * buf
input file content
Definition: libmodplug.c:36
int video_stream
1 if the user want a video stream, otherwise 0
Definition: libmodplug.c:53
#define av_freep(p)
#define av_malloc(s)
#define av_log(a,...)
AVPacket * pkt
Definition: movenc.c:59
const char * r
Definition: vf_curves.c:116