#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "avformat.h"
#include "internal.h"
Go to the source code of this file.
Data Structures | |
struct | sbg_demuxer |
struct | sbg_string |
struct | sbg_fade |
struct | sbg_timestamp |
struct | sbg_script_definition |
struct | sbg_script_synth |
struct | sbg_script_tseq |
struct | sbg_script_event |
struct | sbg_script |
struct | sbg_parser |
struct | ws_interval |
struct | ws_intervals |
Defines | |
#define | SBG_SCALE (1 << 16) |
#define | DAY (24 * 60 * 60) |
#define | DAY_TS ((int64_t)DAY * AV_TIME_BASE) |
#define | FORWARD_ERROR(c) |
#define | ADD_EDATA32(v) do { AV_WL32(edata, (v)); edata += 4; } while(0) |
#define | ADD_EDATA64(v) do { AV_WL64(edata, (v)); edata += 8; } while(0) |
Enumerations | |
enum | sbg_fade_type { SBG_FADE_SILENCE = 0, SBG_FADE_SAME = 1, SBG_FADE_ADAPT = 3 } |
enum | sbg_synth_type { SBG_TYPE_NONE, SBG_TYPE_SINE, SBG_TYPE_NOISE, SBG_TYPE_BELL, SBG_TYPE_MIX, SBG_TYPE_SPIN } |
enum | ws_interval_type { WS_SINE = MKTAG('S','I','N','E'), WS_NOISE = MKTAG('N','O','I','S'), WS_SINE = MKTAG('S','I','N','E'), WS_NOISE = MKTAG('N','O','I','S') } |
Functions | |
static void * | alloc_array_elem (void **array, size_t elsize, int *size, int *max_size) |
static int | str_to_time (const char *str, int64_t *rtime) |
static int | is_space (char c) |
static int | scale_double (void *log, double d, double m, int *r) |
static int | lex_space (struct sbg_parser *p) |
static int | lex_char (struct sbg_parser *p, char c) |
static int | lex_double (struct sbg_parser *p, double *r) |
static int | lex_fixed (struct sbg_parser *p, const char *t, int l) |
static int | lex_line_end (struct sbg_parser *p) |
static int | lex_wsword (struct sbg_parser *p, struct sbg_string *rs) |
static int | lex_name (struct sbg_parser *p, struct sbg_string *rs) |
static int | lex_time (struct sbg_parser *p, int64_t *rt) |
static int | parse_immediate (struct sbg_parser *p) |
static int | parse_preprogrammed (struct sbg_parser *p) |
static int | parse_optarg (struct sbg_parser *p, char o, struct sbg_string *r) |
static int | parse_options (struct sbg_parser *p) |
static int | parse_timestamp (struct sbg_parser *p, struct sbg_timestamp *rts, int64_t *rrel) |
static int | parse_fade (struct sbg_parser *p, struct sbg_fade *fr) |
static int | parse_time_sequence (struct sbg_parser *p, int inblock) |
static int | parse_wave_def (struct sbg_parser *p, int wavenum) |
static int | parse_block_def (struct sbg_parser *p, struct sbg_script_definition *def) |
static int | parse_volume (struct sbg_parser *p, int *vol) |
static int | parse_synth_channel_sine (struct sbg_parser *p, struct sbg_script_synth *synth) |
static int | parse_synth_channel_pink (struct sbg_parser *p, struct sbg_script_synth *synth) |
static int | parse_synth_channel_bell (struct sbg_parser *p, struct sbg_script_synth *synth) |
static int | parse_synth_channel_mix (struct sbg_parser *p, struct sbg_script_synth *synth) |
static int | parse_synth_channel_spin (struct sbg_parser *p, struct sbg_script_synth *synth) |
static int | parse_synth_channel (struct sbg_parser *p) |
static int | parse_synth_def (struct sbg_parser *p, struct sbg_script_definition *def) |
static int | parse_named_def (struct sbg_parser *p) |
static void | free_script (struct sbg_script *s) |
static int | parse_script (void *log, char *script, int script_len, struct sbg_script *rscript) |
static int | read_whole_file (AVIOContext *io, int max_size, char **rbuf) |
static void | expand_timestamps (void *log, struct sbg_script *s) |
static int | expand_tseq (void *log, struct sbg_script *s, int *nb_ev_max, int64_t t0, struct sbg_script_tseq *tseq) |
static int | expand_script (void *log, struct sbg_script *s) |
static int | add_interval (struct ws_intervals *inter, enum ws_interval_type type, uint32_t channels, int ref, int64_t ts1, int32_t f1, int32_t a1, int64_t ts2, int32_t f2, int32_t a2) |
static int | add_bell (struct ws_intervals *inter, struct sbg_script *s, int64_t ts1, int64_t ts2, int32_t f, int32_t a) |
static int | generate_interval (void *log, struct sbg_script *s, struct ws_intervals *inter, int64_t ts1, int64_t ts2, struct sbg_script_synth *s1, struct sbg_script_synth *s2, int transition) |
static int | generate_plateau (void *log, struct sbg_script *s, struct ws_intervals *inter, struct sbg_script_event *ev1) |
static int | generate_transition (void *log, struct sbg_script *s, struct ws_intervals *inter, struct sbg_script_event *ev1, struct sbg_script_event *ev2) |
static int | generate_intervals (void *log, struct sbg_script *s, int sample_rate, struct ws_intervals *inter) |
static int | encode_intervals (struct sbg_script *s, AVCodecContext *avc, struct ws_intervals *inter) |
static av_cold int | sbg_read_probe (AVProbeData *p) |
static av_cold int | sbg_read_header (AVFormatContext *avf) |
static int | sbg_read_packet (AVFormatContext *avf, AVPacket *packet) |
static int | sbg_read_seek2 (AVFormatContext *avf, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) |
static int | sbg_read_seek (AVFormatContext *avf, int stream_index, int64_t ts, int flags) |
Variables | |
static const AVOption | sbg_options [] |
static const AVClass | sbg_demuxer_class |
AVInputFormat | ff_sbg_demuxer |
#define ADD_EDATA32 | ( | v | ) | do { AV_WL32(edata, (v)); edata += 4; } while(0) |
Referenced by encode_intervals().
#define ADD_EDATA64 | ( | v | ) | do { AV_WL64(edata, (v)); edata += 8; } while(0) |
Referenced by encode_intervals().
#define DAY (24 * 60 * 60) |
#define DAY_TS ((int64_t)DAY * AV_TIME_BASE) |
Definition at line 33 of file sbgdec.c.
Referenced by expand_timestamps(), and generate_intervals().
#define FORWARD_ERROR | ( | c | ) |
Value:
do { \ int errcode = c; \ if (errcode <= 0) \ return errcode ? errcode : AVERROR_INVALIDDATA; \ } while(0);
Definition at line 314 of file sbgdec.c.
Referenced by parse_options(), parse_synth_channel_bell(), parse_synth_channel_mix(), parse_synth_channel_pink(), parse_synth_channel_sine(), and parse_synth_channel_spin().
#define SBG_SCALE (1 << 16) |
enum sbg_fade_type |
enum sbg_synth_type |
enum ws_interval_type |
static int add_bell | ( | struct ws_intervals * | inter, | |
struct sbg_script * | s, | |||
int64_t | ts1, | |||
int64_t | ts2, | |||
int32_t | f, | |||
int32_t | a | |||
) | [static] |
static int add_interval | ( | struct ws_intervals * | inter, | |
enum ws_interval_type | type, | |||
uint32_t | channels, | |||
int | ref, | |||
int64_t | ts1, | |||
int32_t | f1, | |||
int32_t | a1, | |||
int64_t | ts2, | |||
int32_t | f2, | |||
int32_t | a2 | |||
) | [static] |
Definition at line 157 of file sbgdec.c.
Referenced by add_interval(), expand_tseq(), parse_named_def(), parse_synth_channel(), and parse_time_sequence().
static int encode_intervals | ( | struct sbg_script * | s, | |
AVCodecContext * | avc, | |||
struct ws_intervals * | inter | |||
) | [static] |
static int expand_script | ( | void * | log, | |
struct sbg_script * | s | |||
) | [static] |
static void expand_timestamps | ( | void * | log, | |
struct sbg_script * | s | |||
) | [static] |
static int expand_tseq | ( | void * | log, | |
struct sbg_script * | s, | |||
int * | nb_ev_max, | |||
int64_t | t0, | |||
struct sbg_script_tseq * | tseq | |||
) | [static] |
static void free_script | ( | struct sbg_script * | s | ) | [static] |
Definition at line 781 of file sbgdec.c.
Referenced by parse_script(), sbg_read_header(), and sbg_read_probe().
static int generate_interval | ( | void * | log, | |
struct sbg_script * | s, | |||
struct ws_intervals * | inter, | |||
int64_t | ts1, | |||
int64_t | ts2, | |||
struct sbg_script_synth * | s1, | |||
struct sbg_script_synth * | s2, | |||
int | transition | |||
) | [static] |
Definition at line 1065 of file sbgdec.c.
Referenced by generate_plateau(), and generate_transition().
static int generate_intervals | ( | void * | log, | |
struct sbg_script * | s, | |||
int | sample_rate, | |||
struct ws_intervals * | inter | |||
) | [static] |
static int generate_plateau | ( | void * | log, | |
struct sbg_script * | s, | |||
struct ws_intervals * | inter, | |||
struct sbg_script_event * | ev1 | |||
) | [static] |
static int generate_transition | ( | void * | log, | |
struct sbg_script * | s, | |||
struct ws_intervals * | inter, | |||
struct sbg_script_event * | ev1, | |||
struct sbg_script_event * | ev2 | |||
) | [static] |
static int is_space | ( | char | c | ) | [inline, static] |
static int lex_char | ( | struct sbg_parser * | p, | |
char | c | |||
) | [static] |
Definition at line 229 of file sbgdec.c.
Referenced by parse_block_def(), parse_fade(), parse_named_def(), parse_options(), parse_synth_channel(), parse_timestamp(), and parse_volume().
static int lex_double | ( | struct sbg_parser * | p, | |
double * | r | |||
) | [static] |
Definition at line 237 of file sbgdec.c.
Referenced by parse_synth_channel_bell(), parse_synth_channel_sine(), parse_synth_channel_spin(), and parse_volume().
static int lex_fixed | ( | struct sbg_parser * | p, | |
const char * | t, | |||
int | l | |||
) | [static] |
Definition at line 253 of file sbgdec.c.
Referenced by parse_synth_channel_bell(), parse_synth_channel_mix(), parse_synth_channel_pink(), parse_synth_channel_spin(), parse_time_sequence(), and parse_timestamp().
static int lex_line_end | ( | struct sbg_parser * | p | ) | [static] |
Definition at line 261 of file sbgdec.c.
Referenced by parse_block_def(), parse_options(), parse_script(), parse_synth_def(), and parse_time_sequence().
static int lex_name | ( | struct sbg_parser * | p, | |
struct sbg_string * | rs | |||
) | [static] |
Definition at line 293 of file sbgdec.c.
Referenced by parse_named_def(), and parse_time_sequence().
static int lex_space | ( | struct sbg_parser * | p | ) | [static] |
Definition at line 220 of file sbgdec.c.
Referenced by lex_line_end(), lex_wsword(), parse_block_def(), parse_named_def(), parse_script(), parse_synth_def(), parse_time_sequence(), and parse_timestamp().
static int lex_time | ( | struct sbg_parser * | p, | |
int64_t * | rt | |||
) | [static] |
static int lex_wsword | ( | struct sbg_parser * | p, | |
struct sbg_string * | rs | |||
) | [static] |
static int parse_block_def | ( | struct sbg_parser * | p, | |
struct sbg_script_definition * | def | |||
) | [static] |
static int parse_fade | ( | struct sbg_parser * | p, | |
struct sbg_fade * | fr | |||
) | [static] |
static int parse_immediate | ( | struct sbg_parser * | p | ) | [static] |
static int parse_named_def | ( | struct sbg_parser * | p | ) | [static] |
static int parse_optarg | ( | struct sbg_parser * | p, | |
char | o, | |||
struct sbg_string * | r | |||
) | [static] |
static int parse_options | ( | struct sbg_parser * | p | ) | [static] |
static int parse_preprogrammed | ( | struct sbg_parser * | p | ) | [static] |
static int parse_script | ( | void * | log, | |
char * | script, | |||
int | script_len, | |||
struct sbg_script * | rscript | |||
) | [static] |
static int parse_synth_channel | ( | struct sbg_parser * | p | ) | [static] |
static int parse_synth_channel_bell | ( | struct sbg_parser * | p, | |
struct sbg_script_synth * | synth | |||
) | [static] |
static int parse_synth_channel_mix | ( | struct sbg_parser * | p, | |
struct sbg_script_synth * | synth | |||
) | [static] |
static int parse_synth_channel_pink | ( | struct sbg_parser * | p, | |
struct sbg_script_synth * | synth | |||
) | [static] |
static int parse_synth_channel_sine | ( | struct sbg_parser * | p, | |
struct sbg_script_synth * | synth | |||
) | [static] |
static int parse_synth_channel_spin | ( | struct sbg_parser * | p, | |
struct sbg_script_synth * | synth | |||
) | [static] |
static int parse_synth_def | ( | struct sbg_parser * | p, | |
struct sbg_script_definition * | def | |||
) | [static] |
static int parse_time_sequence | ( | struct sbg_parser * | p, | |
int | inblock | |||
) | [static] |
static int parse_timestamp | ( | struct sbg_parser * | p, | |
struct sbg_timestamp * | rts, | |||
int64_t * | rrel | |||
) | [static] |
static int parse_volume | ( | struct sbg_parser * | p, | |
int * | vol | |||
) | [static] |
Definition at line 602 of file sbgdec.c.
Referenced by parse_synth_channel_bell(), parse_synth_channel_mix(), parse_synth_channel_pink(), parse_synth_channel_sine(), and parse_synth_channel_spin().
static int parse_wave_def | ( | struct sbg_parser * | p, | |
int | wavenum | |||
) | [static] |
static int read_whole_file | ( | AVIOContext * | io, | |
int | max_size, | |||
char ** | rbuf | |||
) | [static] |
static av_cold int sbg_read_header | ( | AVFormatContext * | avf | ) | [static] |
static int sbg_read_packet | ( | AVFormatContext * | avf, | |
AVPacket * | packet | |||
) | [static] |
static av_cold int sbg_read_probe | ( | AVProbeData * | p | ) | [static] |
static int sbg_read_seek | ( | AVFormatContext * | avf, | |
int | stream_index, | |||
int64_t | ts, | |||
int | flags | |||
) | [static] |
static int sbg_read_seek2 | ( | AVFormatContext * | avf, | |
int | stream_index, | |||
int64_t | min_ts, | |||
int64_t | ts, | |||
int64_t | max_ts, | |||
int | flags | |||
) | [static] |
Definition at line 208 of file sbgdec.c.
Referenced by parse_synth_channel_bell(), parse_synth_channel_sine(), parse_synth_channel_spin(), and parse_volume().
static int str_to_time | ( | const char * | str, | |
int64_t * | rtime | |||
) | [static] |
Initial value:
{ .name = "sbg", .long_name = NULL_IF_CONFIG_SMALL("SBaGen binaural beats script"), .priv_data_size = sizeof(struct sbg_demuxer), .read_probe = sbg_read_probe, .read_header = sbg_read_header, .read_packet = sbg_read_packet, .read_seek = sbg_read_seek, .read_seek2 = sbg_read_seek2, .extensions = "sbg", .priv_class = &sbg_demuxer_class, }
const AVClass sbg_demuxer_class [static] |
Initial value:
{ .class_name = "sbg_demuxer", .item_name = av_default_item_name, .option = sbg_options, .version = LIBAVUTIL_VERSION_INT, }
const AVOption sbg_options[] [static] |
Initial value:
{ { "sample_rate", "", 0x42, AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { "frame_size", "", 0x42, AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { "max_file_size", "", 0x42, AV_OPT_TYPE_INT, { .i64 = 5000000 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }