*_t = NULL;
}
+/**********************************************************************
+ * hb_filter_close
+ **********************************************************************
+ *
+ *********************************************************************/
+void hb_filter_close( hb_filter_object_t ** _f )
+{
+ hb_filter_object_t * f = *_f;
+
+ f->close( f->private_data );
+
+ if( f->name )
+ free( f->name );
+ if( f->settings )
+ free( f->settings );
+
+ free( f );
+ *_f = NULL;
+}
+
job_copy->filters = hb_list_init();
for( i = 0; i < filter_count; i++ )
{
+ /*
+ * Copy the filters, since the MacGui reuses the global filter objects
+ * meaning that queued up jobs overwrite the previous filter settings.
+ * In reality, settings is probably the only field that needs duplicating
+ * since it's the only value that is ever changed. But name is duplicated
+ * as well for completeness. Not copying private_data since it gets
+ * created for each job in renderInit.
+ */
hb_filter_object_t * filter = hb_list_item( job->filters, i );
- hb_list_add( job_copy->filters, filter );
+ hb_filter_object_t * filter_copy = malloc( sizeof( hb_filter_object_t ) );
+ memcpy( filter_copy, filter, sizeof( hb_filter_object_t ) );
+ if( filter->name )
+ filter_copy->name = strdup( filter->name );
+ if( filter->settings )
+ filter_copy->settings = strdup( filter->settings );
+ hb_list_add( job_copy->filters, filter_copy );
}
}
hb_title_t * hb_title_init( char * dvd, int index );
void hb_title_close( hb_title_t ** );
+void hb_filter_close( hb_filter_object_t ** );
+
/***********************************************************************
* hb.c
**********************************************************************/
hb_fifo_close( &pv->delay_queue );
}
- /* Cleanup filters */
- /* TODO: Move to work.c? */
- if( pv->job->filters )
- {
- int filter_count = hb_list_count( pv->job->filters );
- int i;
-
- for( i = 0; i < filter_count; i++ )
- {
- hb_filter_object_t * filter = hb_list_item( pv->job->filters, i );
-
- if( !filter ) continue;
-
- filter->close( filter->private_data );
- }
-
- hb_list_close( &pv->job->filters );
- }
-
/* Cleanup render work structure */
free( pv );
w->private_data = NULL;
}
if (!detelecine_present)
- hb_list_add( job->filters, &hb_filter_detelecine );
+ {
+ /* Allocate the filter. */
+ hb_filter_object_t * filter = malloc( sizeof( hb_filter_object_t ) );
+
+ /* Copy in the contents of the detelecine struct. */
+ memcpy( filter, &hb_filter_detelecine, sizeof( hb_filter_object_t ) );
+
+ /* Set the name to a copy of the template name so render.c has something to free. */
+ filter->name = strdup(hb_filter_detelecine.name);
+
+ /* Add it to the list. */
+ hb_list_add( job->filters, filter );
+ }
hb_log("work: VFR mode -- Switching FPS to 29.97 and detelecining.");
}
}
}
+ if( job->filters )
+ {
+ for( i = 0; i < hb_list_count( job->filters ); i++ )
+ {
+ hb_filter_object_t * filter = hb_list_item( job->filters, i );
+ hb_filter_close( &filter );
+ }
+ hb_list_close( &job->filters );
+ }
+
hb_buffer_pool_free();
hb_title_close( &job->title );