Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[camera] EOI patch needed to detect rotation on some cameras. Fixes J…
…B#43247
- Loading branch information
Mohammed Hassan
authored and
Andrew Branson
committed
Oct 8, 2018
1 parent
c04b158
commit 66e0721
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
From e9770976f294a6ae34d8bd961087f65f157e0fbd Mon Sep 17 00:00:00 2001 | ||
From: Mohammed Hassan <mohammed.hassan@jolla.com> | ||
Date: Thu, 5 May 2016 03:39:57 +0300 | ||
Subject: [PATCH] jifmux: cope with missing EOI marker. | ||
|
||
If EOI marker is not within the last 5 bytes of the jpeg stream then we will fail to find it. | ||
Earlier versions of this patch scanned the whole stream, but it's simpler to just assume that | ||
the rest of the data is scan data. | ||
|
||
--- | ||
diff --git a/gst/jpegformat/gstjifmux.c b/gst/jpegformat/gstjifmux.c | ||
index 28638b7..4c66591 100644 | ||
--- a/gst/jpegformat/gstjifmux.c | ||
+++ b/gst/jpegformat/gstjifmux.c | ||
@@ -328,6 +328,7 @@ gst_jif_mux_parse_image (GstJifMux * self, GstBuffer * buf) | ||
|
||
if (marker == SOS) { | ||
gint eoi_pos = -1; | ||
+ gboolean eoi_found = FALSE; | ||
gint i; | ||
|
||
/* search the last 5 bytes for the EOI marker */ | ||
@@ -335,6 +336,7 @@ gst_jif_mux_parse_image (GstJifMux * self, GstBuffer * buf) | ||
for (i = 5; i >= 2; i--) { | ||
if (map.data[map.size - i] == 0xFF && map.data[map.size - i + 1] == EOI) { | ||
eoi_pos = map.size - i; | ||
+ eoi_found = TRUE; | ||
break; | ||
} | ||
} | ||
@@ -350,6 +352,10 @@ gst_jif_mux_parse_image (GstJifMux * self, GstBuffer * buf) | ||
goto error; | ||
|
||
GST_DEBUG_OBJECT (self, "scan data, size = %u", self->priv->scan_size); | ||
+ | ||
+ /* If we cannot find EOI marker, we assume the rest of the data is scan data */ | ||
+ if (!eoi_found) | ||
+ goto done; | ||
} | ||
|
||
if (!gst_byte_reader_peek_uint8 (&reader, &marker)) | ||
-- | ||
2.1.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters