// that causes the problem. since hb_stream_seek_chapter
// is called before we start reading, make sure
// we do a seek here.
- av_seek_frame( stream->ffmpeg_ic, -1, ffmpeg_initial_timestamp( stream ), AVSEEK_FLAG_BACKWARD );
+ av_seek_frame( stream->ffmpeg_ic, -1, ffmpeg_initial_timestamp( stream ), AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY );
}
return 1;
}
return -1;
}
-static const char* make_upper( const char* s )
-{
- static char name[8];
- char *cp = name;
- char *ep = cp + sizeof(name)-1;
-
- while ( *s && cp < ep )
- {
- *cp++ = islower(*s)? toupper(*s) : *s;
- ++s;
- }
- *cp = 0;
- return name;
-}
-
static void set_audio_description( hb_audio_t *audio, iso639_lang_t *lang )
{
/* XXX
( cc = hb_ffmpeg_context( audio->config.in.codec_param ) ) &&
avcodec_find_decoder( cc->codec_id ) )
{
- codec_name = make_upper( avcodec_find_decoder( cc->codec_id )->name );
- if ( !strcmp( codec_name, "LIBFAAD" ) )
+ AVCodec *codec = avcodec_find_decoder( cc->codec_id );
+ codec_name = codec->name;
+ if ( !strcmp( codec_name, "DCA" ) )
{
- codec_name = "AAC";
+ codec_name = "DTS";
+ }
+
+ char *profile_name;
+ profile_name = av_get_profile_name( codec, cc->profile );
+ if ( profile_name )
+ {
+ codec_name = profile_name;
}
}
else if ( audio->config.in.codec == HB_ACODEC_MPGA &&
// we're opening for scan. let ffmpeg put some info into the
// log about what we've got.
av_log_set_level( AV_LOG_INFO );
- dump_format( ic, 0, stream->path, 0 );
+ av_dump_format( ic, 0, stream->path, 0 );
av_log_set_level( AV_LOG_ERROR );
// accept this file if it has at least one video stream we can decode
{
audio->config.in.codec = HB_ACODEC_AC3;
}
- else if ( codec->codec_id == CODEC_ID_DTS )
+ else if ( codec->codec_id == CODEC_ID_DTS &&
+ ( codec->profile == FF_PROFILE_DTS ||
+ codec->profile == FF_PROFILE_DTS_ES ||
+ codec->profile == FF_PROFILE_DTS_96_24 ) )
{
audio->config.in.codec = HB_ACODEC_DCA;
}
again:
if ( ( err = av_read_frame( stream->ffmpeg_ic, stream->ffmpeg_pkt )) < 0 )
{
+ // av_read_frame can return EAGAIN. In this case, it expects
+ // to be called again to get more data.
+ if ( err == AVERROR(EAGAIN) )
+ {
+ goto again;
+ }
// XXX the following conditional is to handle avi files that
// use M$ 'packed b-frames' and occasionally have negative
// sizes for the null frames these require.