ffmpeginteropx / FFmpegInteropX

FFmpeg decoding library for Windows 10 UWP and WinUI 3 Apps
Apache License 2.0
212 stars 53 forks source link

C++/winRT migration #269

Closed brabebhin closed 2 years ago

brabebhin commented 2 years ago

Hi all,

This is the PR for migrating the library to C++/winRT. The migration currently exists as a separate project, with a separate namespace, but this is just nicities for later.

What happened here, in a nuttshell:

  1. All classes that were not needed to be winRT classes have been moved to vanila C++ (mostly sample providers and other low level stuff that integrates with FFMPEG).
  2. There is still some work to be done on the hardware accelerated video effect (haven't migrated that but it should be mostly mechanical work).
  3. Need to fix all bugs and test this well.

Some additional breaking changes:

  1. Metadata tags are now returned as Map<string, Vector> instead of Vector<KeyValuePair<string, string>>. Mostly a small difference. What do you think, @lukasf @JunielKatarn ?
brabebhin commented 2 years ago

Sorry I was out and about the past few days. I see what you mean with the AttachedFile, however, that api has been public for quite some time. Changing it would be a breaking change.

lukasf commented 2 years ago

That's true. But since there was no way to create it (no public ctor, no other API), I would not really consider this a breaking change. I have created a PR to remove it from old implementation as well.

brabebhin commented 2 years ago

TBH I never used that API since we merged it the first time around.

lukasf commented 2 years ago

Proudly presenting my first template method, see end of pch.h ^^

That one was difficult to get right. It creates a weak referenced proxy delegate, so even normal C++ classes can easily use weak event handlers, without any boilerplate code. The class must inherit enable_shared_from_this.

C++/WinRT classes can use get_weak() or get_strong() to decide lifetime behavior for event handlers. We should never pass this to an event handler registration, because that is dangerous.

brabebhin commented 2 years ago

Nice work! Surely trumps my template method in pch.

If i remember correctly, i only used one event handler with weak references, can't remember which one

lukasf commented 2 years ago

For me this is looking all good now. Maybe a little final testing and we are good to merge.

brabebhin commented 2 years ago

Cool. I will give it some short tests over the weekend.

On a side note: biggest PR yet?

brabebhin commented 2 years ago

Looking good for me.

lukasf commented 2 years ago

We are on master now. Nice work!

MouriNaruto commented 2 years ago

Really good to see this work.

Kenji Mouri