# Writing with OggzHungry callbacks

You can add packets to the Oggz packet queue only when it is "hungry" by providing an OggzHungry callback. More...

You can add packets to the Oggz packet queue only when it is "hungry" by providing an OggzHungry callback.

An OggzHungry callback will:

- Create an ogg_packet structure
- Add it to the packet queue with oggz_write_feed()

Once you have set such a callback with oggz_write_set_hungry_callback(), simply call oggz_write() or oggz_write_output() repeatedly, and Oggz will call your callback to provide packets when it is hungry.

This process is illustrated in the following diagram:

The following example code generates a stream of ten packets, each containing a single byte ('A', 'B', ... , 'J'):