File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/AvTranscoder/properties Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -490,14 +490,16 @@ void VideoProperties::analyseGopStructure(IProgress& progress)
490
490
_codecContext->skip_frame = AVDISCARD_NONE;
491
491
492
492
AVPacket pkt;
493
+ av_init_packet (&pkt);
493
494
495
+ // Allocate frame
494
496
#if LIBAVCODEC_VERSION_MAJOR > 54
495
497
AVFrame* frame = av_frame_alloc ();
496
498
#else
497
499
AVFrame* frame = avcodec_alloc_frame ();
498
500
#endif
499
501
500
- av_init_packet (&pkt);
502
+ // Initialize the AVCodecContext to use the given AVCodec
501
503
avcodec_open2 (_codecContext, _codec, NULL );
502
504
503
505
int count = 0 ;
@@ -531,6 +533,11 @@ void VideoProperties::analyseGopStructure(IProgress& progress)
531
533
if (stopAnalyse)
532
534
break ;
533
535
}
536
+
537
+ // Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext itself)
538
+ avcodec_close (_codecContext);
539
+
540
+ // Free frame
534
541
#if LIBAVCODEC_VERSION_MAJOR > 54
535
542
av_frame_free (&frame);
536
543
#else
You can’t perform that action at this time.
0 commit comments