diff --git a/image_utils.c b/image_utils.c index 454156f..c0d1f2c 100644 --- a/image_utils.c +++ b/image_utils.c @@ -84,7 +84,6 @@ my_dst_mgr_init(j_compress_ptr cinfo) dst->jdst.free_in_buffer = dst->sz; return; - } static boolean @@ -100,7 +99,6 @@ my_dst_mgr_empty(j_compress_ptr cinfo) dst->jdst.free_in_buffer = dst->sz - dst->used; return TRUE; - } static void @@ -112,7 +110,6 @@ my_dst_mgr_term(j_compress_ptr cinfo) dst->off = dst->buf + dst->used; return; - } static void @@ -124,7 +121,6 @@ jpeg_memory_dest(j_compress_ptr cinfo, struct my_dst_mgr *dst) cinfo->dest = (void *)dst; return; - } /* Source manager to read data from a buffer */ @@ -182,10 +178,8 @@ jpeg_memory_src(j_decompress_ptr cinfo, const unsigned char * buffer, size_t buf { struct my_src_mgr *src; - if (! cinfo->src) - { + if (!cinfo->src) cinfo->src = (*cinfo->mem->alloc_small)((void *)cinfo, JPOOL_PERMANENT, sizeof(struct my_src_mgr));; - } src = (void *)cinfo->src; src->pub.init_source = init_source; src->pub.fill_input_buffer = fill_input_buffer; @@ -488,6 +482,7 @@ image_new_from_jpeg(const char *path, int is_file, const uint8_t *buf, int size, if(cinfo.rec_outbuf_height > 16) { DPRINTF(E_WARN, L_METADATA, "ERROR image_from_jpeg : (image_from_jpeg.c) JPEG uses line buffers > 16. Cannot load.\n"); + jpeg_destroy_decompress(&cinfo); image_free(vimage); if( is_file ) fclose(file); @@ -501,6 +496,7 @@ image_new_from_jpeg(const char *path, int is_file, const uint8_t *buf, int size, if((ptr = malloc(w * 3 * cinfo.rec_outbuf_height + 16)) == NULL) { DPRINTF(E_WARN, L_METADATA, "malloc failed\n"); + jpeg_destroy_decompress(&cinfo); image_free(vimage); if( is_file ) fclose(file); @@ -815,6 +811,8 @@ image_save_to_jpeg_buf(image_s * pimage, int * size) if((data = malloc(row_stride)) == NULL) { DPRINTF(E_WARN, L_METADATA, "malloc failed\n"); + free(dst.buf); + jpeg_destroy_compress(&cinfo); return NULL; } i = 0; diff --git a/minidlna.c b/minidlna.c index ab49016..6b25a2a 100644 --- a/minidlna.c +++ b/minidlna.c @@ -690,7 +690,8 @@ init(int argc, char **argv) runtime_vars.root_container = IMAGE_ID; break; default: - DPRINTF(E_ERROR, L_GENERAL, "Invalid root container! [%s]\n", + runtime_vars.root_container = ary_options[i].value; + DPRINTF(E_WARN, L_GENERAL, "Using arbitrary root container [%s]\n", ary_options[i].value); break; } diff --git a/minidlna.conf b/minidlna.conf index c423fad..7e00e89 100644 --- a/minidlna.conf +++ b/minidlna.conf @@ -71,6 +71,7 @@ model_number=1 # + "M" - "Music" # + "V" - "Video" # + "P" - "Pictures" +# + Or, you can specify the ObjectID of your desired root container (eg. 1$F for Music/Playlists) # if you specify "B" and client device is audio-only then "Music/Folders" will be used as root #root_container=.