31 #define SBG_SCALE (1 << 16) 
   32 #define DAY (24 * 60 * 60) 
   33 #define DAY_TS ((int64_t)DAY * AV_TIME_BASE) 
  158                               int *
size, 
int *max_size)
 
  162     if (*size == *max_size) {
 
  163         int m = 
FFMAX(32, 
FFMIN(*max_size, INT_MAX / 2) * 2);
 
  171     ret = (
char *)*array + elsize * *size;
 
  172     memset(ret, 0, elsize);
 
  179     const char *cur = str;
 
  184     if (*cur < '0' || *cur > 
'9')
 
  186     hours = strtol(cur, &end, 10);
 
  187     if (end == cur || *end != 
':' || end[1] < 
'0' || end[1] > 
'9')
 
  190     minutes = strtol(cur, &end, 10);
 
  195         seconds = 
strtod(cur + 1, &end);
 
  199     *rtime = (hours * 3600 + minutes * 60 + seconds) * 
AV_TIME_BASE;
 
  205     return c == 
' '  || c == 
'\t' || c == 
'\r';
 
  211     if (m < INT_MIN || m >= INT_MAX) {
 
  283     if (s == p->
end || *s == 
'\n')
 
  297     while (c < p->
end && ((*
c >= 
'a' && *
c <= 
'z') || (*
c >= 
'A' && *
c <= 
'Z')
 
  298            || (*
c >= 
'0' && *
c <= 
'9') || *
c == 
'_' || *
c == 
'-'))
 
  314 #define FORWARD_ERROR(c) \ 
  318             return errcode ? errcode : AVERROR_INVALIDDATA; \ 
  324              "immediate sequences not yet implemented");
 
  331              "preprogrammed sequences not yet implemented");
 
  339                  "option '%c' requires an argument", o);
 
  356         for (; ostr.
s < ostr.
e; ostr.
s++) {
 
  374                     if (oarg.
e != tptr) {
 
  376                                  "syntax error for option -F");
 
  384                     if (oarg.
e != oarg.
s + r) {
 
  386                                  "syntax error for option -L");
 
  393                     if (oarg.
e != oarg.
s + r) {
 
  395                                  "syntax error for option -T");
 
  404                     memcpy(tptr, oarg.
s, oarg.
e - oarg.
s);
 
  405                     tptr[oarg.
e - oarg.
s] = 0;
 
  412                     if (oarg.
e != tptr) {
 
  414                                  "syntax error for option -q");
 
  419                                  "speed factor other than 1 not supported");
 
  425                     r = strtol(oarg.
s, &tptr, 10);
 
  426                     if (oarg.
e != tptr) {
 
  428                                  "syntax error for option -r");
 
  433                                  "invalid sample rate");
 
  440                              "unknown option: '%c'", *ostr.
s);
 
  461     int64_t abs = 0, rel = 0, dt;
 
  534                  "relative time without previous absolute time");
 
  569              "waveform definitions not yet implemented");
 
  618     double carrierf, beatf;
 
  619     int carrier, beat, vol;
 
  684     double carrierf, beatf;
 
  685     int carrier, beat, vol;
 
  756     char *cursor_save = p->
