1326 }
1327
1328 iterate_adapter:
1329 GST_LOG_OBJECT (aiff,
1330 "offset: %" G_GINT64_FORMAT " , end: %" G_GINT64_FORMAT " , dataleft: %"
1331 G_GINT64_FORMAT, aiff->offset, aiff->end_offset, aiff->dataleft);
1332
1333 /* Get the next n bytes and output them */
1334 if (aiff->dataleft == 0 || aiff->dataleft < aiff->bytes_per_sample)
1335 goto found_eos;
1336
1337 /* scale the amount of data by the segment rate so we get equal
1338 * amounts of data regardless of the playback rate */
1339 desired =
1340 MIN (gst_guint64_to_gdouble (aiff->dataleft),
1341 aiff->max_buf_size * ABS (aiff->segment.rate));
1342
1343 if (desired >= aiff->bytes_per_sample)
1344 desired -= (desired % aiff->bytes_per_sample);
1345
1346 GST_LOG_OBJECT (aiff, "Fetching %" G_GINT64_FORMAT " bytes of data "
1347 "from the sinkpad", desired);
1348
1349 if (aiff->streaming) {
1350 guint avail = gst_adapter_available (aiff->adapter);
1351
1352 if (avail < desired) {
1353 GST_LOG_OBJECT (aiff, "Got only %d bytes of data from the sinkpad",
1354 avail);
1355 return GST_FLOW_OK;
1356 }
1357
1358 buf = gst_adapter_take_buffer (aiff->adapter, desired);
1359 } else {
1360 if ((res = gst_pad_pull_range (aiff->sinkpad, aiff->offset,
1361 desired, &buf)) != GST_FLOW_OK)
1362 goto pull_error;
1363 }
1364
1365 /* If we have a pending close/start segment, send it now. */
|
1326 }
1327
1328 iterate_adapter:
1329 GST_LOG_OBJECT (aiff,
1330 "offset: %" G_GINT64_FORMAT " , end: %" G_GINT64_FORMAT " , dataleft: %"
1331 G_GINT64_FORMAT, aiff->offset, aiff->end_offset, aiff->dataleft);
1332
1333 /* Get the next n bytes and output them */
1334 if (aiff->dataleft == 0 || aiff->dataleft < aiff->bytes_per_sample)
1335 goto found_eos;
1336
1337 /* scale the amount of data by the segment rate so we get equal
1338 * amounts of data regardless of the playback rate */
1339 desired =
1340 MIN (gst_guint64_to_gdouble (aiff->dataleft),
1341 aiff->max_buf_size * ABS (aiff->segment.rate));
1342
1343 if (desired >= aiff->bytes_per_sample)
1344 desired -= (desired % aiff->bytes_per_sample);
1345
1346 #ifdef GSTREAMER_LITE
1347 if (desired == 0) {
1348 GST_ELEMENT_ERROR (aiff, STREAM, DEMUX, (NULL),
1349 ("Invalid stream"));
1350 return GST_FLOW_ERROR;
1351 }
1352 #endif // GSTREAMER_LITE
1353
1354 GST_LOG_OBJECT (aiff, "Fetching %" G_GINT64_FORMAT " bytes of data "
1355 "from the sinkpad", desired);
1356
1357 if (aiff->streaming) {
1358 guint avail = gst_adapter_available (aiff->adapter);
1359
1360 if (avail < desired) {
1361 GST_LOG_OBJECT (aiff, "Got only %d bytes of data from the sinkpad",
1362 avail);
1363 return GST_FLOW_OK;
1364 }
1365
1366 buf = gst_adapter_take_buffer (aiff->adapter, desired);
1367 } else {
1368 if ((res = gst_pad_pull_range (aiff->sinkpad, aiff->offset,
1369 desired, &buf)) != GST_FLOW_OK)
1370 goto pull_error;
1371 }
1372
1373 /* If we have a pending close/start segment, send it now. */
|