/* Expected format: 16-bit signed PCM */ static void packet_handler(struct ausrc_st *st, GstBuffer *buffer) { int err; if (!st->run) return; /* NOTE: When streaming from files, the buffer will be filled up * pretty quickly.. */ err = aubuf_write(st->aubuf, GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer)); if (err) { DEBUG_WARNING("aubuf_write: %m\n", err); } /* Empty buffer now */ while (st->run) { const struct timespec delay = {0, st->ptime*1000000/2}; play_packet(st); if (aubuf_cur_size(st->aubuf) < st->psize) break; (void)nanosleep(&delay, NULL); } }
/* Expected format: 16-bit signed PCM */ static void packet_handler(struct ausrc_st *st, GstBuffer *buffer) { GstMapInfo info; int err; if (!st->run) return; /* NOTE: When streaming from files, the buffer will be filled up * pretty quickly.. */ if (!gst_buffer_map(buffer, &info, GST_MAP_READ)) { warning("gst: gst_buffer_map failed\n"); return; } err = aubuf_write(st->aubuf, info.data, info.size); if (err) { warning("gst: aubuf_write: %m\n", err); } gst_buffer_unmap(buffer, &info); /* Empty buffer now */ while (st->run) { const struct timespec delay = {0, st->prm.ptime*1000000/2}; play_packet(st); if (aubuf_cur_size(st->aubuf) < st->psize) break; (void)nanosleep(&delay, NULL); } }