Commit Graph

779 Commits

Author SHA1 Message Date
Augustin Cavalier f7338bb6a0 Media Kit: Fix/appease various GCC 11 warnings. 2021-11-17 18:45:35 -05:00
Adrien Destugues fb5c24d812 MediaAddOn: missing const
Pretty much all add-ons are setting this to point to a const string, so
we should make sure that nothing tries to modify it.
2021-10-09 16:38:46 +02:00
Augustin Cavalier 64e742def3 media: Declare wildcard fields const.
This is a source compatibility break from BeOS, but should not
be an ABI one (I checked, the symbols are identical.)

Also use "= {}" in the definitions of the fields. We use this
in plenty of places in the kernel, so it should be OK for GCC2.

Change-Id: Ibe05b2236d46024d7b4563ae16e1cc7140fed965
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4434
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-09-14 20:43:29 +00:00
Adrien Destugues 303187e29b Revert "Media Kit: use the B_WRITABLE flag in plugins"
This reverts hrev54422.

I'm not sure what I was trying to fix with this change. The way the
media kit is currently designed, the list of supported formats
(including for reading) comes only from writer plugins. This means it is
impossible to have a decode-only plugin currently. And the list is
called "fWriterFileFormats" but in fact is the only list used to
implement get_next_file_formats, so it should contain all formats.

This current setup works for the ffmpeg plugin, but it should be
cleaned.

This fixes Youtube playback. The problem was simply that we were not
reporting support for any of the Youtube video formats anymore.
Unfortunately, the app_server crashes when playing Youtube videos are
still there.

Change-Id: Ie5025cd48e2ab23b616bad49eec1401331ffb0ed
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4103
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Panagiotis Vasilopoulos <hello@alwayslivid.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2021-06-21 12:33:28 +00:00
Adrien Destugues 3d768367d4 DefaultMediaTheme: fix build with tracing enabled. 2021-04-15 22:51:10 +02:00
Gerasim Troeglazov 1ab6200126 DefaultMediaTheme: implement BTextParameter handling for BParameterWeb
These changes add text parameters support to DefaultMediaTheme
for the BParameterWeb class.

Change-Id: I6ec04109af73011f84bb7c1fd5210c5c8842c2cb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3828
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-04-06 20:17:52 +00:00
Máximo Castañeda 67eeb4db48 MediaExtractor: go back to 3MB min cache size
Should allow us to at least play the same files we could play before.

Fixes #16738, though not its cause

Change-Id: I2d23011696b730a891c802e8c2bfc23afe0041cf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3628
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-19 20:29:39 +00:00
Máximo Castañeda 7f9c675629 MediaExtractor: access chunk cache only when we have it
Change-Id: I533bb2e25b0756acaaa227cdd06c4067d4120066
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3622
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-01-10 22:07:16 +00:00
Adrien Destugues d753645e3f MediaExtractor: fix cache size computation for audio
Untested. If audio is not decoding well, try increasing the constant.

Change-Id: I151764e6bb3e69088904d33bfeb683bf0569bd23
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3605
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2021-01-08 14:28:41 +00:00
Alexander von Gluck IV 6b49a15b64 media_kit: Dynamic allocation of ChunkCache based on media
* The "default" of 3MiB wasn't enough for modern larger media
  formats, resulting in inability to play 4k video no matter
  how much horse power you threw at Haiku. (4k is ~8MiB)
* This dynamically calculates the ChunkCache based on the
  video framesize * 2.
* 4k video now plays smoothly on my Ryzen 1800x.

Change-Id: I65bf6bd6fa60ac3196ea70eeeb5e655d43c10bcd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3598
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2021-01-03 20:51:37 +00:00
Máximo Castañeda 80a920f65d BSoundPlayer: check for NULL node
Fixes #16683

Change-Id: I81c252b6eeaeb35cc5f33a796a7242c0965c3f27
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3546
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-12-23 19:57:32 +00:00
Máximo Castañeda 64fc5a66b1 DefaultMediaTheme: fix Slider scale
Values are using a scale of 1000, but limits are set 0..100. Very
visible in media preferencies when using balance controls for stereo
connections in the mixer: the control is shown full right at first and
the moment you touch it and the gain is updated, you only get sound from
the left channel.

Probably the root cause of #15836 and #16070.

