Skip to content

Commit

Permalink
[camera] EOI patch needed to detect rotation on some cameras. Fixes J…
Browse files Browse the repository at this point in the history
…B#43247
  • Loading branch information
Mohammed Hassan authored and Andrew Branson committed Oct 8, 2018
1 parent c04b158 commit 66e0721
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions rpm/0006-jifmux-cope-with-missing-EOI-marker.patch
@@ -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

1 change: 1 addition & 0 deletions rpm/gst-plugins-bad.spec
Expand Up @@ -14,6 +14,7 @@ Patch2: 0002-Keep-video-branch-in-NULL-state.patch
Patch3: 0003-photography-add-missing-vmethods.patch
Patch4: 0004-camerabin-install-GST_PHOTOGRAPHY_PROP_EXPOSURE_MODE.patch
Patch5: 0005-Downgrade-mpeg4videoparse-to-prevent-it-from-being-p.patch
Patch6: 0006-jifmux-cope-with-missing-EOI-marker.patch

%define sonamever %(echo %{version} | cut -d '+' -f 1)

Expand Down

0 comments on commit 66e0721

Please sign in to comment.