00001 /* 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 1997-2002 Net Integration Technologies, Inc. 00004 * 00005 * A top-level data encoder class. See wvencoder.h. 00006 */ 00007 #include "wvencoder.h" 00008 00009 WvEncoder::WvEncoder() 00010 { 00011 // nothing special 00012 } 00013 00014 00015 WvEncoder::~WvEncoder() 00016 { 00017 // nothing special 00018 } 00019 00020 00021 bool WvEncoder::isok() const 00022 { 00023 // most encoders will always be okay 00024 return true; 00025 } 00026 00027 00028 void WvEncoder::encode(const void *in, size_t insize, bool flush) 00029 { 00030 size_t len = 0; 00031 bool go_once = flush; 00032 00033 // repeat until the entire buffer is used 00034 while (len < insize || go_once) 00035 { 00036 go_once = false; 00037 len += do_encode((const unsigned char *)in, insize, flush); 00038 //fprintf(stderr, "encoder: %u/%u bytes (buffer now has %d bytes)\n", 00039 // len, insize, outbuf.used()); 00040 } 00041 } 00042 00043