Opened 10 years ago

Closed 5 years ago

#4893 closed bug (fixed)

gcc4 BSound on alpha builds can not use media plugins

Reported by: Adek336 Owned by: pulkomandy
Priority: normal Milestone: R1
Component: Kits/Media Kit Version: R1/alpha1
Keywords: Cc:
Blocked By: #4920 Blocking:
Has a Patch: no Platform: All

Description

The playsound function comes from the Be book http://www.haikudev.com/bebookpl/The%20Media%20Kit/SoundPlayer.html#BSoundPlayer

#include <Application.h>
#include <Sound.h>
#include <SoundPlayer.h>
#include <Entry.h>
#include <iostream>

using namespace std;

void playsound(const char *path) { 
   BSound *sound; 
   BSoundPlayer player; 
   entry_ref ref; 
   BEntry entry(path, true); 
   BSoundPlayer::play_id id; 

   if (entry.InitCheck() == B_OK) { 
      if (entry.GetRef(&ref) == B_OK) { 
         sound = new BSound(&ref); 
         if (sound->InitCheck() == B_OK) { 
            player.Start(); 
            player.SetVolume(1.0); 
            id = player.StartPlaying(sound); 
            sound->ReleaseRef(); 
            player.WaitForSound(id); 
         } 
      } 
   } 
} 

int main()
{
	new BApplication("application/x-vnd.program");
	playsound("/Blank_BFS/sample.wav");
	return 0;
}

On the alpha:

< copy a wave file as /Blank_BFS/sample.wav >
setgcc gcc4
g++ mkit.cc -lbe -lmedia -o mkit
mkit

Problem: the media kit tries to load the gcc2 plugin, does not try to look for a gcc4 plugin.

Also known as #3437, where it happens to gcc2 compiled applications under hybrid4.

Change History (11)

comment:1 by Adek336, 10 years ago

Summary: BSoundPlayer unfunctional when used on alpha with gcc4 built appsgcc4 BSound on alpha builds can not use media plugins

comment:2 by Adek336, 10 years ago

Blocked By: 4920 added

comment:3 by Adek336, 10 years ago

Blocking: 3437 added

comment:4 by mmadia, 10 years ago

The blocking ticket #4920 was fixed in hrev33997, would you retest this?

comment:5 by Adek336, 10 years ago

Didn't help.

comment:6 by pulkomandy, 8 years ago

Also happens with any app trying to use the media kit directly (BMediaKit and BMediaFile). Can easily be reproduced, for example, with the push_game_sound_test available in Haiku tree.

comment:7 by diver, 7 years ago

Blocking: 3437 removed

(In #3437) VLC works fine in hrev44036 gcc4h.

comment:8 by pulkomandy, 5 years ago

Owner: changed from marcusoverhagen to pulkomandy
Status: newassigned

My attempt to add HTML5 audio/video to WebKit hit this old bug.

The media decoder plug-ins (not add-ons) are loaded in the application space when using BMediaTrack (or indirectly when using BSound > BTrackReader > BMediaTrack in the case of the test in this ticket).

comment:9 by stippi, 5 years ago

Maybe the libraries just need to use the new find_path() functionality. It automatically resolves to the correct architecture dependent paths.

comment:10 by pulkomandy, 5 years ago

The search for add-ons is currently done on media_server side, and it then sends the refs back to the application. I think the ida was to have the media_server watch for plugins and maintain a list in memory, but then this was changed in order to make sure user add-ons are searched first, and as a result the dirs are re-scanned each time the methods are called.

I'm not sure if the code can easily be moved application-side however. Another solution is having the app send its architecture to media_server, so the right add-ons can be searched. But it seems the media_server will "test" the plugin locally before giving a ref to the app, which would turn the problem backwards...

comment:11 by pulkomandy, 5 years ago

Resolution: fixed
Status: assignedclosed

Fixed in hrev47086.

Note: See TracTickets for help on using tickets.