FFmpeg
Data Structures | Macros | Functions | Variables
libopenmpt.c File Reference
#include <libopenmpt/libopenmpt.h>
#include <libopenmpt/libopenmpt_stream_callbacks_file.h>
#include <libopenmpt/libopenmpt_version.h>
#include "libavutil/channel_layout.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  OpenMPTContext
 

Macros

#define OPENMPT_API_VERSION_MAKE(major, minor, patch)   (((major)<<24)|((minor)<<16)|((patch)<<0))
 
#define OPENMPT_API_VERSION_AT_LEAST(major, minor, patch)   (OPENMPT_API_VERSION >= OPENMPT_API_VERSION_MAKE((major), (minor), (patch)))
 
#define OFFSET(x)   offsetof(OpenMPTContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 
#define add_meta(s, name, meta)
 
#define AUDIO_PKT_SIZE   2048
 

Functions

static void openmpt_logfunc (const char *message, void *userdata)
 
static int read_header_openmpt (AVFormatContext *s)
 
static int read_packet_openmpt (AVFormatContext *s, AVPacket *pkt)
 
static int read_close_openmpt (AVFormatContext *s)
 
static int read_seek_openmpt (AVFormatContext *s, int stream_idx, int64_t ts, int flags)
 
static int probe_openmpt_extension (const AVProbeData *p)
 
static int read_probe_openmpt (const AVProbeData *p)
 

Variables

static const AVOption options []
 
static const AVClass class_openmpt
 
const FFInputFormat ff_libopenmpt_demuxer
 

Macro Definition Documentation

◆ OPENMPT_API_VERSION_MAKE

#define OPENMPT_API_VERSION_MAKE (   major,
  minor,
  patch 
)    (((major)<<24)|((minor)<<16)|((patch)<<0))

Definition at line 27 of file libopenmpt.c.

◆ OPENMPT_API_VERSION_AT_LEAST

#define OPENMPT_API_VERSION_AT_LEAST (   major,
  minor,
  patch 
)    (OPENMPT_API_VERSION >= OPENMPT_API_VERSION_MAKE((major), (minor), (patch)))

Definition at line 30 of file libopenmpt.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(OpenMPTContext, x)

Definition at line 51 of file libopenmpt.c.

◆ A

#define A   AV_OPT_FLAG_AUDIO_PARAM

Definition at line 52 of file libopenmpt.c.

◆ D

Definition at line 53 of file libopenmpt.c.

◆ add_meta

#define add_meta (   s,
  name,
  meta 
)
Value:
do { \
const char *value = meta; \
if (value && value[0]) \
av_dict_set(&s->metadata, name, value, 0); \
openmpt_free_string(value); \
} while(0)

Definition at line 72 of file libopenmpt.c.

◆ AUDIO_PKT_SIZE

#define AUDIO_PKT_SIZE   2048

Definition at line 163 of file libopenmpt.c.

Function Documentation

◆ openmpt_logfunc()

static void openmpt_logfunc ( const char *  message,
void *  userdata 
)
static

Definition at line 63 of file libopenmpt.c.

Referenced by read_header_openmpt(), and read_probe_openmpt().

◆ read_header_openmpt()

static int read_header_openmpt ( AVFormatContext s)
static

Definition at line 80 of file libopenmpt.c.

◆ read_packet_openmpt()

static int read_packet_openmpt ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 165 of file libopenmpt.c.

◆ read_close_openmpt()

static int read_close_openmpt ( AVFormatContext s)
static

Definition at line 202 of file libopenmpt.c.

◆ read_seek_openmpt()

static int read_seek_openmpt ( AVFormatContext s,
int  stream_idx,
int64_t  ts,
int  flags 
)
static

Definition at line 212 of file libopenmpt.c.

◆ probe_openmpt_extension()

static int probe_openmpt_extension ( const AVProbeData p)
static

Definition at line 219 of file libopenmpt.c.

Referenced by read_probe_openmpt().

◆ read_probe_openmpt()

static int read_probe_openmpt ( const AVProbeData p)
static

Definition at line 233 of file libopenmpt.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "sample_rate", "set sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, { .i64 = 48000 }, 1000, INT_MAX, A | D },
{ "layout", "set channel layout", OFFSET(ch_layout), AV_OPT_TYPE_CHLAYOUT, { .str = "stereo" }, 0, 0, A | D },
{ "subsong", "set subsong", OFFSET(subsong), AV_OPT_TYPE_INT, { .i64 = -2 }, -2, INT_MAX, A | D, .unit = "subsong"},
{ "all", "all", 0, AV_OPT_TYPE_CONST, { .i64 = -1}, 0, 0, A | D, .unit = "subsong" },
{ "auto", "auto", 0, AV_OPT_TYPE_CONST, { .i64 = -2}, 0, 0, A | D, .unit = "subsong" },
{ NULL }
}

Definition at line 54 of file libopenmpt.c.

◆ class_openmpt

const AVClass class_openmpt
static
Initial value:
= {
.class_name = "libopenmpt",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 275 of file libopenmpt.c.

◆ ff_libopenmpt_demuxer

const FFInputFormat ff_libopenmpt_demuxer
Initial value:
= {
.p.name = "libopenmpt",
.p.long_name = NULL_IF_CONFIG_SMALL("Tracker formats (libopenmpt)"),
.p.priv_class = &class_openmpt,
.p.extensions = "669,amf,ams,dbm,digi,dmf,dsm,far,gdm,ice,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,st26,stk,stm,ult,umx,wow,xm,xpk",
.priv_data_size = sizeof(OpenMPTContext),
.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
}

Definition at line 282 of file libopenmpt.c.

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
read_probe_openmpt
static int read_probe_openmpt(const AVProbeData *p)
Definition: libopenmpt.c:233
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:151
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
read_packet_openmpt
static int read_packet_openmpt(AVFormatContext *s, AVPacket *pkt)
Definition: libopenmpt.c:165
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
OFFSET
#define OFFSET(x)
Definition: libopenmpt.c:51
FF_INFMT_FLAG_INIT_CLEANUP
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition: demux.h:35
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:540
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
read_header_openmpt
static int read_header_openmpt(AVFormatContext *s)
Definition: libopenmpt.c:80
AV_OPT_TYPE_CHLAYOUT
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
Definition: opt.h:331
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
read_close_openmpt
static int read_close_openmpt(AVFormatContext *s)
Definition: libopenmpt.c:202
D
#define D
Definition: libopenmpt.c:53
value
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 value
Definition: writing_filters.txt:86
OpenMPTContext
Definition: libopenmpt.c:40
class_openmpt
static const AVClass class_openmpt
Definition: libopenmpt.c:275
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
A
#define A
Definition: libopenmpt.c:52
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
read_seek_openmpt
static int read_seek_openmpt(AVFormatContext *s, int stream_idx, int64_t ts, int flags)
Definition: libopenmpt.c:212
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
options
static const AVOption options[]
Definition: libopenmpt.c:54