summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2012-07-03 18:52:27 +0000
committerjstebbins <[email protected]>2012-07-03 18:52:27 +0000
commit60a18b887f11a06574c0cfb3143812ab4d5993bb (patch)
tree48a24d86b4382696df2b6b18c8b543aedf88dffd /libhb
parent1f44d43ccd158506fccb5825a586ab4c404aba5a (diff)
libhb: fix live preview crash when generating preview while encoding
GetFifoForId() was not re-entrant (it used a static array). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4809 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/reader.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/libhb/reader.c b/libhb/reader.c
index 2084a7f79..93ba869e6 100644
--- a/libhb/reader.c
+++ b/libhb/reader.c
@@ -54,12 +54,13 @@ struct hb_work_private_s
int start_found; // found pts_to_start point
int64_t pts_to_start;
uint64_t st_first;
+ hb_fifo_t * fifos[100];
};
/***********************************************************************
* Local prototypes
**********************************************************************/
-static hb_fifo_t ** GetFifoForId( hb_job_t * job, int id );
+static hb_fifo_t ** GetFifoForId( hb_work_private_t * r, int id );
static void UpdateState( hb_work_private_t * r, int64_t start);
/***********************************************************************
@@ -528,7 +529,7 @@ void ReadLoop( void * _w )
while( ( buf = hb_list_item( list, 0 ) ) )
{
hb_list_rem( list, buf );
- fifos = GetFifoForId( r->job, buf->s.id );
+ fifos = GetFifoForId( r, buf->s.id );
if ( fifos && ! r->saw_video && !r->job->indepth_scan )
{
@@ -716,15 +717,15 @@ static void UpdateState( hb_work_private_t * r, int64_t start)
***********************************************************************
*
**********************************************************************/
-static hb_fifo_t ** GetFifoForId( hb_job_t * job, int id )
+static hb_fifo_t ** GetFifoForId( hb_work_private_t * r, int id )
{
+ hb_job_t * job = r->job;
hb_title_t * title = job->title;
hb_audio_t * audio;
hb_subtitle_t * subtitle;
int i, n, count;
- static hb_fifo_t * fifos[100];
- memset(fifos, 0, sizeof(fifos));
+ memset(r->fifos, 0, sizeof(r->fifos));
if( id == title->video_id )
{
@@ -738,8 +739,8 @@ static hb_fifo_t ** GetFifoForId( hb_job_t * job, int id )
}
else
{
- fifos[0] = job->fifo_mpeg2;
- return fifos;
+ r->fifos[0] = job->fifo_mpeg2;
+ return r->fifos;
}
}
@@ -751,12 +752,12 @@ static hb_fifo_t ** GetFifoForId( hb_job_t * job, int id )
if (id == subtitle->id)
{
/* pass the subtitles to be processed */
- fifos[n++] = subtitle->fifo_in;
+ r->fifos[n++] = subtitle->fifo_in;
}
}
if ( n != 0 )
{
- return fifos;
+ return r->fifos;
}
if( !job->indepth_scan )
@@ -766,13 +767,13 @@ static hb_fifo_t ** GetFifoForId( hb_job_t * job, int id )
audio = hb_list_item( title->list_audio, i );
if( id == audio->id )
{
- fifos[n++] = audio->priv.fifo_in;
+ r->fifos[n++] = audio->priv.fifo_in;
}
}
if( n != 0 )
{
- return fifos;
+ return r->fifos;
}
}