cursor;
 
  764     if (name.
e - name.
s == 6 && !memcmp(name.
s, 
"wave", 4) &&
 
  765         name.
s[4] >= 
'0' && name.
s[4] <= 
'9' &&
 
  766         name.
s[5] >= 
'0' && name.
s[5] <= 
'9') {
 
  767         int wavenum = (name.
s[4] - 
'0') * 10 + (name.
s[5] - 
'0');
 
  797         .end     = script + script_len,
 
  804             .sample_rate   = 44100,
 
  835         const char *ctx = sp.
cursor;
 
  838         int lctx = ectx - ctx;
 
  839         const char *quote = 
"\"";
 
  840         if (lctx > 0 && ctx[lctx - 1] == 
'\r')
 
  843             ctx = 
"the end of line";
 
  856     int size = 0, bufsize = 0, 
r;
 
  859         if (bufsize - size < 1024) {
 
  860             bufsize = 
FFMIN(
FFMAX(2 * bufsize, 8192), max_size);
 
  861             if (bufsize - size < 2) {
 
  889     int64_t now, cur_ts, 
delta = 0;
 
  891     for (i = 0; i < s->
nb_tseq; i++)
 
  898                    "Start time ignored in a purely relative script.\n");
 
  911                "Scripts with mixed absolute and relative timestamps can give " 
  912                "unexpected results (pause, seeking, time zone change).\n");
 
  915         tm = localtime(&now0);
 
  916         now = tm ? tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec :
 
  919                (
int)(now / 3600), (
int)(now / 60) % 60, (
int)now % 60);
 
  921         for (i = 0; i < s->
nb_tseq; i++) {
 
  933     for (i = 0; i < s->
nb_tseq; i++) {
 
  934         if (s->
tseq[i].
ts.
t + delta < cur_ts)
 
  954     for (i = 0; i < s->
nb_def; i++) {
 
  965     if (def->
type == 
'B') {
 
  986     int i, 
r, nb_events_max = 0;
 
  989     for (i = 0; i < s->
nb_tseq; i++) {
 
 1011         ri = &inter->
inter[ref];
 
 1014             ri->
f1 == ri->
f2 && ri->
f2 == f1 && f1 == f2 &&
 
 1015             ri->
a1 == ri->
a2 && ri->
a2 == a1 && a1 == a2 &&
 
 1033     i->
phi      = ref >= 0 ? ref | 0x80000000 : 0;
 
 1034     return i - inter->
inter;
 
 1054         ts4 = 
FFMIN(ts2, ts1 + cpoints[i][0] * dt);
 
 1056                          ts3, f, a, ts4, f, cpoints[i][1]);
 
 1067                              int64_t 
ts1, int64_t 
ts2,
 
 1074     if (ts2 <= ts1 || (s1->
vol == 0 && s2->
vol == 0))
 
 1080             if (s1->
beat == 0 && s2->
beat == 0) {
 
 1104             if (transition == 2) {
 
 1113                                         "using pink noise instead.\n");
 
 1127                              ts1, 0, s1->
vol - s1->
vol / 4,
 
 1128                              ts2, 0, s2->
vol - s2->
vol / 4);
 
 1138                    "Type %d is not implemented\n", s1->
type);
 
 1180     int64_t tsmid = (ts1 >> 1) + (ts2 >> 1) + (ts1 & ts2 & 1);
 
 1186     for (pass = 0; pass < 2; pass++) {
 
 1194         for (i = 0; i < nb_elements; i++) {
 
 1218                                           ts1, ts2, &s1mod, &s2mod, 3);
 
 1229                                           ts1, tsmid, &s1mod, &smid, 1);
 
 1236                                           tsmid, ts2, &smid, &s2mod, 2);
 
 1272     period = 
FFMAX(period, DAY_TS);
 
 1280                                         : ev2->
ts + (ev1 < ev2 ? 0 : period);
 
 1300         ev1 = i < 0 ? &ev0 : &s->
events[i];
 
 1310         ev1 = i < 0 ? &ev0 : &s->
events[i];
 
 1327     int i, edata_size = 4;
 
 1330     for (i = 0; i < inter->
nb_inter; i++) {
 
 1340 #define ADD_EDATA32(v) do { AV_WL32(edata, (v)); edata += 4; } while(0) 
 1341 #define ADD_EDATA64(v) do { AV_WL64(edata, (v)); edata += 8; } while(0) 
 1343     for (i = 0; i < inter->
nb_inter; i++) {
 
 1362     if (edata != avc->
extradata + edata_size)
 
 1402                "-m is ignored and mix channels will be silent.\n");
 
 1456     packet->
dts = packet->
pts = ts;
 
 1460     return packet->
size;
 
 1464                           int64_t min_ts, int64_t ts, int64_t max_ts, 
int flags)
 
 1466     if (flags || stream_index > 0)
 
 1468     if (stream_index < 0)
 
 1475                          int64_t ts, 
int flags)
 
 1487     { 
"max_file_size", 
"", offsetof(
struct sbg_demuxer, max_file_size),
 
 1509     .extensions     = 
"sbg",