Commit Graph

219 Commits

Author SHA1 Message Date
Dario Casalinuovo
11c7bd86e2 Replace synchronization semaphore with async messages
* Remove SyncToServices, I will probably readd it in future
but this time using a local synchronization service more than
relying on the media_server to release the semaphore.
* Due to some discussions today in mailing list I decided
to step back and retry the initial way to notify media rosters
about media services status. It is woking by using two different
notifications for reconnecting to the media_server and notifying
the local subscribers.
* This speed up the media services restart.
* Sorry for the noise and very thanks for reviewing my code to
everyone.
2016-04-05 00:41:20 +02:00
Dario Casalinuovo
c131229f08 media_server: Add notifications 2016-04-04 01:27:12 +02:00
Dario Casalinuovo
53c3fa5137 Introduce functionality for syncing with the media services
* The global synchro semaphore is provided with the purpose of
being used to avoid threads lock up when the media_server is in
an undefined state. There's still room for improvements.
* BMediaRoster::SyncToServices lock up on a semaphore until
the multi_audio correctly connected to the mixer.
2016-04-04 01:27:09 +02:00
Dario Casalinuovo
7eaa054b87 StreamerPlugin: Use BDataIO as base interface
* There's no need to force the streamer plugin to use a
BMediaIO. This class is supplied to accomodate more smart uses,
but in certain cases it makes just things more complex. If a
plugin doesn't need to have an internal caching method, then it
will be simpler to implement a block-consuming BDataIO and let
the internal BMediaIOWrapper to deal with caching.
2016-03-31 18:06:19 +02:00
Dario Casalinuovo
8c7679851f Move MediaIO in it's own header 2016-03-25 22:44:56 +01:00
Dario Casalinuovo
3733e4b2ab PluginManager/AddOnManager: Add streamers support code 2016-03-25 22:20:03 +01:00
Dario Casalinuovo
20ae088fa5 MediaWriter: Add new BUrl functionality 2016-03-25 22:19:03 +01:00
Dario Casalinuovo
a2b3f12698 MediaExtractor: Adapt to new BUrl functionality 2016-03-25 22:18:15 +01:00
Dario Casalinuovo
63e1708eee Finalize StreamerPlugin
* Add cpp file.
* Make Sniff virtual.
2016-03-25 22:16:36 +01:00
Dario Casalinuovo
3d8e0d38e1 Add initial design of StreamerPlugin 2016-03-25 22:09:03 +01:00
Dario Casalinuovo
c1ad6121ca BMediaRecorder: Solve possible problem with node references
* Since the BMediaRecorder have an it's own estabilished policy
relating releasing the producer node we will not interfere with
it except when we are controlled from Cortex.
2016-02-09 20:24:58 +01:00
Dario Casalinuovo
cc0d365ef7 BMediaRecorder: Fix unneeded argument and error check 2016-02-09 14:11:40 +01:00
Dario Casalinuovo
2a2e352a4a BMediaRecorder: Rework to allow external connections
* This required to review various parts of the code, and
isn't probably still perfect. The main problem was an attributes
hell where redondance created a lot of problems, all this data
is now controlled mostly by the node.
* Header indentation changes needed too.
2016-02-09 13:33:09 +01:00
Dario Casalinuovo
2b51499295 Initial implementation of BMediaEncoder
* People interested, please review!
* This is based on the patch from Fredrik Moden which was based on
the Oleg Krysenkov one.
* The original patch has been reworked by myself.
* Adapted the code to work with the new PluginManager API which
differently than before doesn't need to contact the media_server.
2015-12-02 16:08:06 +01:00
Dario Casalinuovo
67060664c9 Allow BMediaRoster to log local nodes
* BMediaRoster is now capable to know which nodes are
instantiated in this team. This is also a first step to make
them survive after media_server crashes.
* A control at BMediaRoster::Quit can notify if all nodes
were correctly released. Ideally at this point the local nodes
list should be empty.
2015-11-28 16:35:04 +01:00
Murai Takashi
949cf6ac85 Fix GCC 5 build.
* Add -fgnu89-inline flag for libroot/posix/glibc
* Change __GNUC__ == 4 to __GNUC__ >= 4

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>

Fixes #11990, most of the changes had already been done.
2015-10-26 19:05:24 +01:00
Dario Casalinuovo
7d337b23b7 BMediaRoster: Reintroduce the undertaker class
* This has been necessary due to the undefined call order of
of static objects. Fixes #12315.
* The bug has been caused by the linker which free unused resources,
making the BMediaRoster to run in a zombie state. In this state
anything such as a message could make the looper to crash.
* The class is reintroduced with some differences though, we are
going to protect it from another thread calling Roster() while the
BMediaRoster is quitting and implement BMediaRosterEx::Quit.
* Unregister registrar notifications before we quit our thread. Avoid
to uninitialize anything from QuitRequested as it may cause problems.
2015-09-01 15:08:57 +02:00
Dario Casalinuovo
32afe10ab2 BMediaRoster: Add B_MEDIA_SERVER_STARTED and B_MEDIA_SERVER_QUIT
* This is done by watching to registrar notifications
  and providing a minimal service to contact the
  media roster in private API. The roster use this
  service to automatically reconnect to the media_server.
