void hb_title_close( hb_title_t ** _t )
{
hb_title_t * t = *_t;
+ hb_audio_t * audio;
+ hb_chapter_t * chapter;
+ hb_subtitle_t * subtitle;
+ while( ( audio = hb_list_item( t->list_audio, 0 ) ) )
+ {
+ hb_list_rem( t->list_audio, audio );
+ free( audio );
+ }
hb_list_close( &t->list_audio );
+
+ while( ( chapter = hb_list_item( t->list_chapter, 0 ) ) )
+ {
+ hb_list_rem( t->list_chapter, chapter );
+ free( chapter );
+ }
hb_list_close( &t->list_chapter );
+
+ while( ( subtitle = hb_list_item( t->list_subtitle, 0 ) ) )
+ {
+ hb_list_rem( t->list_subtitle, subtitle );
+ free( subtitle );
+ }
hb_list_close( &t->list_subtitle );
- free( t->job );
free( t );
*_t = NULL;
{
hb_work_private_t * pv = w->private_data;
a52_free( pv->state );
+ hb_list_empty( &pv->list );
+ free( pv );
+ w->private_data = NULL;
}
/***********************************************************************
if( pv->context )
{
hb_log( "encavcodec: closing libavcodec" );
+ avcodec_flush_buffers( pv->context );
avcodec_close( pv->context );
+ free( pv->context );
}
if( pv->file )
{
fclose( pv->file );
}
+ free( pv );
+ w->private_data = NULL;
}
/***********************************************************************
faacEncClose( pv->faac );
free( pv->buf );
hb_list_empty( &pv->list );
+ free( pv );
+ w->private_data = NULL;
}
/***********************************************************************
hb_job_t * job;
x264_t * x264;
x264_picture_t pic_in;
- x264_picture_t pic_out;
char filename[1024];
};
void encx264Close( hb_work_object_t * w )
{
hb_work_private_t * pv = w->private_data;
+ x264_picture_clean( &pv->pic_in );
x264_encoder_close( pv->x264 );
+ free( pv );
+ w->private_data = NULL;
/* TODO */
}
hb_work_private_t * pv = w->private_data;
hb_job_t * job = pv->job;
hb_buffer_t * in = *buf_in, * buf;
+ x264_picture_t pic_out;
int i_nal;
x264_nal_t * nal;
int i;
pv->pic_in.i_pts = in->start;
x264_encoder_encode( pv->x264, &nal, &i_nal,
- &pv->pic_in, &pv->pic_out );
+ &pv->pic_in, &pic_out );
/* Should be way too large */
buf = hb_buffer_init( 3 * job->width * job->height / 2 );
/* For IDR (key frames), buf->key = 1,
and the same for regular I-frames. */
- if( (pv->pic_out.i_type == X264_TYPE_IDR) || (pv->pic_out.i_type == X264_TYPE_I) )
+ if( (pic_out.i_type == X264_TYPE_IDR) || (pic_out.i_type == X264_TYPE_I) )
{
buf->key = 1;
}
/* For B-frames, buf->key = 2 */
- else if( (pv->pic_out.i_type == X264_TYPE_B) )
+ else if( (pic_out.i_type == X264_TYPE_B) )
{
buf->key = 2;
}
However, it doesn't seem to ever be used...
They just show up as buf->key == 2 like
regular b-frames. */
- else if( (pv->pic_out.i_type == X264_TYPE_BREF) )
+ else if( (pic_out.i_type == X264_TYPE_BREF) )
{
buf->key = 3;
}
/* Store the output presentation time stamp
from x264 for use by muxmp4 in off-setting
b-frames with the CTTS atom. */
- buf->encodedPTS = pv->pic_out.i_pts;
+ buf->encodedPTS = pic_out.i_pts;
buf->size += size;
}
/* Copy the job */
job_copy = calloc( sizeof( hb_job_t ), 1 );
memcpy( job_copy, job, sizeof( hb_job_t ) );
+ title_copy->job = job_copy;
job_copy->title = title_copy;
job_copy->file = strdup( job->file );
job_copy->h = h;
while( ( title = hb_list_item( h->list_title, 0 ) ) )
{
hb_list_rem( h->list_title, title );
+ free( title->job );
hb_title_close( &title );
}
hb_list_close( &h->list_title );
hb_buffer_close( &r->ps );
hb_dvd_stop( r->dvd );
hb_dvd_close( &r->dvd );
+ free( r );
+ _r = NULL;
hb_log( "reader: done" );
}
void renderClose( hb_work_object_t * w )
{
+ hb_work_private_t * pv = w->private_data;
+
+ img_resample_close( pv->context );
+ free( pv );
+ w->private_data = NULL;
}
int renderInit( hb_work_object_t * w, hb_job_t * job )
hb_log( "scan: title %d is duplicate with title %d",
title->index, title_tmp->index );
hb_list_rem( data->list_title, title );
- free( title );
+ free( title ); /* This _will_ leak! */
continue;
}
{
hb_dvd_close( &data->dvd );
}
+ free( data->path );
+ free( data );
+ _data = NULL;
}
/***********************************************************************
src_delete( pv->sync_audio[i].state );
}
}
+
+ free( pv );
+ w->private_data = NULL;
}
/***********************************************************************
w = NULL;
}
}
+
+ hb_list_close( &job->list_work );
/* Stop read & write threads */
hb_thread_close( &job->reader );
hb_fifo_close( &audio->fifo_sync );
hb_fifo_close( &audio->fifo_out );
}
+
+ hb_title_close( &job->title );
+ free( job );
}
/**