summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/im_file.h6
-rw-r--r--include/im_format_avi.h6
-rw-r--r--mak.vc9/im_wmv.vcproj2
-rw-r--r--src/im_file.cpp20
-rw-r--r--src/im_format_gif.cpp6
-rw-r--r--src/im_format_tiff.cpp6
-rw-r--r--src/im_format_wmv.cpp7
7 files changed, 37 insertions, 16 deletions
diff --git a/include/im_file.h b/include/im_file.h
index 33ef12e..58022eb 100644
--- a/include/im_file.h
+++ b/include/im_file.h
@@ -79,7 +79,6 @@ void imFileLineBufferInit(imFile* ifile);
int imFileCheckConversion(imFile* ifile);
-
/* File Format SDK */
/** Number of lines to be accessed.
@@ -103,6 +102,11 @@ void imFileLineBufferWrite(imFile* ifile, const void* data, int line, int plane)
* \ingroup filesdk */
int imFileLineSizeAligned(int width, int bpp, int align);
+/** Set the attributes FileFormat, FileCompression and FileImageCount. \n
+ * Used in imFileOpen and imFileOpenAs, and after the attribute list cleared with RemoveAll.
+ * \ingroup filesdk */
+void imFileSetBaseAttributes(imFile* ifile);
+
#if defined(__cplusplus)
}
diff --git a/include/im_format_avi.h b/include/im_format_avi.h
index ae9fe99..535aa37 100644
--- a/include/im_format_avi.h
+++ b/include/im_format_avi.h
@@ -62,9 +62,9 @@ extern "C" {
Attributes:
FPS IM_FLOAT (1) (should set when writing, default 15)
- AVIQuality IM_INT (1) [1-10000, default -1] (write only)
- KeyFrameRate IM_INT (1) (write only) [key frame frequency, if 0 not using key frames, default 15]
- DataRate IM_INT (1) (write only) [kilobits/second, default 2400]
+ AVIQuality IM_INT (1) [1-10000, default -1] (write only) [unsed if compression=CUSTOM]
+ KeyFrameRate IM_INT (1) (write only) [key frame frequency, if 0 not using key frames, default 15, unsed if compression=CUSTOM]
+ DataRate IM_INT (1) (write only) [kilobits/second, default 2400, unsed if compression=CUSTOM]
Comments:
Reads only the first video stream. Other streams are ignored.
diff --git a/mak.vc9/im_wmv.vcproj b/mak.vc9/im_wmv.vcproj
index c18fef7..f767689 100644
--- a/mak.vc9/im_wmv.vcproj
+++ b/mak.vc9/im_wmv.vcproj
@@ -43,7 +43,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;../src;d:\LNG\WMFSDK9\include"
- PreprocessorDefinitions="WIN32,_DEBUG,_LIB,_CRT_SECURE_NO_DEPRECATE"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS"
ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
diff --git a/src/im_file.cpp b/src/im_file.cpp
index 5cfe49d..3bfa779 100644
--- a/src/im_file.cpp
+++ b/src/im_file.cpp
@@ -2,7 +2,7 @@
* \brief File Access
*
* See Copyright Notice in im_lib.h
- * $Id: im_file.cpp,v 1.4 2009/08/19 18:39:43 scuri Exp $
+ * $Id: im_file.cpp,v 1.5 2009/08/23 23:57:51 scuri Exp $
*/
#include <stdlib.h>
@@ -45,6 +45,16 @@ void imFileClear(imFile* ifile)
ifile->palette[i] = imColorEncode((imbyte)i, (imbyte)i, (imbyte)i);
}
+void imFileSetBaseAttributes(imFile* ifile)
+{
+ imFileFormatBase* ifileformat = (imFileFormatBase*)ifile;
+ imAttribTable* atable = (imAttribTable*)ifileformat->attrib_table;
+
+ atable->Set("FileFormat", IM_BYTE, -1, ifileformat->iformat->format);
+ atable->Set("FileCompression", IM_BYTE, -1, ifileformat->compression);
+ atable->Set("FileImageCount", IM_INT, 1, &ifileformat->image_count);
+}
+
imFile* imFileOpen(const char* file_name, int *error)
{
assert(file_name);
@@ -56,9 +66,7 @@ imFile* imFileOpen(const char* file_name, int *error)
imFileClear(ifileformat);
ifileformat->attrib_table = new imAttribTable(599);
- imFileSetAttribute(ifileformat, "FileFormat", IM_BYTE, -1, ifileformat->iformat->format);
- imFileSetAttribute(ifileformat, "FileCompression", IM_BYTE, -1, ifileformat->compression);
- imFileSetAttribute(ifileformat, "FileImageCount", IM_INT, 1, &ifileformat->image_count);
+ imFileSetBaseAttributes(ifileformat);
ifileformat->counter = imCounterBegin(file_name);
@@ -76,9 +84,7 @@ imFile* imFileOpenAs(const char* file_name, const char* format, int *error)
imFileClear(ifileformat);
ifileformat->attrib_table = new imAttribTable(599);
- imFileSetAttribute(ifileformat, "FileFormat", IM_BYTE, -1, ifileformat->iformat->format);
- imFileSetAttribute(ifileformat, "FileCompression", IM_BYTE, -1, ifileformat->compression);
- imFileSetAttribute(ifileformat, "FileImageCount", IM_INT, 1, &ifileformat->image_count);
+ imFileSetBaseAttributes(ifileformat);
ifileformat->counter = imCounterBegin(file_name);
diff --git a/src/im_format_gif.cpp b/src/im_format_gif.cpp
index d616504..caadd0f 100644
--- a/src/im_format_gif.cpp
+++ b/src/im_format_gif.cpp
@@ -2,7 +2,7 @@
* \brief GIF - Graphics Interchange Format
*
* See Copyright Notice in im_lib.h
- * $Id: im_format_gif.cpp,v 1.4 2009/08/19 18:39:43 scuri Exp $
+ * $Id: im_format_gif.cpp,v 1.5 2009/08/23 23:57:51 scuri Exp $
*/
#include "im_format.h"
@@ -1247,7 +1247,11 @@ int imFileFormatGIF::GIFWriteImageInfo()
int imFileFormatGIF::ReadImageInfo(int index)
{
imAttribTable* attrib_table = AttribTable();
+
+ /* must clear the attribute list, because it can have multiple images and
+ has many attributes that may exists only for specific images. */
attrib_table->RemoveAll();
+ imFileSetBaseAttributes(this);
if (gif_data.screen_width)
{
diff --git a/src/im_format_tiff.cpp b/src/im_format_tiff.cpp
index 5b072fc..b5e06c5 100644
--- a/src/im_format_tiff.cpp
+++ b/src/im_format_tiff.cpp
@@ -3,7 +3,7 @@
*
* See Copyright Notice in im_lib.h
* See libTIFF Copyright Notice in tiff.h
- * $Id: im_format_tiff.cpp,v 1.4 2009/08/22 04:31:04 scuri Exp $
+ * $Id: im_format_tiff.cpp,v 1.5 2009/08/23 23:57:51 scuri Exp $
*/
#include "im_format.h"
@@ -762,8 +762,10 @@ int imFileFormatTIFF::ReadImageInfo(int index)
uint16* sub_ifd = (uint16*)attrib_table->Get("SubIFDSelect");
- /* must clear the attribute list, because TIFF can have many different images */
+ /* must clear the attribute list, because it can have multiple images and
+ has many attributes that may exists only for specific images. */
attrib_table->RemoveAll();
+ imFileSetBaseAttributes(this);
void* data = NULL;
if (TIFFGetField(this->tiff, TIFFTAG_DNGVERSION, &data) == 1 && data)
diff --git a/src/im_format_wmv.cpp b/src/im_format_wmv.cpp
index a4733a5..4f3b31b 100644
--- a/src/im_format_wmv.cpp
+++ b/src/im_format_wmv.cpp
@@ -2,7 +2,7 @@
* \brief WMV - Windows Media Video Format
*
* See Copyright Notice in im_lib.h
- * $Id: im_format_wmv.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $
+ * $Id: im_format_wmv.cpp,v 1.3 2009/08/23 23:57:52 scuri Exp $
*/
#include "im_format.h"
@@ -1175,6 +1175,11 @@ int imFileFormatWMV::ReadImageInfo(int index)
imAttribTable* attrib_table = AttribTable();
+ /* must clear the attribute list, because it can have multiple images and
+ has many attributes that may exists only for specific images. */
+ attrib_table->RemoveAll();
+ imFileSetBaseAttributes(this);
+
if (MediaType->formattype == WMFORMAT_VideoInfo)
{
WMVIDEOINFOHEADER* info_header = (WMVIDEOINFOHEADER*)MediaType->pbFormat;