/* -------------------------------------- * gap_dvref_assign_videoref_parasites * -------------------------------------- * if gpp->drawable_vref contains vaild video reference * then * assign video reference parasites to the specified drawable_id (typically this is a layer.) * (one parasite contains only the videfilename and has variable length, * the other contains framenumber and other information that was used to fetch * the frame from the videofile). * * the video reference is typically set on successful fetch * from a video file. (and reset on all other types of frame fetches) * + TODO: query gimprc parameter that can configures using persitent drawable_videoref_parasites. * (default shall be temporary parasites) */ void gap_dvref_assign_videoref_parasites(GapDrawableVideoRef *dvref, gint32 drawable_id) { GimpParasite *l_parasite; if(gap_debug) { printf("gap_assign_drawable_videoref_parasite: START\n"); gap_dvref_debug_print_GapDrawableVideoRef(dvref); } if(dvref->videofile == NULL) { /* no viedo reference available for the current frame */ return; } l_parasite = gimp_parasite_new(GAP_DRAWABLE_VIDEOFILE_PARASITE_NAME ,0 /* GIMP_PARASITE_PERSISTENT 0 for non persistent */ ,1 + strlen(dvref->videofile) ,dvref->videofile /* parasite data */ ); if(l_parasite) { gimp_drawable_parasite_attach(drawable_id, l_parasite); gimp_parasite_free(l_parasite); } l_parasite = gimp_parasite_new(GAP_DRAWABLE_VIDEOPARAMS_PARASITE_NAME ,0 /* GIMP_PARASITE_PERSISTENT */ ,sizeof(GapDrawableVideoParasite) ,&dvref->para /* parasite data */ ); if(l_parasite) { gimp_drawable_parasite_attach(drawable_id, l_parasite); gimp_parasite_free(l_parasite); } } /* end gap_dvref_assign_videoref_parasites */
/** * gimp_drawable_attach_new_parasite: * @drawable_ID: the ID of the #GimpDrawable to attach the #GimpParasite to. * @name: the name of the #GimpParasite to create and attach. * @flags: the flags set on the #GimpParasite. * @size: the size of the parasite data in bytes. * @data: a pointer to the data attached with the #GimpParasite. * * Convenience function that creates a parasite and attaches it * to GIMP. * * Return value: TRUE on successful creation and attachment of * the new parasite. * * See Also: gimp_drawable_parasite_attach() */ gboolean gimp_drawable_attach_new_parasite (gint32 drawable_ID, const gchar *name, gint flags, gint size, gconstpointer data) { GimpParasite *parasite = gimp_parasite_new (name, flags, size, data); gboolean success; success = gimp_drawable_parasite_attach (drawable_ID, parasite); gimp_parasite_free (parasite); return success; }