2015-07-24 12:19:33 +02:00
Dario Casalinuovo
e57acc3a99 BMediaRoster: Fix initialization and destruction
* Improve consistency by adding a BMediaRosterEx destructor
  and using it for the specular functionality of ctor instead
  to use the father's class destructor.
* Avoid double initialization of MediaInitializer that
  becomes MediaRosterUndertaker.
* Remove superfluos call to BMediaRoster::Quit()
  in media_addon_server.
2015-07-24 12:19:32 +02:00
Dario Casalinuovo
6cd18b575c BMediaRosterEx: cleanup and fix style in the header 2015-07-24 12:19:32 +02:00
Dario Casalinuovo
c079d8d6d9 Implement BMediaRoster::GetNodeAttributesFor 2015-07-13 18:13:48 +02:00
Dario Casalinuovo
1cc20d8231 BBufferGroup: Check for duplicated buffer id
* This exclude some possible cheating cases.
  It impose to have only a buffer_id per thread,
  so instances will not be duplicated if not needed.
2015-07-11 15:40:16 +02:00
Dario Casalinuovo
b6f0f88432 Implement BMediaRoster::GetFileFormatsFor 2015-07-10 18:46:20 +02:00
Dario Casalinuovo
7548648420 Implement BMediaRoster::SyncToNode 2015-07-10 18:46:19 +02:00
Dario Casalinuovo
7bcdb36249 media_server: Improve BTimeSource slave nodes management
The media_server is now able to remember the timesource associated to
a certain registered_node and always remove it when the owner
application crash, Fixes Ticket #11852
2015-07-09 23:45:16 +02:00
Michael Lotz
62d30d9e49 libmedia: Put AddOnManager into BPrivate::media namespace.
The AddOnManager was in the global namespace, clashing with application
classes with the same name.

The input_server has an AddOnManager of its own. When the
shortcut_catcher filter was loaded by said AddOnManager, it in turn
loaded libgame.so, which in turn loaded libmedia.so, where an
AddOnManager was created for the global AddOnManager instance in
libmedia.so. Unfortunately the wrong AddOnManager, the one from the
input_server, was created. This lead to two AddOnManagers being active
in the input_server which very well could be responsible for #11049
and #11280.

This was a regression since the move of the AddOnManager from the
media_server to libmedia.so in hrev47086. This also fits with the two
tickets.

I actually noticed the problem when debugging the shutdown process of
the input_server, where the destruction of the wrong AddOnManager
caused a deadlock with itself.
2015-04-19 23:47:05 +02:00
Dario Casalinuovo
4232706dc8 Clean SharedBufferList.h.
Signed-off-by: Adrien Destugues <pulkomandy@gmail.com>
2015-04-13 19:21:35 +02:00
Dario Casalinuovo
fc601b54ff TMap/Tlist: set various methods as const.
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
2015-03-17 21:50:18 +01:00
Hamish Morrison
683cf2ff58 BMediaRecorder: fix a few issues, fix style, remove unused SoundUtils
* Use the preferred time source (GetTimeSource) for the node
* Fix node releasing when creating the connection fails
* Add virtual slots and padding
* Refactor _Connect method
2015-01-12 18:31:27 +00:00
Barrett
739fd34cf5 Replace SoundCounsumer with modified BMediaRecorder.
Signed-off-by: Hamish Morrison <hamishm53@gmail.com>
2015-01-12 18:31:20 +00:00
Dario Casalinuovo
14896b937a Implement BMediaRoster::RollNode().
Fixes #9083.

Signed-off-by: Adrien Destugues <pulkomandy@gmail.com>
2015-01-08 08:57:01 +01:00
Adrien Destugues
2feaa37f24 Move media plug-in support to application side.
The media server tried to use node monitoring to dynamically add and
remove plug-ins, but it isn't that useful:
* When a plug-in is added, applications would have to query the media
server to get an up to date list of available formats. For example
MediaConvert populates its format menus on startup.
* When removing a plugin, if an app already had it loaded, there is not
much that can be done to keep it working.
* The list of plugins was not sorted by directories (user vs system
add-ons), so the directories were re-scanned to make sure user add-ons
were returned first, rendering the node monitoring less interesting.

