1
1
#include " VideoProperties.hpp"
2
2
3
- #include < AvTranscoder/data/decoded/Frame.hpp>
4
3
#include < AvTranscoder/properties/util.hpp>
5
4
#include < AvTranscoder/properties/FileProperties.hpp>
6
5
#include < AvTranscoder/progress/NoDisplayProgress.hpp>
@@ -342,7 +341,7 @@ size_t VideoProperties::getBitRate() const
342
341
// discard no frame type when decode
343
342
_codecContext->skip_frame = AVDISCARD_NONE;
344
343
345
- Frame frame ;
344
+ AVFrame avFrame ;
346
345
AVPacket pkt;
347
346
av_init_packet (&pkt);
348
347
avcodec_open2 (_codecContext, _codec, NULL );
@@ -357,11 +356,10 @@ size_t VideoProperties::getBitRate() const
357
356
{
358
357
if (pkt.stream_index == (int )_streamIndex)
359
358
{
360
- avcodec_decode_video2 (_codecContext, &frame. getAVFrame () , &gotFrame, &pkt);
359
+ avcodec_decode_video2 (_codecContext, &avFrame , &gotFrame, &pkt);
361
360
if (gotFrame)
362
361
{
363
362
// check distance between key frames
364
- AVFrame& avFrame = frame.getAVFrame ();
365
363
if (avFrame.pict_type == AV_PICTURE_TYPE_I)
366
364
{
367
365
if (positionOfFirstKeyFrame == -1 )
@@ -375,7 +373,7 @@ size_t VideoProperties::getBitRate() const
375
373
if (positionOfLastKeyFrame == -1 )
376
374
{
377
375
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(54, 7, 100)
378
- gopFramesSize += frame. getEncodedSize ( );
376
+ gopFramesSize += av_frame_get_pkt_size (&avFrame );
379
377
#else
380
378
gopFramesSize += pkt.size ;
381
379
#endif
@@ -567,7 +565,7 @@ void VideoProperties::analyseGopStructure(IProgress& progress)
567
565
// Initialize the AVCodecContext to use the given AVCodec
568
566
avcodec_open2 (_codecContext, _codec, NULL );
569
567
570
- Frame frame ;
568
+ AVFrame avFrame ;
571
569
size_t count = 0 ;
572
570
int gotFrame = 0 ;
573
571
int positionOfFirstKeyFrame = -1 ;
@@ -577,13 +575,11 @@ void VideoProperties::analyseGopStructure(IProgress& progress)
577
575
{
578
576
if (pkt.stream_index == (int )_streamIndex)
579
577
{
580
- avcodec_decode_video2 (_codecContext, &frame. getAVFrame () , &gotFrame, &pkt);
578
+ avcodec_decode_video2 (_codecContext, &avFrame , &gotFrame, &pkt);
581
579
if (gotFrame)
582
580
{
583
- AVFrame& avFrame = frame.getAVFrame ();
584
-
585
581
_gopStructure.push_back (
586
- std::make_pair (av_get_picture_type_char (avFrame.pict_type ), frame. getEncodedSize ( )));
582
+ std::make_pair (av_get_picture_type_char (avFrame.pict_type ), av_frame_get_pkt_size (&avFrame )));
587
583
_isInterlaced = avFrame.interlaced_frame ;
588
584
_isTopFieldFirst = avFrame.top_field_first ;
589
585
if (avFrame.pict_type == AV_PICTURE_TYPE_I)
0 commit comments