static void addToWide(wide *w, long val)
{
    wide tmp;
    tmp.hi = 0;
    tmp.lo = val;

    WideAdd(w, &tmp);
}
Exemple #2
0
static ComponentResult
_flush_ogg(StreamInfoPtr si, DataHandler data_h, wide *offset)
{
    ComponentResult err = noErr;
    int result = 0;
    ogg_page og;
    Boolean have_pages = true;
    wide tmp;

    while (have_pages) {
        result = ogg_stream_pageout(&si->os, &og);

        if (!result) {
            have_pages = false;
            result = ogg_stream_flush(&si->os, &og);
            if (!result)
                break;
        }

        err = DataHWrite64(data_h, (Ptr) og.header, offset, og.header_len,
                         NULL, 0);
        if (!err) {
            tmp.hi = 0;
            tmp.lo = og.header_len;
            WideAdd(offset, &tmp);
            err = DataHWrite64(data_h, (Ptr) og.body, offset, og.body_len,
                             NULL, 0);
            if (!err) {
                tmp.hi = 0;
                tmp.lo = og.body_len;
                WideAdd(offset, &tmp);
            }
        }
    }

    return err;
}