From 35d239b76ad199719834852c9a5751f3c031d7b6 Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 13:36:27 +0200 Subject: [PATCH 01/17] Update TJpg_Decoder.h new option to stream images without an array; only working with esp32 until now --- src/TJpg_Decoder.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/TJpg_Decoder.h b/src/TJpg_Decoder.h index f72cf35..359f064 100644 --- a/src/TJpg_Decoder.h +++ b/src/TJpg_Decoder.h @@ -17,7 +17,12 @@ Latest version here: #include "Arduino.h" #include "tjpgd.h" - #if defined (ESP8266) || defined (ESP32) + #if defined (ESP8266) || defined (ESP32) + #if defined (TJPGD_LOAD_HTTP_LIBRARY) + #include + #include + #endif + #include #include #include @@ -56,6 +61,10 @@ class TJpg_Decoder { #ifdef TJPGD_LOAD_FFS fs::File jpgFile; #endif + +#if defined (TJPGD_LOAD_HTTP_LIBRARY) + HTTPClient* jpg_http = NULL; +#endif public: @@ -76,6 +85,11 @@ class TJpg_Decoder { JRESULT getJpgSize(uint16_t *w, uint16_t *h, const char *pFilename); JRESULT getJpgSize(uint16_t *w, uint16_t *h, const String& pFilename); #endif + +#if defined (TJPGD_LOAD_HTTP_LIBRARY) + JRESULT drawJpgFromHttp(int32_t x, int32_t y, char* http_stream); + JRESULT getJpgSize(uint16_t *w, uint16_t *h, char* http_stream); +#endif #if defined (TJPGD_LOAD_SD_LIBRARY) JRESULT drawSdJpg (int32_t x, int32_t y, const char *pFilename); From 37bc8b15896120218f719e1518d975b58008c976 Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 13:40:32 +0200 Subject: [PATCH 02/17] Update TJpg_Decoder.h --- src/TJpg_Decoder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TJpg_Decoder.h b/src/TJpg_Decoder.h index 359f064..4858652 100644 --- a/src/TJpg_Decoder.h +++ b/src/TJpg_Decoder.h @@ -87,8 +87,8 @@ class TJpg_Decoder { #endif #if defined (TJPGD_LOAD_HTTP_LIBRARY) - JRESULT drawJpgFromHttp(int32_t x, int32_t y, char* http_stream); - JRESULT getJpgSize(uint16_t *w, uint16_t *h, char* http_stream); + JRESULT drawJpgFromStream(int32_t x, int32_t y, char* url) ; + JRESULT getJpgSizeFromStream(uint16_t *w, uint16_t *h, char* url); #endif #if defined (TJPGD_LOAD_SD_LIBRARY) From 3a510b24c0e172b972898ad04ead41e32e4540cb Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 13:57:02 +0200 Subject: [PATCH 03/17] Update TJpg_Decoder.h --- src/TJpg_Decoder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TJpg_Decoder.h b/src/TJpg_Decoder.h index 4858652..0a7ffe9 100644 --- a/src/TJpg_Decoder.h +++ b/src/TJpg_Decoder.h @@ -88,7 +88,7 @@ class TJpg_Decoder { #if defined (TJPGD_LOAD_HTTP_LIBRARY) JRESULT drawJpgFromStream(int32_t x, int32_t y, char* url) ; - JRESULT getJpgSizeFromStream(uint16_t *w, uint16_t *h, char* url); + JRESULT getJpgSizeFromStream(char* url); #endif #if defined (TJPGD_LOAD_SD_LIBRARY) From 3c590ae50f30f52d86577abdb20e5a90fbe08664 Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 13:57:09 +0200 Subject: [PATCH 04/17] Update TJpg_Decoder.cpp --- src/TJpg_Decoder.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/src/TJpg_Decoder.cpp b/src/TJpg_Decoder.cpp index 1c6269a..5f038de 100644 --- a/src/TJpg_Decoder.cpp +++ b/src/TJpg_Decoder.cpp @@ -129,6 +129,29 @@ unsigned int TJpg_Decoder::jd_input(JDEC* jdec, uint8_t* buf, unsigned int len) } } #endif + +#ifdef TJPGD_LOAD_HTTP_LIBRARY + else if (thisPtr->jpg_source == TJPG_STREAM_FILE) + { + if (thisPtr->array_index + len > thisPtr->array_size) + { + len = thisPtr->array_size - thisPtr->array_index; + } + + if(thisPtr->jpg_http->connected()) + { + uint8_t _buff[len]; + WiFiClient* const stream = thisPtr->jpg_http->getStreamPtr(); + if (stream->available()) stream->readBytes(_buff, len); + yield(); + if (buf) + { + memcpy_P(buf,_buff,len); + } + thisPtr->array_index = thisPtr->array_index + len; + } + } +#endif return len; } @@ -156,6 +179,85 @@ int TJpg_Decoder::jd_output(JDEC* jdec, void* bitmap, JRECT* jrect) } +#if defined (TJPGD_LOAD_HTTP_LIBRARY) + +/*************************************************************************************** +** Function name: drawJpg +** Description: Draw a named jpg file at x,y (name in char array) +***************************************************************************************/ + +JRESULT TJpg_Decoder::drawJpgFromStream(int32_t x, int32_t y, char* _url) { + JDEC jdec; + JRESULT jresult = JDR_OK; + + jpg_source = TJPG_STREAM_FILE; + + jpeg_x = x; + jpeg_y = y; + array_size = 0; + array_index = 0; + + jdec.swap = _swap; + jpg_http = new HTTPClient; + jpg_http->begin(_url); + long httpCode = jpg_http->GET(); + if (httpCode == HTTP_CODE_OK) + { + array_size = jpg_http->getSize(); + Serial.println(array_size); + array_index = 0; + } + + // Analyse input data + jresult = jd_prepare(&jdec, jd_input, workspace, TJPGD_WORKSPACE_SIZE, 0); + + // Extract image and render + if (jresult == JDR_OK)jresult = jd_decomp(&jdec, jd_output, jpgScale); + + if(jpg_http->connected()) + { + WiFiClient* const stream = jpg_http->getStreamPtr(); + stream->stop(); + stream->flush(); + } + jpg_http->end(); + delete jpg_http; + jpg_http = NULL; + + return jresult; +} + +/*************************************************************************************** +** Function name: getJpgSize +** Description: Get width and height of a jpg file (name in char array) +***************************************************************************************/ +// Generic file call for SD or SPIFFS, uses leading / to distinguish SPIFFS files +uint32_t TJpg_Decoder::getJpgSizeFromStream(char *_url){ + + if(!jpg_http->connected()){ + jpg_http = new HTTPClient; + jpg_http->begin(_url); + long httpCode = jpg_http->GET(); + if (httpCode == HTTP_CODE_OK) + { + array_size = jpg_http->getSize(); + } + + if(jpg_http->connected()) + { + WiFiClient* const stream = jpg_http->getStreamPtr(); + stream->stop(); + stream->flush(); + } + jpg_http->end(); + delete jpg_http; + jpg_http = NULL; + } + return array_size; +} + +#endif + #if defined (TJPGD_LOAD_SD_LIBRARY) || defined (TJPGD_LOAD_FFS) /*************************************************************************************** From 3b27b3677317100207d66240668fcbab66f949a5 Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 14:03:04 +0200 Subject: [PATCH 05/17] Update TJpg_Decoder.h --- src/TJpg_Decoder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TJpg_Decoder.h b/src/TJpg_Decoder.h index 0a7ffe9..159be94 100644 --- a/src/TJpg_Decoder.h +++ b/src/TJpg_Decoder.h @@ -88,7 +88,7 @@ class TJpg_Decoder { #if defined (TJPGD_LOAD_HTTP_LIBRARY) JRESULT drawJpgFromStream(int32_t x, int32_t y, char* url) ; - JRESULT getJpgSizeFromStream(char* url); + uint32_t getJpgSizeFromStream(char* url); #endif #if defined (TJPGD_LOAD_SD_LIBRARY) From 0c8afbd5272493e29fa1caf77d479967b91d50cf Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 14:12:48 +0200 Subject: [PATCH 06/17] Update TJpg_Decoder.h --- src/TJpg_Decoder.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TJpg_Decoder.h b/src/TJpg_Decoder.h index 159be94..7e9af86 100644 --- a/src/TJpg_Decoder.h +++ b/src/TJpg_Decoder.h @@ -44,7 +44,8 @@ Latest version here: enum { TJPG_ARRAY = 0, TJPG_FS_FILE, - TJPG_SD_FILE + TJPG_SD_FILE, + STREAM_SD_FILE }; //------------------------------------------------------------------------------ From 146d36960e6269d63f23ebd49611b325b912c7d5 Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 14:13:39 +0200 Subject: [PATCH 07/17] Update TJpg_Decoder.cpp --- src/TJpg_Decoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TJpg_Decoder.cpp b/src/TJpg_Decoder.cpp index 5f038de..76d2c37 100644 --- a/src/TJpg_Decoder.cpp +++ b/src/TJpg_Decoder.cpp @@ -234,7 +234,7 @@ JRESULT TJpg_Decoder::drawJpgFromStream(int32_t x, int32_t y, char* _url) { // Generic file call for SD or SPIFFS, uses leading / to distinguish SPIFFS files uint32_t TJpg_Decoder::getJpgSizeFromStream(char *_url){ - if(!jpg_http->connected()){ + if(!jpg_http){ jpg_http = new HTTPClient; jpg_http->begin(_url); long httpCode = jpg_http->GET(); From 43f81f5a31b3612f567d47dad9fbf69f0626983a Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 14:20:01 +0200 Subject: [PATCH 08/17] Update TJpg_Decoder.h --- src/TJpg_Decoder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TJpg_Decoder.h b/src/TJpg_Decoder.h index 7e9af86..bb28526 100644 --- a/src/TJpg_Decoder.h +++ b/src/TJpg_Decoder.h @@ -45,7 +45,7 @@ enum { TJPG_ARRAY = 0, TJPG_FS_FILE, TJPG_SD_FILE, - STREAM_SD_FILE + TJPG_STREAM_FILE }; //------------------------------------------------------------------------------ From 16a9197ba82edac281ce75a5622ebcbb5d19a07d Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 14:26:54 +0200 Subject: [PATCH 09/17] Update User_Config.h --- src/User_Config.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/User_Config.h b/src/User_Config.h index 0920fc8..faa2ecb 100644 --- a/src/User_Config.h +++ b/src/User_Config.h @@ -3,3 +3,4 @@ #endif #define TJPGD_LOAD_SD_LIBRARY +#define TJPGD_LOAD_HTTP_LIBRARY From 3132402d95eb1374c9e6ef7fdea1ea3212eac0e1 Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 15:19:56 +0200 Subject: [PATCH 10/17] Create huge_file --- examples/http_stream/huge_file | 102 +++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 examples/http_stream/huge_file diff --git a/examples/http_stream/huge_file b/examples/http_stream/huge_file new file mode 100644 index 0000000..80eda4c --- /dev/null +++ b/examples/http_stream/huge_file @@ -0,0 +1,102 @@ +// Example for library: +// https://github.com/Bodmer/TJpg_Decoder + +// This example if for ESP32, it renders a Jpeg file +// that is streamed from a http url. The test file +// is way to huge (~18mb) and mainly for showing the limits of the library +// if you scale it down with value 8, it's gonna take around 60s +// shown in it's original size, the stream will take around 10s +// for implementation in real life projects, it's recommended +// to catch images in size of the display + +// Include the jpeg decoder library +#include + +// Include SD +#include + + +// Include the TFT library https://github.com/Bodmer/TFT_eSPI +#include "SPI.h" +#include // Hardware-specific library +TFT_eSPI tft = TFT_eSPI(); // Invoke custom library +const char* ssid ="NETGEAR29_EXT";// "tobiswifi";//"NETGEAR29_EXT"; +const char* password = "curlypineapple194";//"92cca3b33957";//"curlypineapple194"; +char* url = "https://upload.wikimedia.org/wikipedia/commons/0/00/Center_of_the_Milky_Way_Galaxy_IV_%E2%80%93_Composite.jpg"; + + +// This next function will be called during decoding of the jpeg file to +// render each block to the TFT. If you use a different TFT library +// you will need to adapt this function to suit. +bool tft_output(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t* bitmap) +{ + // Stop further decoding as image is running off bottom of screen + if ( y >= tft.height() ) return 0; + + // This function will clip the image block rendering automatically at the TFT boundaries + tft.pushImage(x, y, w, h, bitmap); + + // This might work instead if you adapt the sketch to use the Adafruit_GFX library + // tft.drawRGBBitmap(x, y, bitmap, w, h); + + // Return 1 to decode next block + return 1; +} + + +void setup() +{ + Serial.begin(115200); + Serial.println("\n\n Testing TJpg_Decoder library"); + + Serial.print("Connecting to "); + Serial.println(ssid); + + WiFi.begin(ssid, password); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + + Serial.println(""); + Serial.println("WiFi connected"); + Serial.println("IP address: "); + Serial.println(WiFi.localIP()); + + // Initialise the TFT + tft.begin(); + tft.setTextColor(0xFFFF, 0x0000); + tft.fillScreen(TFT_BLACK); + tft.setSwapBytes(true); // We need to swap the colour bytes (endianess) + + // The jpeg image can be scaled by a factor of 1, 2, 4, or 8 + TJpgDec.setJpgScale(1); + + // The decoder must be given the exact name of the rendering function above + TJpgDec.setCallback(tft_output); +} + +void loop() +{ + tft.fillScreen(TFT_RED); + + // Time recorded for test purposes + uint32_t t = millis(); + + // Get the width and height in pixels of the jpeg if you wish + uint16_t w = 0, h = 0; + TJpgDec.getJpgSizeFromStream(&w, &h, url); + Serial.print("Width = "); Serial.print(w); Serial.print(", height = "); Serial.println(h); + + // Draw the image, top left at 0,0 + TJpgDec.drawJpgFromStream(0 ,0, url); + //TJpgDec.drawSdJpg(0, 0, "/panda.jpg"); + + // How much time did rendering take + t = millis() - t; + Serial.print(t); Serial.println(" ms"); + + // Wait before drawing again + delay(2000); +} From 61067c2994d9fb8d7c311a2b2dccbee527e8e6af Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 15:20:56 +0200 Subject: [PATCH 11/17] Rename huge_file to stream_huge_jpg --- examples/http_stream/{huge_file => stream_huge_jpg} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/http_stream/{huge_file => stream_huge_jpg} (100%) diff --git a/examples/http_stream/huge_file b/examples/http_stream/stream_huge_jpg similarity index 100% rename from examples/http_stream/huge_file rename to examples/http_stream/stream_huge_jpg From daaeb5498e44a2d11b40648eadaa47cbafec0cc0 Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 15:24:56 +0200 Subject: [PATCH 12/17] Create stream_jpg --- examples/http_stream/stream_jpg | 97 +++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 examples/http_stream/stream_jpg diff --git a/examples/http_stream/stream_jpg b/examples/http_stream/stream_jpg new file mode 100644 index 0000000..3d57755 --- /dev/null +++ b/examples/http_stream/stream_jpg @@ -0,0 +1,97 @@ +// Example for library: +// https://github.com/Bodmer/TJpg_Decoder + +// This example if for ESP32, it renders a Jpeg file +// that is streamed from a http url. + +// Include the jpeg decoder library +#include + +// Include SD +#include + + +// Include the TFT library https://github.com/Bodmer/TFT_eSPI +#include "SPI.h" +#include // Hardware-specific library +TFT_eSPI tft = TFT_eSPI(); // Invoke custom library +const char* ssid ="ssid"; +const char* password = "password"; +char* url = "https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Center_of_the_Milky_Way_Galaxy_IV_%E2%80%93_Composite.jpg/320px-Center_of_the_Milky_Way_Galaxy_IV_%E2%80%93_Composite.jpg"; + + +// This next function will be called during decoding of the jpeg file to +// render each block to the TFT. If you use a different TFT library +// you will need to adapt this function to suit. +bool tft_output(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t* bitmap) +{ + // Stop further decoding as image is running off bottom of screen + if ( y >= tft.height() ) return 0; + + // This function will clip the image block rendering automatically at the TFT boundaries + tft.pushImage(x, y, w, h, bitmap); + + // This might work instead if you adapt the sketch to use the Adafruit_GFX library + // tft.drawRGBBitmap(x, y, bitmap, w, h); + + // Return 1 to decode next block + return 1; +} + + +void setup() +{ + Serial.begin(115200); + Serial.println("\n\n Testing TJpg_Decoder library"); + + Serial.print("Connecting to "); + Serial.println(ssid); + + WiFi.begin(ssid, password); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + + Serial.println(""); + Serial.println("WiFi connected"); + Serial.println("IP address: "); + Serial.println(WiFi.localIP()); + + // Initialise the TFT + tft.begin(); + tft.setTextColor(0xFFFF, 0x0000); + tft.fillScreen(TFT_BLACK); + tft.setSwapBytes(true); // We need to swap the colour bytes (endianess) + + // The jpeg image can be scaled by a factor of 1, 2, 4, or 8 + TJpgDec.setJpgScale(1); + + // The decoder must be given the exact name of the rendering function above + TJpgDec.setCallback(tft_output); +} + +void loop() +{ + tft.fillScreen(TFT_RED); + + // Time recorded for test purposes + uint32_t t = millis(); + + // Get the width and height in pixels of the jpeg if you wish + uint16_t w = 0, h = 0; + TJpgDec.getJpgSizeFromStream(&w, &h, url); + Serial.print("Width = "); Serial.print(w); Serial.print(", height = "); Serial.println(h); + + // Draw the image, top left at 0,0 + TJpgDec.drawJpgFromStream(0 ,0, url); + //TJpgDec.drawSdJpg(0, 0, "/panda.jpg"); + + // How much time did rendering take + t = millis() - t; + Serial.print(t); Serial.println(" ms"); + + // Wait before drawing again + delay(2000); +} From 5a43cc35d438f1df7b2144206dd55324dcdba86b Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 15:28:02 +0200 Subject: [PATCH 13/17] Update TJpg_Decoder.cpp --- src/TJpg_Decoder.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/TJpg_Decoder.cpp b/src/TJpg_Decoder.cpp index 76d2c37..6de0be2 100644 --- a/src/TJpg_Decoder.cpp +++ b/src/TJpg_Decoder.cpp @@ -228,13 +228,22 @@ JRESULT TJpg_Decoder::drawJpgFromStream(int32_t x, int32_t y, char* _url) { } /*************************************************************************************** -** Function name: getJpgSize +** Function name: getJpgSizeFromStream ** Description: Get width and height of a jpg file (name in char array) ***************************************************************************************/ // Generic file call for SD or SPIFFS, uses leading / to distinguish SPIFFS files -uint32_t TJpg_Decoder::getJpgSizeFromStream(char *_url){ - - if(!jpg_http){ +JRESULT TJpg_Decoder::getJpgSizeFromStream(uint16_t *w, uint16_t *h, char *_url){ + + JDEC jdec; + JRESULT jresult = JDR_OK; + + *w = 0; + *h = 0; + + jpg_source = TJPG_STREAM_FILE; + + if(!jpg_http||!jpg_http->connected()){ +Serial.println("get size"); jpg_http = new HTTPClient; jpg_http->begin(_url); long httpCode = jpg_http->GET(); @@ -242,6 +251,12 @@ uint32_t TJpg_Decoder::getJpgSizeFromStream(char *_url){ { array_size = jpg_http->getSize(); } + jresult = jd_prepare(&jdec, jd_input, workspace, TJPGD_WORKSPACE_SIZE, 0); + + if (jresult == JDR_OK) { + *w = jdec.width; + *h = jdec.height; + } if(jpg_http->connected()) { @@ -253,7 +268,7 @@ uint32_t TJpg_Decoder::getJpgSizeFromStream(char *_url){ delete jpg_http; jpg_http = NULL; } - return array_size; + return jresult; } #endif From 37dfec13d039abc9eb50f5ead32b154845cdd013 Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 15:28:48 +0200 Subject: [PATCH 14/17] Update TJpg_Decoder.h --- src/TJpg_Decoder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TJpg_Decoder.h b/src/TJpg_Decoder.h index bb28526..fb84361 100644 --- a/src/TJpg_Decoder.h +++ b/src/TJpg_Decoder.h @@ -89,7 +89,7 @@ class TJpg_Decoder { #if defined (TJPGD_LOAD_HTTP_LIBRARY) JRESULT drawJpgFromStream(int32_t x, int32_t y, char* url) ; - uint32_t getJpgSizeFromStream(char* url); + JRESULT getJpgSizeFromStream(uint16_t *w, uint16_t *h, char* url); #endif #if defined (TJPGD_LOAD_SD_LIBRARY) @@ -97,7 +97,7 @@ class TJpg_Decoder { JRESULT drawSdJpg (int32_t x, int32_t y, const String& pFilename); JRESULT drawSdJpg (int32_t x, int32_t y, File inFile); - JRESULT getSdJpgSize(uint16_t *w, uint16_t *h, const char *pFilename); + JRESULT getSdJpgSize(uint16_t *w, uint16_t *h, const char *pFilename); JRESULT getSdJpgSize(uint16_t *w, uint16_t *h, const String& pFilename); JRESULT getSdJpgSize(uint16_t *w, uint16_t *h, File inFile); #endif From e79c49eab4f9d11222f9e6bba23dcba80fc98a4f Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Fri, 5 Aug 2022 16:00:00 +0200 Subject: [PATCH 15/17] added array_index = 0; to getJPGSizeFromStream --- src/TJpg_Decoder.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/TJpg_Decoder.cpp b/src/TJpg_Decoder.cpp index 6de0be2..114e661 100644 --- a/src/TJpg_Decoder.cpp +++ b/src/TJpg_Decoder.cpp @@ -239,6 +239,7 @@ JRESULT TJpg_Decoder::getJpgSizeFromStream(uint16_t *w, uint16_t *h, char *_url) *w = 0; *h = 0; + array_index = 0; jpg_source = TJPG_STREAM_FILE; From 35a5e9bca8c5d4c71ce389cfe34ccc6f65e5eb1c Mon Sep 17 00:00:00 2001 From: SirCooper <52159743+SirCooper@users.noreply.github.com> Date: Sat, 6 Aug 2022 13:33:53 +0200 Subject: [PATCH 16/17] Update stream_huge_jpg --- examples/http_stream/stream_huge_jpg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/http_stream/stream_huge_jpg b/examples/http_stream/stream_huge_jpg index 80eda4c..7bfcfb4 100644 --- a/examples/http_stream/stream_huge_jpg +++ b/examples/http_stream/stream_huge_jpg @@ -20,8 +20,8 @@ #include "SPI.h" #include // Hardware-specific library TFT_eSPI tft = TFT_eSPI(); // Invoke custom library -const char* ssid ="NETGEAR29_EXT";// "tobiswifi";//"NETGEAR29_EXT"; -const char* password = "curlypineapple194";//"92cca3b33957";//"curlypineapple194"; +const char* ssid ="ssid";// +const char* password = "password";// char* url = "https://upload.wikimedia.org/wikipedia/commons/0/00/Center_of_the_Milky_Way_Galaxy_IV_%E2%80%93_Composite.jpg"; From a3b5d1319e99403418630c4ab7a78df999dc9eb2 Mon Sep 17 00:00:00 2001 From: Bodmer Date: Thu, 20 Oct 2022 00:37:39 +0100 Subject: [PATCH 17/17] Update TJpg_Decoder.h --- src/TJpg_Decoder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TJpg_Decoder.h b/src/TJpg_Decoder.h index fb84361..ef52490 100644 --- a/src/TJpg_Decoder.h +++ b/src/TJpg_Decoder.h @@ -17,7 +17,7 @@ Latest version here: #include "Arduino.h" #include "tjpgd.h" - #if defined (ESP8266) || defined (ESP32) + #if defined (ARDUINO_ARCH_ESP8266) || defined (ESP32) #if defined (TJPGD_LOAD_HTTP_LIBRARY) #include #include