-
Notifications
You must be signed in to change notification settings - Fork 303
Description
I'm currently struggling a bit with Frame's API.
https://openshot.org/files/libopenshot/classopenshot_1_1Frame.html
(I'll try to summarize the issues I have, but it may take a few edits over the next hours / days even :) )
We have constructors:
- a default constructor
- an image only constructor
- an audio only constructor
- image and audio construtor
We have public data members:
- two flags for whether there's audio / image data
- the frame number
There are member functions to "Add" to the frame:
- AddAudio
- AddAudioSilence
- AddColor
- AddImage
- AddMagickImage
There are member functions to "query" (sometimes not only ...) stuff of the frame:
- ChannelsLayout
- CheckPixel
- GetAudioChannelsCount
- GetAudioSample
- GetAudioSampleBuffer
- GetAudioSamples
- GetAudioSamplesCount
- GetBytes
- GetWidth
- GetHeight
- GetPixels
- GetPixelRatio
- GetImage
- GetMagickImage
- GetPlanarAudioSamples
- GetInterleavedAudioSamples
- GetSamplesPerFrame
- GetWaveform
- GetWaveformPixels
- SampleRate
Then there are a few "modifying" member functions:
- SampleRate
- SetFrameNumber
- SetPixelRatio
- ResizeAudio
- ChannelsLayout
- ApplyGainRamp
Finally there are member functions which "do" things, e.g. for debugging:
- ClearWaveform
- DeepCopy
- Display
- DisplayWaveform
- Play
- Thumbnail
I hope I didn't forget a member function.
All in all this is ... a lot .. for a "container" of audio and image data. Furthermore, some of these functions do more than they're advertising, e.g. GetPixels() creating image data if there's none, whereas GetPixels(0) /* a row */ just crashes when there's no image data.
Which of these functions are actually used? Or rather: Where should I look for the "main" user of frames? Which (undocumented) side effects are actually used? Is Frame used directly from OpenShot?
I think Frame would greatly benefit from a bit cleanup work :)
Related: #446