Read .raw thumbnails #80, fix media probing for some formats

This commit is contained in:
2020-07-18 09:31:42 -04:00
parent e7eca2c90a
commit 5c559eb291
6 changed files with 182 additions and 107 deletions

View File

@@ -268,6 +268,20 @@ TEST(MediaImage, Exif1) {
cleanup(&doc, &f);
}
TEST(MediaImage, Mem1) {
vfile_t f;
document_t doc;
load_doc_file("libscan-test-files/test_files/media/test.jpeg.tar", &f, &doc);
size_t size_before = store_size;
parse_archive(&arc_recurse_media_ctx, &f, &doc);
ASSERT_NE(size_before, store_size);
cleanup(&doc, &f);
}
TEST(MediaVideo, Vid3Mp4) {
vfile_t f;
document_t doc;
@@ -320,13 +334,15 @@ TEST(MediaVideoVfile, Vid3Ogv) {
document_t doc;
load_doc_file("libscan-test-files/test_files/arc/vid3.tar", &f, &doc);
size_t size_before = store_size;
parse_archive(&arc_recurse_media_ctx, &f, &doc);
ASSERT_STREQ(get_meta(&LastSubDoc, MetaMediaVideoCodec)->str_val, "theora");
ASSERT_EQ(get_meta(&LastSubDoc, MetaMediaBitrate)->long_val, 590261);
// ASSERT_STREQ(get_meta(&LastSubDoc, MetaMediaVideoCodec)->str_val, "theora");
ASSERT_EQ(get_meta(&LastSubDoc, MetaMediaBitrate)->long_val, 600758);
ASSERT_EQ(get_meta(&LastSubDoc, MetaMediaDuration)->long_val, 10);
ASSERT_NE(size_before, store_size);
//TODO: Check that thumbnail was generated correctly
cleanup(&doc, &f);
}
@@ -493,6 +509,8 @@ TEST(RAW, Panasonic) {
document_t doc;
load_doc_file("libscan-test-files/test_files/raw/Panasonic.RW2", &f, &doc);
size_t size_before = store_size;
parse_raw(&raw_ctx, &f, &doc);
ASSERT_STREQ(get_meta(&doc, MetaMediaVideoCodec)->str_val, "raw");
@@ -504,7 +522,7 @@ TEST(RAW, Panasonic) {
ASSERT_STREQ(get_meta(&doc, MetaExifFNumber)->str_val, "2.0");
ASSERT_EQ(get_meta(&doc, MetaWidth)->int_val, 5200);
ASSERT_EQ(get_meta(&doc, MetaHeight)->int_val, 3904);
ASSERT_NE(size_before, store_size);
cleanup(&doc, &f);
}
@@ -514,6 +532,8 @@ TEST(RAW, Nikon) {
document_t doc;
load_doc_file("libscan-test-files/test_files/raw/Nikon.NEF", &f, &doc);
size_t size_before = store_size;
parse_raw(&raw_ctx, &f, &doc);
ASSERT_STREQ(get_meta(&doc, MetaMediaVideoCodec)->str_val, "raw");
@@ -521,6 +541,7 @@ TEST(RAW, Nikon) {
ASSERT_STREQ(get_meta(&doc, MetaExifMake)->str_val, "Nikon");
ASSERT_EQ(get_meta(&doc, MetaWidth)->int_val, 6032);
ASSERT_EQ(get_meta(&doc, MetaHeight)->int_val, 4032);
ASSERT_NE(size_before, store_size);
cleanup(&doc, &f);
}
@@ -530,6 +551,8 @@ TEST(RAW, Sony) {
document_t doc;
load_doc_file("libscan-test-files/test_files/raw/Sony.ARW", &f, &doc);
size_t size_before = store_size;
parse_raw(&raw_ctx, &f, &doc);
ASSERT_STREQ(get_meta(&doc, MetaMediaVideoCodec)->str_val, "raw");
@@ -537,6 +560,7 @@ TEST(RAW, Sony) {
ASSERT_STREQ(get_meta(&doc, MetaExifMake)->str_val, "Sony");
ASSERT_EQ(get_meta(&doc, MetaWidth)->int_val, 7968);
ASSERT_EQ(get_meta(&doc, MetaHeight)->int_val, 5320);
ASSERT_NE(size_before, store_size);
cleanup(&doc, &f);
}
@@ -546,6 +570,8 @@ TEST(RAW, Olympus) {
document_t doc;
load_doc_file("libscan-test-files/test_files/raw/Olympus.ORF", &f, &doc);
size_t size_before = store_size;
parse_raw(&raw_ctx, &f, &doc);
ASSERT_STREQ(get_meta(&doc, MetaMediaVideoCodec)->str_val, "raw");
@@ -553,6 +579,7 @@ TEST(RAW, Olympus) {
ASSERT_STREQ(get_meta(&doc, MetaExifMake)->str_val, "Olympus");
ASSERT_EQ(get_meta(&doc, MetaWidth)->int_val, 4640);
ASSERT_EQ(get_meta(&doc, MetaHeight)->int_val, 3472);
ASSERT_NE(size_before, store_size);
cleanup(&doc, &f);
}
@@ -562,6 +589,7 @@ TEST(RAW, Fuji) {
document_t doc;
load_doc_file("libscan-test-files/test_files/raw/Fuji.RAF", &f, &doc);
size_t size_before = store_size;
parse_raw(&raw_ctx, &f, &doc);
ASSERT_STREQ(get_meta(&doc, MetaMediaVideoCodec)->str_val, "raw");
@@ -569,6 +597,7 @@ TEST(RAW, Fuji) {
ASSERT_STREQ(get_meta(&doc, MetaExifMake)->str_val, "Fujifilm");
ASSERT_EQ(get_meta(&doc, MetaWidth)->int_val, 6032);
ASSERT_EQ(get_meta(&doc, MetaHeight)->int_val, 4028);
ASSERT_NE(size_before, store_size);
cleanup(&doc, &f);
}
@@ -614,7 +643,7 @@ int main(int argc, char **argv) {
media_ctx.store = counter_store;
media_ctx.tn_size = 500;
media_ctx.tn_qscale = 1.0;
media_ctx.max_media_buffer = (long)2000 * 1024 * 1024;
media_ctx.max_media_buffer = (long)2000 * (long)1024 * (long)1024;
ooxml_500_ctx.content_size = 500;
ooxml_500_ctx.log = noop_log;