mirror of
				https://github.com/simon987/libscan.git
				synced 2025-11-04 03:06:51 +00:00 
			
		
		
		
	Fix for #90
This commit is contained in:
		
							parent
							
								
									947a510338
								
							
						
					
					
						commit
						6c18fccab3
					
				@ -632,11 +632,11 @@ int store_image_thumbnail(scan_media_ctx_t *ctx, void* buf, size_t buf_len, docu
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        av_packet_unref(&jpeg_packet);
 | 
					        av_packet_unref(&jpeg_packet);
 | 
				
			||||||
        avcodec_free_context(&jpeg_encoder);
 | 
					        avcodec_free_context(&jpeg_encoder);
 | 
				
			||||||
 | 
					        av_free(*scaled_frame->data);
 | 
				
			||||||
 | 
					        av_frame_free(&scaled_frame);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    frame_and_packet_free(frame_and_packet);
 | 
					    frame_and_packet_free(frame_and_packet);
 | 
				
			||||||
    av_free(*scaled_frame->data);
 | 
					 | 
				
			||||||
    av_frame_free(&scaled_frame);
 | 
					 | 
				
			||||||
    avcodec_free_context(&decoder);
 | 
					    avcodec_free_context(&decoder);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    avformat_close_input(&pFormatCtx);
 | 
					    avformat_close_input(&pFormatCtx);
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,8 @@ static scan_ebook_ctx_t ebook_500_ctx;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static scan_comic_ctx_t comic_ctx;
 | 
					static scan_comic_ctx_t comic_ctx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static scan_comic_ctx_t comic_big_ctx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static scan_media_ctx_t media_ctx;
 | 
					static scan_media_ctx_t media_ctx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static scan_ooxml_ctx_t ooxml_500_ctx;
 | 
					static scan_ooxml_ctx_t ooxml_500_ctx;
 | 
				
			||||||
@ -239,6 +241,32 @@ TEST(Comic, ComicCbr) {
 | 
				
			|||||||
    cleanup(&doc, &f);
 | 
					    cleanup(&doc, &f);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST(Comic, ComicCbrAsIs) {
 | 
				
			||||||
 | 
					    vfile_t f;
 | 
				
			||||||
 | 
					    document_t doc;
 | 
				
			||||||
 | 
					    load_doc_file("libscan-test-files/test_files/ebook/laugh.cbr", &f, &doc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    size_t size_before = store_size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    parse_comic(&comic_big_ctx, &f, &doc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ASSERT_EQ(store_size - size_before, 92451);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    cleanup(&doc, &f);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST(Comic, ComicCbrFilters) {
 | 
				
			||||||
 | 
					    vfile_t f;
 | 
				
			||||||
 | 
					    document_t doc;
 | 
				
			||||||
 | 
					    load_doc_file("libscan-test-files/test_files/ebook/cannot_parse_filters.cbr", &f, &doc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    parse_comic(&comic_ctx, &f, &doc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    cleanup(&doc, &f);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Media (image) */
 | 
					/* Media (image) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST(MediaImage, Exif1) {
 | 
					TEST(MediaImage, Exif1) {
 | 
				
			||||||
@ -652,6 +680,12 @@ int main(int argc, char **argv) {
 | 
				
			|||||||
    comic_ctx.logf = noop_logf;
 | 
					    comic_ctx.logf = noop_logf;
 | 
				
			||||||
    comic_ctx.store = counter_store;
 | 
					    comic_ctx.store = counter_store;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    comic_big_ctx.tn_qscale = 1.0;
 | 
				
			||||||
 | 
					    comic_big_ctx.tn_size = 5000;
 | 
				
			||||||
 | 
					    comic_big_ctx.log = noop_log;
 | 
				
			||||||
 | 
					    comic_big_ctx.logf = noop_logf;
 | 
				
			||||||
 | 
					    comic_big_ctx.store = counter_store;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    media_ctx.log = noop_log;
 | 
					    media_ctx.log = noop_log;
 | 
				
			||||||
    media_ctx.logf = noop_logf;
 | 
					    media_ctx.logf = noop_logf;
 | 
				
			||||||
    media_ctx.store = counter_store;
 | 
					    media_ctx.store = counter_store;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user