summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Hintukainen <phintuka@users.sourceforge.net>2012-06-11 12:47:00 +0300
committerPetri Hintukainen <phintuka@users.sourceforge.net>2012-06-11 12:47:00 +0300
commitf381f0e5cfc9389c42cb208f7d562fc1d9dd6f0b (patch)
tree659d137a86182e897b7785b9c0c650fd7a8e3cf9
parent163281d2606a4b7cd46da0c98983217b2f1c8b38 (diff)
downloadxine-lib-f381f0e5cfc9389c42cb208f7d562fc1d9dd6f0b.tar.gz
xine-lib-f381f0e5cfc9389c42cb208f7d562fc1d9dd6f0b.tar.bz2
demux_image: Use BUF_VIDEO_JPEG for JPEG images
-rw-r--r--src/demuxers/demux_image.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/demuxers/demux_image.c b/src/demuxers/demux_image.c
index 71fad1574..ff48940f1 100644
--- a/src/demuxers/demux_image.c
+++ b/src/demuxers/demux_image.c
@@ -66,12 +66,11 @@ static int demux_image_get_status (demux_plugin_t *this_gen) {
return this->status;
}
-static int demux_image_next (demux_plugin_t *this_gen, int preview) {
+static int demux_image_next (demux_plugin_t *this_gen, int preview, int first_fragment) {
demux_image_t *this = (demux_image_t *) this_gen;
buf_element_t *buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
buf->content = buf->mem;
- buf->type = this->buf_type;
buf->size = this->input->read (this->input, (char *)buf->mem, buf->max_size-1);
@@ -80,9 +79,17 @@ static int demux_image_next (demux_plugin_t *this_gen, int preview) {
buf->decoder_flags |= BUF_FLAG_FRAME_END;
this->status = DEMUX_FINISHED;
} else {
+ if (first_fragment &&
+ ( memcmp (buf->content, "\377\330\377", 3) == 0 || /* JPEG */
+ (_X_BE_16(&buf->content[0]) == 0xffd8))) { /* another JPEG */
+ fprintf(stderr, "JPEG\n");
+ this->buf_type = BUF_VIDEO_JPEG;
+ }
+
this->status = DEMUX_OK;
}
+ buf->type = this->buf_type;
if (preview)
buf->decoder_flags = BUF_FLAG_PREVIEW;
@@ -92,7 +99,7 @@ static int demux_image_next (demux_plugin_t *this_gen, int preview) {
}
static int demux_image_send_chunk (demux_plugin_t *this_gen) {
- return demux_image_next(this_gen, 0);
+ return demux_image_next(this_gen, 0, 0);
}
static void demux_image_send_headers (demux_plugin_t *this_gen) {
@@ -105,7 +112,8 @@ static void demux_image_send_headers (demux_plugin_t *this_gen) {
this->input->seek (this->input, 0, SEEK_SET);
/* we can send everything here. this makes image decoder a lot easier */
- while (demux_image_next(this_gen,1) == DEMUX_OK);
+ demux_image_next(this_gen, 1, 1);
+ while (demux_image_next(this_gen, 1, 0) == DEMUX_OK);
this->status = DEMUX_OK;