Recent

Author Topic: SDL vs. SDL2  (Read 3737 times)

metis

  • Sr. Member
  • ****
  • Posts: 300
SDL vs. SDL2
« on: September 28, 2018, 01:55:31 pm »
Hi all !

I wrote a FFmpeg-MediaPlayer for Lazarus, that (still) uses SDL v1, see 'FFPlay4Laz':
http://forum.lazarus.freepascal.org/index.php/topic,26666.0.html.
More precisely, it uses SDL-Timer, SDL-Audio, SDL-Video and SDL-Events (Screen-, Mouse- and KeyEvents).

I'm not sure, if Updating to SDL2 would really mean a big Advantage for me, because...
- For High-Precision Timing, I use FFmpeg-Timebases, which is more precise than SDL
- SDL1's VideoQuality is sufficient for most Videos & Movies - no 3D-Rendering needed
- SDL2's improved AudioQuality (Int16 -> Int32/Float32) is not so important for me, because
  I use PortAudio for enhanced AudioQuality, anyway.

-> Question:
When, for whom, for which Kind of Application, for which OS/Platform is it really worth Updating to SDL2 (apart from Gaming) ?
« Last Edit: September 06, 2020, 02:57:10 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

sash

  • Sr. Member
  • ****
  • Posts: 366
Re: SDL vs. SDL2
« Reply #1 on: September 28, 2018, 02:17:47 pm »
Quote
When, for whom, for which Kind of Application, for which OS/Platform is it really worth Updating to SDL2 (apart from Gaming) ?

Simple common sense tells us sooner or later sdl1 will be deprecated in favor of sdl2. IIRC something in sdl1 already does not work on Mac and Android.
Lazarus 2.0.10 FPC 3.2.0 x86_64-linux-gtk2 @ Ubuntu 20.04 XFCE

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: SDL vs. SDL2
« Reply #2 on: October 22, 2018, 12:41:39 pm »
Anything more detailed beyond common sense ?
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: SDL vs. SDL2
« Reply #3 on: August 30, 2020, 06:01:48 pm »
In the Meantime, I started Updating the entire FFmpeg-Player to SDL2, see:
https://forum.lazarus.freepascal.org/index.php/topic,26666.msg373185.html#msg373185

MainReasons for me to migrate to SDL2:
- Hardware accelerated Texture based 2D-Rendering; SDL1 has only software-rendered Surfaces
  (Why better? - see: https://www.reddit.com/r/gamedev/comments/6jfzf2/in_sdl2_what_is_the_difference_between_a_texture/)
- new WindowFunctions, like 'SDL_WINDOWPOS_CENTERED()', 'SDL_SetWindowPosition()', 'SDL_GetWindowPosition()'
  (with SDL1 I had to do all WindowManipulations with the Windows-API)
- it's much easier to make the Player cross-platform, in General
- it's much easier to implement some new PlayerFeatures, like Rotate/Flip the VideoImage and Touchscreen-Support.

In the Following some Points, that "simple common sense" could'n tell me (sorry)...  ::)

Here is, what SDL2 does:
https://wiki.libsdl.org/Introduction
-> GoTo "1.2. What can SDL do?" and "1.3. What platforms does SDL run on?"

And, here are the MainDifferences between SDL1 and SDL2:
https://wiki.libsdl.org/MigrationGuide
-> GoTo "Overview of new features - These are the most important new features in SDL 2.0".
(some Details are explained in the Text below.)

Finally, some special Differences:
https://www.doomworld.com/forum/topic/86368-sdl-1x-vs-sdl-2/
-> GoTo "... new issues which press the case for SDL2 migration, ..."
« Last Edit: February 21, 2023, 07:07:18 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

jamie

  • Hero Member
  • *****
  • Posts: 6077
Re: SDL vs. SDL2
« Reply #4 on: August 30, 2020, 10:55:12 pm »
can that be linked in to an app so I wouldn't need to run it via TProcess and use  Rediretions ?
The only true wisdom is knowing you know nothing

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: SDL vs. SDL2
« Reply #5 on: August 31, 2020, 09:32:50 pm »
@jamie

Quote
can that be linked in to an app so I wouldn't need to run it via TProcess and use  Rediretions ?
Yes - see here for how to do it:
https://forum.lazarus.freepascal.org/index.php/topic,26666.msg337046.html#msg337046
-> GoTo "LCL-Test&Demo-GUI ... The GUI demonstrates how to use the FFPlay4Laz-API".

For how it's done, take a Look at that MediaPlayer's BasicStructure (Projectname: 'FFPlay4Laz').
It shows, how to use SDL-Threads, -UserEvents, -Timer, -Keyboard-Input, -Audio-/Video-Output, for
- SDL1: https://forum.lazarus.freepascal.org/index.php/topic,26666.msg196377.html#msg196377
  -> Download attached 'DrangerTutorial08.c2FPC.lpr.zip', and for
- SDL2: https://forum.lazarus.freepascal.org/index.php/topic,26666.msg373185.html#msg373185
  -> Download attached 'FPlay4Laz2_MINIMALST.7z'.

For, where to learn, how it's done, see...

> SDL-Tutorials for FPC by 'Free Pascal meets SDL' (= the Basics, very well explained for SDL-Beginners):
   SDL1+SDL2: https://www.freepascal-meets-sdl.net/sdl-tutorials/

> SDL-Tutorials for C-Programming by 'Lazy Foo' Productions' (= more detailed, but C only):
   - SDL1: http://lazyfoo.net/SDL_tutorials/index.php
   - SDL2: http://lazyfoo.net/tutorials/SDL/index.php
« Last Edit: February 20, 2023, 06:37:13 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

 

TinyPortal © 2005-2018