Change-Id: I31d3b6b11a57ca99a1cc8373d9fb003f21b192b3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3445
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-11-30 20:06:16 +00:00
Adrien Destugues 10b294d85b Media Kit: use the B_WRITABLE flag in plugins
The ffmpeg plugin reports some formats as read-only. But the media kit
included them in the list of writable formats anyway.
2020-07-12 21:17:03 +02:00
Niels Sascha Reedijk 765a734ad4 Add signature to libmedia.so.
Also remove superflous data from libpackage.rdef

This should fix #15958

Change-Id: I76991030541dca12a2dfdd9282f02274a461ed2a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2561
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-05-03 18:55:57 +00:00
Adrien Destugues e6aa214527 libbe.so catalogs are not included in image
Media Kit catalog was incorrectly using "libbe.so" as a catalog name
and overwriting the catalogs for libbe.

Fixes #15904

Change-Id: Ib56045bbcf127c23ac5229981ce92d298ffd6fe5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2536
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
2020-05-01 13:49:49 +00:00
Jérôme Duval 9c9a810c41 Media Kit: BBufferCache: if not reclaimed, only mark the buffer for deletion
hrev53379 clears the buffer cache for disconnected clients, and also delete buffers.
This is too early (see #15263, media_addon_server crash), and should only happen
after the buffer is recycled. This can be resolved by abusing the fFlags field of
BBuffer to mark the buffer for deletion, and mark the buffer to be reclaimed.
Some BBuffers don't reside in the SharedBufferList, so we have to mark them as to
be reclaimed. For those in the SharedBufferList, call a new RemoveBuffer(), which
can check whether the buffer is still to be reclaimed. For reclaimed BBuffers,
delete them right away, others can be marked for deletion.
fixes #15606 #15263, possibly #15433

Change-Id: I66e94138e7e10a40d4c48e2ac042f816c79f5aab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2245
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Ryan Leavengood <leavengood@gmail.com>
2020-02-16 08:38:49 +00:00
Jérôme Duval 27fee67244 Media Kit: let launch_daemon know that media_server will quit
'Restart media services' in Media Preferences works better.

Change-Id: Ifbffdbd81ee851ae3e7d3dfd14f3d5f41ac155ce
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2240
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2020-02-14 14:24:13 +00:00
Adrien Destugues d9e196c7f5 DefaultMediaTheme: move controls to a namespace
They have generic names and are likely to conflict with other things. In
particular, there is another BPrivate::TitleView in BColumnListView,
which results in weird behavior (and me wasting days debugging things
and scratching my head) when one links libmedia before libcolumnlistview
and the wrong one ends up being called.
2019-12-26 22:54:54 +01:00
Jérôme Duval b073975e18 media: fix 64-bit debug build
Change-Id: Ie8c19fc5f067da9973cc52ec4c787a4ad36e390c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2044
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-12-21 20:33:11 +00:00
Adrien Destugues 083314c2cb Create the port pool in MediaRosterUndertaker
Follow up to #15135, which created a regression, apps would crash if
using the port pool before creating a BMediaRoster instance. Now the
port pool is entirely managed by the MediaRosterUndertaker, which is
less confusing.

Fixes the media_addon_server crash on shutdown for me as well, but I
don't remember why (I had studied the code and came to the conclusion
that this should fix it, but I don't remember the reasoning).

Fixes #15263, and regressions for apps using the port pool before they
instanciate the BMediaRoster.

Change-Id: I887dbc590d8ee9de391b6eae0206944bfe99325f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1897
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
2019-10-05 21:09:43 +00:00
Ryan Leavengood 472d26a3c0 Media Kit: Delete the PortPool in a more deliberate way
Letting it get deleted statically can cause segfaults since it is needed for
some final quit messages.

This mimic changes Axel made for the DormantNodeManager and
TimeSourceObjectManager.

I also pulled PortPool into its own file and header.

Fixes #15135.

Change-Id: Ie64753e1876d58b52f7cb95536c6be3df2e6d40c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1721
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-08-16 23:55:07 +00:00
Ryan Leavengood fe08f0b3d0 Media Kit: Clear the BufferCache of buffers for disconnected clients
Without this, the BufferCache keeps a reference to these buffers inside the
media_addon_server until the media_addon_server quits, which is pretty much
never.

Should fix #4954 and #14755, and possibly #13614 and #14047, though I think
they may be something else.

Switched from std::map to our HashMap to get something which works in gcc2 and
gcc8.

Change-Id: I26463899724b9d1520d97fec785e435f536eaf3d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1717
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-08-16 03:56:27 +00:00
Augustin Cavalier 2c4232b853 BMediaRoster: Mark publishing areas as cloneable. 2019-08-14 20:06:30 -04:00
Augustin Cavalier 964cab4615 media: Set B_CLONEABLE_AREA where applicable.
Cloning cloned buffers seems especially strange, but
apparently it is actually done. The buffer management
code really needs to be cleaned up...
2019-08-10 17:55:27 -04:00
Augustin Cavalier 565155afa1 Remove unnecessary usages of BLocker::Sem().
Most of these should have been BLocker::InitCheck() anyway.
The one that was actually using the sem (MessageLooper)
should just store the name parameter, which simplifies
things anyway.

Done as a result of a branch where I'm experimenting
with making BLocker not even create a semaphore in
"benaphore" mode.
2019-07-27 18:31:58 -04:00
Adrien Destugues 6967695c4e PVS V547: always false comparisons
Change-Id: I1c7790ff0aa537b974bdc0fd65d76f277ea5f8cf
Reviewed-on: https://review.haiku-os.org/c/1647
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-07-27 15:16:31 +00:00
Adrien Destugues fcf7cbe79e PVS V522: null pointer dereferences
Change-Id: Iaa753ef3a93c36031789a85f87e569fc410d3304
Reviewed-on: https://review.haiku-os.org/c/1604
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-16 20:44:32 +00:00
Adrien Destugues 16d463ae1d PVS V501: redundant checks
There are some more in telnetd and agg but I'm not sure if they are
intentional, the code is so ugly there.

Change-Id: I9cc2bf8a919c3b1d6c68f2ded8622730497b0f91
Reviewed-on: https://review.haiku-os.org/c/1598
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-16 20:33:24 +00:00
Adrien Destugues ca68cae76f PluginManager: remove unneeded buffering.
The plugin manager was attempting to buffer the IOs. However, the ffmpeg
plugin already handles this (it reads in 64K chunks, the same size as
the buffer here, so this buffering was effectively useless), and the
media extractor already runs the decoding in a separate thread thanks to
the chunk cache. So, we do not need an extra level of buffering here.

We should leave any extra buffering to the upper layers (BMediaTrack or
Media Extractor), if it's needed, as they would have much more control
on the creation of the data io object.

Change-Id: I65b67919da107c8b910dd08f8cdb8e3745af92c7
Reviewed-on: https://review.haiku-os.org/c/1588
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-13 16:14:01 +00:00
Adrien Destugues 727e49c611 Media Kit: remove MediaExtractor::Source
The idea was that the Media Extractor could wrap the original source
given by BMediaTrack, but all operations on the data go through
MediaExtractor anyway.
We could probably move ownership of the BDataIO completely into
MediaExtractor instead.

Change-Id: I846b34b543fb983e60f6adf86cb17e835303267b
Reviewed-on: https://review.haiku-os.org/c/1587
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-07-13 16:14:01 +00:00
Augustin Cavalier 218a8c03cb Revert the Codec Kit.
All of Barrett's individual reverts have been squashed into this
one commit, save a few actual bugfixes.

Change-Id: Ib0a7d0a841d3ac40b1fca7372c58b7f9229bd1f0
2019-05-17 14:43:32 -04:00
Augustin Cavalier 1e60bdeab6 Remove all invocations of SetSubDirSupportedPlatformsBeOSCompatible. 2019-03-30 15:19:38 -04:00
Barrett17 662583b300 MediaStreamer: Extend API to support DVD navigation
* This is a general review of the code and includes a rework
 of the sniffing API.
2019-02-21 16:39:58 +01:00
Augustin Cavalier a396188f23 BSound: Add explicit cast to bigtime_t.
Fixes the GCC2 build.
2019-02-01 11:30:08 -05:00
CodeforEvolution aad79bda85 Implement Duration() in BSound
Change-Id: I45244cd958acd7856a065af01625d2164b9ad033
Reviewed-on: https://review.haiku-os.org/c/963
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-02-01 15:49:07 +00:00
Augustin Cavalier 4bf8cf7a1b DefaultMediaTheme: Properly set control targets.
In removing the "GroupView" class and replacing it with a real BGroupView,
I missed that it its AttachedToWindow() implementation iterated over all
child controls and set their targets to themselves. It seems this is how
the Media Kit gets change messages from them, and so the lack of this
broke changing parameter values. Whoops.

But it seems that changing menu option values has been broken for a long time
(perhaps forever?), as in order for a BOptionPopUp to send messages to anything,
its AttachedToWindow() must be called (as this sets the BMenuItem's targets
to itself, so it can forward the messages.) So now that is fixed too.
2019-01-26 15:36:43 -05:00
Augustin Cavalier 9e7d077d1b Media Kit: Remove DynamicScrollView from DefaultMediaTheme.
As of the last commit, a BScrollView in layouted mode now behaves
this way by default.

Change-Id: I07bd17d6d20e494c0e2f08172c0d54b10fa5d26d
Reviewed-on: https://review.haiku-os.org/c/893
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-01-24 18:52:39 +00:00
Augustin Cavalier a4f5124fcc Media Kit: Rewrite DefaultMediaTheme to use layouts.
The old fixed-rect method was very error-prone in corner-cases,
resulting in half-visible (cut off) parameters, incorrectly
sized controls, etc. on various devices, which often made it
impossible to use.

While there are still a few rough edges (scrollbar behavior could
be further improved, though it's already much better than it was before),
this method is much better than the previous one.

Fixes #11592 and related tickets.

Change-Id: I65175f760bda98e42d1fc68ba8e526470bf17c25
Reviewed-on: https://review.haiku-os.org/c/889
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2019-01-22 14:25:09 +00:00
Barrett17 e7933432e9 BCodecRoster: Remove MakeFormatFor
* I want to introduce a new way for plugins to
register for a format. Supporting the old FormatManager is
too painful at this point and not worth the effort.
2018-12-28 23:01:02 +01:00
Barrett17 fa911df6e6 Move FormatManager back to the media_kit
* We don't aim to replicate this functionality. I don't
think this will be useful at all in future iterations.
Originally I planned to rewrite it on top of the new
BMediaFormat, but now I am of the hopinion this is
greatly unneeded.
2018-12-28 22:55:25 +01:00
Barrett17 f3e317617f Move GetNextEncoder implementations to BCodecRoster 2018-12-28 22:24:07 +01:00
Murai Takashi 26c68df839 MediaDefs.cpp: Fix PVS 593
Remove unneed if condition, since 'size_t size' is unsigned.

Change-Id: I283afe6c1c24713b8efa21bd70747293fbc61899
Reviewed-on: https://review.haiku-os.org/796
Reviewed-by: Barrett17 <b.vitruvio@gmail.com>
2018-12-25 12:36:42 +00:00
Barrett17 b6c5bdbd39 MediaFile: Properly use BMediaExtractor::GetMetaData 2018-12-07 18:53:48 +01:00
Barrett17 278d03da22 media_kit: Remove most private dependencies from codec_kit
* Move to BCodecKit namespace and make extensive use
of BCodecRoster.
* This is a first step in the right direction of
decreasing private dependencies. Some APIs are being
translated to the CodecKit. I am doing an investigation
on which APIs are really used among apps, so that the new
kit can be more slim and oriented toward easy development
and can be extended in the right direction instead to
continue maintaning unuseful code.
* BMediaFormats needs still a bit of love.
* General improvements in style and code maintainability.
2018-11-27 11:38:05 +01:00
Barrett17 d33bd9ec7b Codec Kit: Introduce BCodecKit namespace 2018-11-27 11:38:04 +01:00
Barrett17 ee09c29148 Media Kit: Update private code 2018-11-25 13:02:02 +01:00
Barrett17 082e4ae4a7 Codec Kit: Rename files 2018-11-25 13:02:02 +01:00
Barrett17 e0a6d5ceeb MediaClient: Fix -Werror=set-but-unused
* The error wasn't checked.
2018-11-23 23:46:31 +01:00
Barrett17 af34e7abcc Codec Kit: Beauty fixes 2018-11-22 09:47:11 +01:00
Barrett17 b1c8bb2c46 MediaFile/MediaTrack: Use MetaData API internally 2018-11-21 17:24:33 +01:00