"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/plugins/thumbnailffmpeg_extractor.c" between
libextractor-1.8.tar.gz and libextractor-1.9.tar.gz

About: GNU libextractor is a library used to extract meta-data from files of arbitrary type.

thumbnailffmpeg_extractor.c  (libextractor-1.8):thumbnailffmpeg_extractor.c  (libextractor-1.9)
skipping to change at line 626 skipping to change at line 626
int thumb_width; int thumb_width;
int thumb_height; int thumb_height;
int i; int i;
int err; int err;
int frame_finished; int frame_finished;
unsigned char *iob; unsigned char *iob;
int duration; int duration;
if (NULL == (iob = av_malloc (16 * 1024))) if (NULL == (iob = av_malloc (16 * 1024)))
return; return;
if (NULL == (io_ctx = avio_alloc_context (iob, 16 * 1024, if (NULL == (io_ctx = avio_alloc_context (iob,
16 * 1024,
0, ec, 0, ec,
&read_cb, &read_cb,
NULL /* no writing */, NULL /* no writing */,
&seek_cb))) &seek_cb)))
{ {
av_free (iob); av_free (iob);
return; return;
} }
if (NULL == (format_ctx = avformat_alloc_context ())) if (NULL == (format_ctx = avformat_alloc_context ()))
{ {
av_free (io_ctx); av_free (io_ctx);
return; return;
} }
format_ctx->pb = io_ctx; format_ctx->pb = io_ctx;
options = NULL; options = NULL;
if (0 != avformat_open_input (&format_ctx, "<no file>", NULL, &options)) if (0 != avformat_open_input (&format_ctx, "<no file>", NULL, &options))
return; {
av_free (io_ctx);
return;
}
av_dict_free (&options); av_dict_free (&options);
if (0 > avformat_find_stream_info (format_ctx, NULL)) if (0 > avformat_find_stream_info (format_ctx, NULL))
{ {
#if DEBUG #if DEBUG
fprintf (stderr, fprintf (stderr,
"Failed to read stream info\n"); "Failed to read stream info\n");
#endif #endif
avformat_close_input (&format_ctx); avformat_close_input (&format_ctx);
av_free (io_ctx); av_free (io_ctx);
return; return;
skipping to change at line 780 skipping to change at line 784
codec_ctx->sample_aspect_ratio.den, codec_ctx->sample_aspect_ratio.den,
&thumb_width, &thumb_height); &thumb_width, &thumb_height);
err = create_thumbnail (codec_ctx, codec_ctx->width, codec_ctx->height, err = create_thumbnail (codec_ctx, codec_ctx->width, codec_ctx->height,
frame->linesize, codec_ctx->pix_fmt, frame->linesize, codec_ctx->pix_fmt,
(const uint8_t* const *) frame->data, (const uint8_t* const *) frame->data,
thumb_width, thumb_height, thumb_width, thumb_height,
&encoded_thumbnail, MAX_THUMB_BYTES); &encoded_thumbnail, MAX_THUMB_BYTES);
if (err > 0) if (err > 0)
{ {
ec->proc (ec->cls, ec->proc (ec->cls,
"thumbnailffmpeg", "thumbnailffmpeg",
EXTRACTOR_METATYPE_THUMBNAIL, EXTRACTOR_METATYPE_THUMBNAIL,
EXTRACTOR_METAFORMAT_BINARY, EXTRACTOR_METAFORMAT_BINARY,
"image/png", "image/png",
(const char*) encoded_thumbnail, (const char*) encoded_thumbnail,
err); err);
#if OUTPUT_FILE #if OUTPUT_FILE
FILE *f; FILE *f;
#ifdef USE_JPEG #ifdef USE_JPEG
f = fopen("thumb.jpg", "wb"); f = fopen("thumb.jpg", "wb");
#else #else
f = fopen("thumb.png", "wb"); f = fopen("thumb.png", "wb");
#endif #endif
if (!f) { if (!f)
fprintf(stderr, "Could not open %s\n", "file"); {
exit(1); fprintf(stderr, "Could not open %s\n", "file");
} exit(1);
}
fwrite(encoded_thumbnail, 1, err, f);
fclose(f);
#endif fwrite(encoded_thumbnail, 1, err, f);
fclose(f);
#endif
av_free (encoded_thumbnail); av_free (encoded_thumbnail);
} }
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1) #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
av_frame_free (&frame); av_frame_free (&frame);
#else #else
avcodec_free_frame (&frame); avcodec_free_frame (&frame);
#endif #endif
avcodec_close (codec_ctx); avcodec_close (codec_ctx);
avformat_close_input (&format_ctx); avformat_close_input (&format_ctx);
av_free (io_ctx); av_free (io_ctx);
 End of changes. 5 change blocks. 
18 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)