Now, the format handling is done by each application. The node
monitoring is removed, instead the apps will scan the plugin directory
when first using the media kit classes. Restarting the application is
needed to update the media formats list.
2014-04-02 09:56:32 +02:00
Pawel Dziepak
d0f2d8282f Merge branch 'scheduler'
Conflicts:
	build/jam/packages/Haiku
	headers/os/kernel/OS.h
	headers/os/opengl/GLRenderer.h
	headers/private/shared/cpu_type.h
	src/add-ons/kernel/drivers/power/acpi_battery/acpi_battery.h
	src/bin/sysinfo.cpp
	src/bin/top.c
	src/system/kernel/arch/x86/arch_system_info.cpp
	src/system/kernel/port.cpp
2014-01-17 04:06:15 +01:00
Rene Gollent
4b62c6b0bc libmedia: Fix x86-64 debug build. 2013-12-13 17:53:12 -05:00
Pawel Dziepak
73ad2473e7 Remove remaining unnecessary 'volatile' qualifiers 2013-11-06 00:03:07 +01:00
Hamish Morrison
59b4be8cc1 Move SoundConsumer to libmedia in the BPrivate namespace
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
2012-08-07 23:38:37 +02:00
Adrien Destugues
ba5e652d79 Set of patches by Pete Goodeve to imrpove the handling of audio latency.
Closes #7285.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43164 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-11-03 14:26:03 +00:00
Stephan Aßmus
69372b5545 * Change the signature of the Writer plugins setup methods such
that they can modify the media_format passed in. For example they
   can store information in the user_data section. I don't actually
   use this anymore, but it may come in handy again.

AVFormatWriter:
 * Adjust the AVCodecContext flags not only for video, but also
   for audio streams (as the API example does). This mechanism
   may not yet work, since the AVCodecEncoder actually uses a
   different AVCodecContext instance.
 * Use the encodeInfo->flags and specify the key frame flag
   for the AVPacket. This finally makes videos encoded on Haiku
   seekable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39035 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-20 21:36:23 +00:00
Stephan Aßmus
2e54e93fbf Finall changed the Seek() method of Decoder plug-ins to
SeekedTo(), since it's only informative to decoders. They
can't modify the seeked frame/time. This also mirrors what
all existing decoders were doing in Seek(). BMediaTrack
is simplified accordingly (resolved two TODOs).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38705 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-18 14:44:22 +00:00
Stephan Aßmus
7cd3a2490b Implemented an API to get arbitrary meta-data about
BMediaFiles and about BMediaTracks in BMessages. As an
example, one can get chapter meta-data or the language
name of an audio-track.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38685 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-17 08:04:26 +00:00
Stephan Aßmus
e4f3cf203c * Renamed _plugin_manager to gPluginManager.
* Improved tracing in PluginManager.cpp when loading an add-on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38330 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-24 13:30:39 +00:00
Axel Dörfler
f46308c92a * More header cleanup, continuing korli's work.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36206 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-13 09:48:02 +00:00
Jérôme Duval
d25dd4b920 some copyright headers clean up
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36203 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-12 21:02:09 +00:00
Artur Wyszynski
cee04e8074 Fixed various errors/warnings reported by cppcheck:
* memory leaks
* resource leaks
* added const's to getters
* removed a few reundant conditions


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35433 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-08 22:50:38 +00:00
Jérôme Duval
6aee58a4cb * Revert the reverse the addons iteration of r35121.
* The media_addon_server before unloading addons need to be sure the nodes are deleted.
For instance, applications could keep references on global nodes, thus preventing deletion.
To release all references, the media_addon server uses a new method BMediaRosterEx::ReleaseNodeAll().
* Quit the MediaRoster looper when quitting media_addon server before unloading addons.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35133 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-17 20:05:01 +00:00
Stephan Aßmus
9563f44bfd Patch by Humdinger:
Changed strings to sentence case in various places. This is the
case-misc.diff part of ticket #5169.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35043 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-13 10:49:58 +00:00
Stephan Aßmus
0b6ac0b7a8 * White space cleanup
* Added myself to copyrights, since I added some stuff to MediaExtractor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35031 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-12 20:24:10 +00:00
Axel Dörfler
f0a1eb2dba * The static object construction and destruction is no longer random, but takes
the internal dependencies into account. This should fix bugs #5166, #5120,
  and #5150.
* Also, the time source object manager, as well as the dormant node manager
  are now recreated on media roster restart (when the media server is
  restarted).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34906 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-05 16:53:55 +00:00
Ingo Weinhold
e973f15a44 Missing includes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34599 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-09 17:56:24 +00:00
Axel Dörfler
6cafce94b5 * Moved the port pool into the new request_data.cpp file; it's no longer
accessible from the outside.
* Instead, request_data now retrieves/releases a reply port on its own.
* There were some more places that still used write_port()/read_port() instead
  of QueryServer().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34597 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-09 17:40:45 +00:00