Merge branch 'master' into 0.11

This commit is contained in:
Wim Taymans 2010-12-07 11:47:41 +01:00
commit 7aff7d5f78
2 changed files with 28 additions and 10 deletions

View file

@ -368,8 +368,11 @@ gst_jpeg_dec_ensure_header (GstJpegDec * dec)
return FALSE;
}
if (offset > 0) {
GST_LOG_OBJECT (dec, "Skipping %u bytes.", offset);
gst_adapter_flush (dec->adapter, offset);
}
GST_DEBUG_OBJECT (dec, "Found JPEG header");
gst_adapter_flush (dec->adapter, offset);
return TRUE;
}
@ -382,9 +385,10 @@ gst_jpeg_dec_parse_tag_has_entropy_segment (guint8 tag)
return FALSE;
}
/* returns image length in bytes if parsed
* successfully, otherwise 0 */
static guint
/* returns image length in bytes if parsed successfully,
* otherwise 0 if more data needed,
* if < 0 the absolute value needs to be flushed */
static gint
gst_jpeg_dec_parse_image_data (GstJpegDec * dec)
{
guint size;
@ -445,8 +449,15 @@ gst_jpeg_dec_parse_image_data (GstJpegDec * dec)
dec->parse_resync = FALSE;
dec->parse_offset = 0;
return (offset + 4);
} else if (value == 0xd8) {
/* Skip this frame if we found another SOI marker */
GST_DEBUG ("0x%08x: SOI marker before EOI, skipping", offset + 2);
dec->parse_resync = FALSE;
dec->parse_offset = 0;
return -(offset + 2);
}
if (value >= 0xd0 && value <= 0xd7)
frame_len = 0;
else {
@ -498,6 +509,7 @@ gst_jpeg_dec_parse_image_data (GstJpegDec * dec)
if (noffset < 0) {
/* ignore and continue resyncing until we hit the end
* of our data or find a sync point that looks okay */
offset++;
continue;
}
GST_DEBUG ("found sync at 0x%x", offset + 2);
@ -1148,7 +1160,8 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf)
#endif
guchar *outdata;
guchar *base[3], *last[3];
guint img_len, outsize;
gint img_len;
guint outsize;
gint width, height;
gint r_h, r_v;
guint code, hdr_ok;
@ -1186,6 +1199,7 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf)
goto need_more_data;
}
again:
if (!gst_jpeg_dec_ensure_header (dec))
goto need_more_data;
@ -1200,8 +1214,12 @@ gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buf)
* is not aligned to buffer boundaries */
img_len = gst_jpeg_dec_parse_image_data (dec);
if (img_len == 0)
if (img_len == 0) {
goto need_more_data;
} else if (img_len < 0) {
gst_adapter_flush (dec->adapter, -img_len);
goto again;
}
}
dec->rem_img_len = img_len;

View file

@ -1986,11 +1986,11 @@ qtdemux_parse_trun (GstQTDemux * qtdemux, GstByteReader * trun,
gint64 * base_offset)
{
guint64 timestamp;
gint32 data_offset;
gint32 data_offset = 0;
guint32 flags, first_flags = 0, samples_count;
gint i;
guint8 *data;
guint entry_size, dur_offset, size_offset, flags_offset, ct_offset;
guint entry_size, dur_offset, size_offset, flags_offset = 0, ct_offset = 0;
QtDemuxSample *sample;
gboolean ismv = FALSE;
@ -2078,7 +2078,7 @@ qtdemux_parse_trun (GstQTDemux * qtdemux, GstByteReader * trun,
QTDEMUX_MAX_SAMPLE_INDEX_SIZE / sizeof (QtDemuxSample))
goto index_too_big;
GST_DEBUG_OBJECT (qtdemux, "allocating n_samples %u (%u MB)",
GST_DEBUG_OBJECT (qtdemux, "allocating n_samples %u (%lu MB)",
stream->n_samples, (stream->n_samples * sizeof (QtDemuxSample)) >> 20);
/* create a new array of samples if it's the first sample parsed */
@ -4970,7 +4970,7 @@ qtdemux_find_atom (GstQTDemux * qtdemux, guint64 * offset,
} else {
GST_LOG_OBJECT (qtdemux,
"skipping atom '%" GST_FOURCC_FORMAT "' at %" G_GUINT64_FORMAT,
GST_FOURCC_ARGS (fourcc), offset);
GST_FOURCC_ARGS (fourcc), *offset);
*offset += *length;
}
}