summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libhb/decavcodec.c7
-rw-r--r--libhb/stream.c6
2 files changed, 10 insertions, 3 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index f5c46699e..abf7ed179 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -977,10 +977,11 @@ static int decavcodecvInfo( hb_work_object_t *w, hb_work_info_t *info )
if ( info->pixel_aspect_width == 0 ||
info->pixel_aspect_height == 0 )
{
+ // There will not be an ffmpeg stream if the file is TS
AVStream *st = hb_ffmpeg_avstream( w->codec_param );
- info->pixel_aspect_width = st->sample_aspect_ratio.num ?
- st->sample_aspect_ratio.num : 1;
- info->pixel_aspect_height = st->sample_aspect_ratio.den ?
+ info->pixel_aspect_width = st && st->sample_aspect_ratio.num ?
+ st->sample_aspect_ratio.num : 1;
+ info->pixel_aspect_height = st && st->sample_aspect_ratio.den ?
st->sample_aspect_ratio.den : 1;
}
/* ffmpeg returns the Pixel Aspect Ratio (PAR). Handbrake wants the
diff --git a/libhb/stream.c b/libhb/stream.c
index 9166ace41..58b2506f0 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -2875,6 +2875,9 @@ static void ffmpeg_remap_stream( hb_stream_t *stream, hb_title_t *title )
void *hb_ffmpeg_context( int codec_param )
{
+ if ( ffmpeg_streams == NULL )
+ return NULL;
+
int slot = codec_param & (ffmpeg_sl_size - 1);
int stream_index = codec_param >> ffmpeg_sl_bits;
return ffmpeg_streams[slot]->ffmpeg_ic->streams[stream_index]->codec;
@@ -2882,6 +2885,9 @@ void *hb_ffmpeg_context( int codec_param )
void *hb_ffmpeg_avstream( int codec_param )
{
+ if ( ffmpeg_streams == NULL )
+ return NULL;
+
int slot = codec_param & (ffmpeg_sl_size - 1);
int stream_index = codec_param >> ffmpeg_sl_bits;
return ffmpeg_streams[slot]->ffmpeg_ic->streams[stream_index];