gint outframe_pitches[3];
gboolean PAL;
gint height;
+ guint32 length, got_bytes;
dvdec = GST_DVDEC (element);
/* first read enough bytes to parse the header */
- inframe = gst_bytestream_peek_bytes (dvdec->bs, header_size);
- if (!inframe) {
+ got_bytes = gst_bytestream_peek_bytes (dvdec->bs, &inframe, header_size);
+ if (got_bytes < header_size) {
gst_dvdec_handle_event (dvdec);
return;
}
PAL = dv_system_50_fields (dvdec->decoder);
height = (PAL ? PAL_HEIGHT : NTSC_HEIGHT);
+ length = (PAL ? PAL_BUFFER : NTSC_BUFFER);
/* then read the read data */
- buf = gst_bytestream_read (dvdec->bs, (PAL ? PAL_BUFFER : NTSC_BUFFER));
- if (!buf) {
+ got_bytes = gst_bytestream_read (dvdec->bs, &buf, length);
+ if (got_bytes < length) {
gst_dvdec_handle_event (dvdec);
return;
}
gst_avi_demux_avih (GstAviDemux *avi_demux)
{
gst_riff_avih *avih;
+ guint32 got_bytes;
GstByteStream *bs = avi_demux->bs;
- avih = (gst_riff_avih *) gst_bytestream_peek_bytes (bs, sizeof (gst_riff_avih));
- if (avih) {
+ got_bytes = gst_bytestream_peek_bytes (bs, (guint8**)&avih, sizeof (gst_riff_avih));
+ if (got_bytes == sizeof (gst_riff_avih)) {
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: avih tag found");
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: us_frame %d", GUINT32_FROM_LE (avih->us_frame));
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: max_bps %d", GUINT32_FROM_LE (avih->max_bps));
{
gst_riff_strh *strh;
GstByteStream *bs = avi_demux->bs;
+ guint32 got_bytes;
- strh = (gst_riff_strh *) gst_bytestream_peek_bytes (bs, sizeof (gst_riff_strh));
- if (strh) {
+ got_bytes = gst_bytestream_peek_bytes (bs, (guint8**)&strh, sizeof (gst_riff_strh));
+ if (got_bytes == sizeof (gst_riff_strh)) {
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: strh tag found");
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: type 0x%08x (%s)",
GUINT32_FROM_LE (strh->type), gst_riff_id_to_fourcc (strh->type));
GstPad *srcpad;
GstByteStream *bs = avi_demux->bs;
GstCaps *newcaps = NULL, *capslist = NULL;
+ guint32 got_bytes;
- strf = (gst_riff_strf_vids *) gst_bytestream_peek_bytes (bs, sizeof (gst_riff_strf_vids));
+ got_bytes = gst_bytestream_peek_bytes (bs, (guint8**)&strf, sizeof (gst_riff_strf_vids));
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: strf tag found in context vids");
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: size %d", GUINT32_FROM_LE (strf->size));
GstPad *srcpad;
GstByteStream *bs = avi_demux->bs;
GstCaps *newcaps = NULL, *capslist = NULL;
+ guint32 got_bytes;
- strf = (gst_riff_strf_auds *) gst_bytestream_peek_bytes (bs, sizeof (gst_riff_strf_auds));
+ got_bytes = gst_bytestream_peek_bytes (bs, (guint8**)&strf, sizeof (gst_riff_strf_auds));
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: strf tag found in context auds");
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: format %d", GUINT16_FROM_LE (strf->format));
GstPad *srcpad;
GstByteStream *bs = avi_demux->bs;
GstCaps *newcaps = NULL, *capslist = NULL;
+ guint32 got_bytes;
- strf = (gst_riff_strf_iavs *) gst_bytestream_peek_bytes (bs, sizeof (gst_riff_strf_iavs));
+ got_bytes = gst_bytestream_peek_bytes (bs, (guint8**)&strf, sizeof (gst_riff_strf_iavs));
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: strf tag found in context iavs");
GST_INFO (GST_CAT_PLUGIN_INFO, "gst_avi_demux: DVAAuxSrc %08x", GUINT32_FROM_LE (strf->DVAAuxSrc));
{
GstBuffer *buf;
gulong index_size;
+ guint32 got_bytes;
if (!gst_bytestream_seek (avi_demux->bs, GST_SEEK_BYTEOFFSET_SET, filepos + offset)) {
GST_INFO (GST_CAT_PLUGIN_INFO, "avidemux: could not seek to index");
return;
}
- buf = gst_bytestream_read (avi_demux->bs, 8);
- while (!buf) {
+ got_bytes = gst_bytestream_read (avi_demux->bs, &buf, 8);
+ while (got_bytes < 8) {
guint32 remaining;
GstEvent *event;
gst_bytestream_get_status (avi_demux->bs, &remaining, &event);
- buf = gst_bytestream_read (avi_demux->bs, 8);
+ got_bytes = gst_bytestream_read (avi_demux->bs, &buf, 8);
}
if (GST_BUFFER_OFFSET (buf) != filepos + offset || GST_BUFFER_SIZE (buf) != 8) {
index_size = GUINT32_FROM_LE(*(guint32 *)(GST_BUFFER_DATA (buf) + 4));
gst_buffer_unref (buf);
- buf = gst_bytestream_read (avi_demux->bs, index_size);
+ got_bytes = gst_bytestream_read (avi_demux->bs, &buf, index_size);
avi_demux->index_size = index_size/sizeof(gst_riff_index_entry);
{
gst_riff_chunk *chunk;
GstByteStream *bs = avi_demux->bs;
+ guint32 got_bytes;
do {
- chunk = (gst_riff_chunk *) gst_bytestream_peek_bytes (bs, sizeof (gst_riff_chunk));
- if (chunk) {
+ got_bytes = gst_bytestream_peek_bytes (bs, (guint8**)&chunk, sizeof (gst_riff_chunk));
+ if (got_bytes == sizeof (gst_riff_chunk)) {
*id = GUINT32_FROM_LE (chunk->id);
*size = GUINT32_FROM_LE (chunk->size);
guint32 datashowed;
guint32 subchunksize = 0; /* size of a read subchunk */
gchar *formtype;
+ guint32 got_bytes;
- formtype = gst_bytestream_peek_bytes (bs, sizeof (guint32));
- if (!formtype)
+ got_bytes = gst_bytestream_peek_bytes (bs, (guint8**)&formtype, sizeof (guint32));
+ if (got_bytes < sizeof(guint32))
return FALSE;
switch (GUINT32_FROM_LE (*((guint32*)formtype))) {
if (GST_PAD_IS_CONNECTED (avi_demux->video_pad[0])) {
GstBuffer *buf;
+ guint32 got_bytes;
if (*chunksize) {
- buf = gst_bytestream_peek (bs, *chunksize);
+ got_bytes = gst_bytestream_peek (bs, &buf, *chunksize);
GST_BUFFER_TIMESTAMP (buf) = avi_demux->next_time;
if (GST_PAD_IS_CONNECTED (avi_demux->audio_pad[0])) {
GstBuffer *buf;
+ guint32 got_bytes;
if (*chunksize) {
- buf = gst_bytestream_peek (bs, *chunksize);
+ got_bytes = gst_bytestream_peek (bs, &buf, *chunksize);
GST_BUFFER_TIMESTAMP (buf) = -1LL;