valbok / QtAVPlayer

Free and open-source Qt Media Player library based on FFmpeg, for Linux, Windows, macOS, iOS and Android.
MIT License
282 stars 54 forks source link

Questions on the widget example #489

Closed Ljiaooo closed 1 month ago

Ljiaooo commented 1 month ago

Hi, valbok! Thanks for your awasome work. I'm a little bit confused about several lines in the widget example main.cpp file.

At line 113 and 123 , frame.converTo() returns a QAVVideoFrame object, why this object can be assigned to a QVideoFrame object? Does the QVideoFrame have a constructor that can take value from QVVideoFrame?

valbok commented 1 month ago

@Ljiaooo Thanks for your interest!

QVideoFrame videoFrame = frame.convertTo(AV_PIX_FMT_RGB32);
  1. frame.convertTo(AV_PIX_FMT_RGB32) reutrns new QAVVideoFrame
  2. QAVVideoFrame could be casted/converted to QVideoFrame implicitly using https://github.com/valbok/QtAVPlayer/blob/master/src/QtAVPlayer/qavvideoframe.h#L68
Ljiaooo commented 1 month ago

I got it. Thanks for your replay!