mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-12 01:40:04 +01:00
lavc: add avcodec_is_open().
It allows to check whether an AVCodecContext is open in a documented way. Right now the undocumented way this check is done in lavf/lavc is by checking whether AVCodecContext.codec is NULL. However it's desirable to be able to set AVCodecContext.codec before avcodec_open2().
This commit is contained in:
@@ -2006,7 +2006,7 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
|
||||
AVFrame picture;
|
||||
AVPacket pkt = *avpkt;
|
||||
|
||||
if(!st->codec->codec){
|
||||
if (!avcodec_is_open(st->codec)) {
|
||||
AVDictionary *thread_opt = NULL;
|
||||
|
||||
codec = avcodec_find_decoder(st->codec->codec_id);
|
||||
@@ -2354,8 +2354,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
||||
// close codecs which were opened in try_decode_frame()
|
||||
for(i=0;i<ic->nb_streams;i++) {
|
||||
st = ic->streams[i];
|
||||
if(st->codec->codec)
|
||||
avcodec_close(st->codec);
|
||||
avcodec_close(st->codec);
|
||||
}
|
||||
for(i=0;i<ic->nb_streams;i++) {
|
||||
st = ic->streams[i];
|
||||
|
||||
Reference in New Issue
Block a user