+ if (!buf_size) {
+ AVFrame *frame = data;
+ int i;
+
+ /** Must output remaining samples after stream end. WMAPRO 5.1 created
+ * by XWMA encoder don't though (maybe only 1/2ch streams need it). */
+ s->packet_done = 0;
+ if (s->eof_done)
+ return 0;
+
+ /** clean output buffer and copy last IMDCT samples */
+ for (i = 0; i < s->nb_channels; i++) {
+ memset(frame->extended_data[i], 0,
+ s->samples_per_frame * sizeof(*s->channel[i].out));
+
+ memcpy(frame->extended_data[i], s->channel[i].out,
+ s->samples_per_frame * sizeof(*s->channel[i].out) >> 1);
+ }
+
+ /* TODO: XMA should output 128 samples only (instead of 512) and WMAPRO
+ * maybe 768 (with 2048), XMA needs changes in multi-stream handling though. */
+
+ s->eof_done = 1;
+ s->packet_done = 1;
+ *got_frame_ptr = 1;
+ return 0;
+ }
+ else if (s->packet_done || s->packet_loss) {