vips7wrap works for non-image output

"vips max x.jpg" now works
This commit is contained in:
John Cupitt 2011-10-19 10:53:18 +01:00
parent 9078df3c7b
commit 7fdeb1789b
2 changed files with 50 additions and 7 deletions

16
TODO
View File

@ -1,8 +1,3 @@
- try
$ vips max poop.jpg --vips-leak
need to implement output double args in wrapvips7.c
- try
@ -44,10 +39,17 @@
additionally, exif tags can be in one of several ifd blocks, do we need to
add the tag to the correct block? how do we save that information?
probably not possible with libexif, better to pass the problem to another
library and simply provide operations to add and remove whole exif blocks
oo! we have the original, of course
to reattach, get the entry from the original exif block, get the updated
tag, coerce the updated value back to the orginal format
save exif entries to tags as something like:
exif-Orientation: 1 (Top-left, Short, 1 component, 2 bytes)
so we can restore the value from the "1" without needding to look up i18n
strings

View File

@ -123,6 +123,8 @@ typedef enum {
VIPS_WRAP7_INTERPOLATE
} VipsWrap7Type;
/* Order must match VipsWrap7Type enums.
*/
static char *vips_wrap7_supported[] = {
IM_TYPE_DOUBLE,
IM_TYPE_INT,
@ -537,6 +539,33 @@ vips_wrap7_build_output( VipsObject *object,
return( NULL );
}
/* Mark an output as assigned.
*/
static void *
vips_wrap7_note_assigned( VipsObject *object,
GParamSpec *pspec,
VipsArgumentClass *argument_class,
VipsArgumentInstance *argument_instance,
void *a, void *b )
{
/* We want required, construct-time, output args.
*/
if( !(argument_class->flags & VIPS_ARGUMENT_REQUIRED) ||
!(argument_class->flags & VIPS_ARGUMENT_CONSTRUCT) ||
!(argument_class->flags & VIPS_ARGUMENT_OUTPUT) )
return( NULL );
if( !argument_instance->assigned ) {
argument_instance->assigned = TRUE;
VIPS_DEBUG_MSG( "vips_wrap7_note_assigned: "
"marking %s as assigned\n",
g_param_spec_get_name( pspec ) );
}
return( NULL );
}
static int
vips_wrap7_build( VipsObject *object )
{
@ -573,9 +602,21 @@ vips_wrap7_build( VipsObject *object )
if( VIPS_OBJECT_CLASS( vips_wrap7_parent_class )->build( object ) )
return( -1 );
/* Run the operation.
*/
if( class->fn->disp( wrap7->vargv ) )
return( -1 );
/* The vips7 operation will have written any outputs (such as the
* output double for im_max(), for example) to varg. g_object_get()
* fetches directly from vargv (see vips_wrap7_object_get_property())
* so we don't need to do any copying, we just need to tell vips that
* all outputs now have values.
*/
(void) vips_argument_map( VIPS_OBJECT( wrap7 ),
vips_wrap7_note_assigned,
NULL, NULL );
return( 0 );
}