SPEC-3723: restructure meta-agl-demo
[AGL/meta-agl-demo.git] / recipes-multimedia / lightmediascanner / files / plugin-ogg-fix-chucksize-issue.patch
1 From 3e66b97221440b17a184feb48692dce7e0561cac Mon Sep 17 00:00:00 2001
2 From: Matt Ranostay <matt.ranostay@konsulko.com>
3 Date: Wed, 8 Mar 2017 16:30:01 -0800
4 Subject: [PATCH] plugin: ogg: fix chucksize issue
5
6 There are some OGG files that have metadata chucks that go over the
7 hardcoded 10 * 4096 size due to album art. This patchset just parses
8 each chuck and continues till it runs out of valid chunks.
9
10 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
11 ---
12  src/plugins/ogg/ogg.c | 11 ++---------
13  1 file changed, 2 insertions(+), 9 deletions(-)
14
15 diff --git a/src/plugins/ogg/ogg.c b/src/plugins/ogg/ogg.c
16 index 1c0818e..c94dc38 100644
17 --- a/src/plugins/ogg/ogg.c
18 +++ b/src/plugins/ogg/ogg.c
19 @@ -47,8 +47,6 @@
20  int CHUNKSIZE = 4096;
21  #endif
22  
23 -#define MAX_CHUNKS_PER_PAGE 10
24 -
25  struct stream {
26      struct lms_stream base;
27      int serial;
28 @@ -122,10 +120,8 @@ _set_lms_info(struct lms_string_size *info, const char *tag)
29  
30  static bool _ogg_read_page(FILE *fp, ogg_sync_state *osync, ogg_page *page)
31  {
32 -    int i;
33 -
34 -    for (i = 0; i < MAX_CHUNKS_PER_PAGE && ogg_sync_pageout(osync, page) != 1;
35 -         i++) {
36 +    while(ogg_sync_pageout(osync, page) != 1)
37 +    {
38          lms_ogg_buffer_t buffer = lms_get_ogg_sync_buffer(osync, CHUNKSIZE);
39          int bytes = fread(buffer, 1, CHUNKSIZE, fp);
40  
41 @@ -136,9 +132,6 @@ static bool _ogg_read_page(FILE *fp, ogg_sync_state *osync, ogg_page *page)
42          ogg_sync_wrote(osync, bytes);
43      }
44  
45 -    if (i > MAX_CHUNKS_PER_PAGE)
46 -        return false;
47 -
48      return true;
49  }
50  
51 -- 
52 2.7.4
53