diff options
author | jstebbins <[email protected]> | 2015-03-29 16:22:30 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-03-29 16:22:30 +0000 |
commit | 8e9bff8f32423c3ac69986bb3e4d03300d41dd4e (patch) | |
tree | a31260ce3ac5fc295f93f48ca2f7136563aa4455 /libhb/stream.c | |
parent | 168ce686fd837de7fbf20266df31af2ac00c8db1 (diff) |
libhb: Eliminate global variable hb_gui_use_hwd_flag
This global was shared between the CLI and libhb and used as a back door to
force scan and encode passes to use the same ffmpeg context for hardware
decoding. Aside from the fact that this context sharing should not be necessary
and needs fixing, this information belongs in the hb_handle_t that is shared
between the scan and the encode. So put it there and make sure the hb_handle_t
get propagated to where the flag is needed.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7028 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/stream.c')
-rw-r--r-- | libhb/stream.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/libhb/stream.c b/libhb/stream.c index 9d01c1d00..d8da41153 100644 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -144,6 +144,8 @@ typedef struct { struct hb_stream_s { + hb_handle_t * h; + int scan; int frames; /* video frames so far */ int errors; /* total errors so far */ @@ -609,10 +611,6 @@ static int hb_stream_get_type(hb_stream_t *stream) if ( fread(buf, 1, sizeof(buf), stream->file_handle) == sizeof(buf) ) { -#ifdef USE_HWD - if ( hb_gui_use_hwd_flag == 1 ) - return 0; -#endif int psize; if ( ( psize = hb_stream_check_for_ts(buf) ) != 0 ) { @@ -813,7 +811,8 @@ static void prune_streams(hb_stream_t *d) *********************************************************************** * **********************************************************************/ -hb_stream_t * hb_stream_open( char *path, hb_title_t *title, int scan ) +hb_stream_t * +hb_stream_open(hb_handle_t *h, char *path, hb_title_t *title, int scan) { FILE *f = hb_fopen(path, "rb"); if ( f == NULL ) @@ -839,13 +838,14 @@ hb_stream_t * hb_stream_open( char *path, hb_title_t *title, int scan ) * If it's something we can deal with (MPEG2 PS or TS) return a stream * reference structure & null otherwise. */ + d->h = h; d->file_handle = f; d->title = title; d->scan = scan; d->path = strdup( path ); if (d->path != NULL ) { - if ( hb_stream_get_type( d ) != 0 ) + if (!hb_hwd_enabled(d->h) && hb_stream_get_type( d ) != 0 ) { if( !scan ) { @@ -925,7 +925,7 @@ static int new_pes( hb_stream_t * stream ) return num; } -hb_stream_t * hb_bd_stream_open( hb_title_t *title ) +hb_stream_t * hb_bd_stream_open( hb_handle_t *h, hb_title_t *title ) { int ii; @@ -936,6 +936,7 @@ hb_stream_t * hb_bd_stream_open( hb_title_t *title ) return NULL; } + d->h = h; d->file_handle = NULL; d->title = title; d->path = NULL; @@ -3924,10 +3925,10 @@ static void hb_ps_stream_find_streams(hb_stream_t *stream) hb_buffer_close( &buf ); } -static int probe_dts_profile( hb_pes_stream_t *pes ) +static int probe_dts_profile( hb_stream_t *stream, hb_pes_stream_t *pes ) { hb_work_info_t info; - hb_work_object_t *w = hb_codec_decoder( pes->codec ); + hb_work_object_t *w = hb_codec_decoder( stream->h, pes->codec ); w->codec_param = pes->codec_param; int ret = w->bsinfo( w, pes->probe_buf, &info ); @@ -3967,7 +3968,7 @@ static int probe_dts_profile( hb_pes_stream_t *pes ) return 1; } -static int do_probe( hb_pes_stream_t *pes, hb_buffer_t *buf ) +static int do_probe(hb_stream_t *stream, hb_pes_stream_t *pes, hb_buffer_t *buf) { // Check upper limit of per stream data to probe if ( pes->probe_buf == NULL ) @@ -3994,7 +3995,7 @@ static int do_probe( hb_pes_stream_t *pes, hb_buffer_t *buf ) if ( pes->codec == HB_ACODEC_DCA_HD ) { // We need to probe for the profile of DTS audio in this stream. - return probe_dts_profile( pes ); + return probe_dts_profile( stream, pes ); } // Probing is slow, so we don't want to re-probe the probe @@ -4258,7 +4259,7 @@ static void hb_ts_resolve_pid_types(hb_stream_t *stream) hb_pes_stream_t *pes = &stream->pes.list[idx]; - if ( do_probe( pes, buf ) ) + if ( do_probe( stream, pes, buf ) ) { probe--; if ( pes->stream_kind != N ) @@ -4336,7 +4337,7 @@ static void hb_ps_resolve_stream_types(hb_stream_t *stream) hb_pes_stream_t *pes = &stream->pes.list[idx]; - if ( do_probe( pes, buf ) ) + if ( do_probe( stream, pes, buf ) ) { probe--; if ( pes->stream_kind != N ) |