Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaption of WebKit to the changes to Services Kit #35

Open
wants to merge 4 commits into
base: rebased
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 36 additions & 38 deletions Source/WebCore/platform/graphics/haiku/MediaPlayerPrivateHaiku.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#include <MediaFile.h>
#include <MediaTrack.h>
#include <SoundPlayer.h>
#include <UrlProtocolRoster.h>
#include <UrlRequest.h>
#include <View.h>

namespace WebCore {
Expand All @@ -62,7 +60,7 @@ class MediaPlayerFactoryHaiku final : public MediaPlayerFactory {

bool supportsKeySystem(const String& keySystem, const String& mimeType) const final
{
return false;
return false;
//return MediaPlayerPrivate::supportsKeySystem(keySystem, mimeType);
}
};
Expand Down Expand Up @@ -92,11 +90,11 @@ MediaPlayerPrivate::~MediaPlayerPrivate()
{
delete m_soundPlayer;

m_mediaLock.Lock();
m_mediaLock.Lock();

cancelLoad();
delete m_frameBuffer;
m_mediaLock.Unlock();
m_mediaLock.Unlock();
}

#if ENABLE(MEDIA_SOURCE)
Expand All @@ -113,10 +111,10 @@ void MediaPlayerPrivate::load(const String& url)
m_soundPlayer->Stop(false);
delete m_soundPlayer;

m_mediaLock.Lock();
m_mediaLock.Lock();
cancelLoad();

m_mediaLock.Unlock();
m_mediaLock.Unlock();

// TODO we need more detailed info from the BMediaFile to accurately report
// the m_readyState and the m_networkState to WebKit. The API will need to
Expand All @@ -143,12 +141,12 @@ void MediaPlayerPrivate::load(const String& url)

void MediaPlayerPrivate::cancelLoad()
{
m_mediaLock.Lock();
m_mediaLock.Lock();
delete m_mediaFile;
m_mediaFile = nullptr;
m_audioTrack = nullptr;
m_videoTrack = nullptr;
m_mediaLock.Unlock();
m_audioTrack = nullptr;
m_videoTrack = nullptr;
m_mediaLock.Unlock();
}

void MediaPlayerPrivate::prepareToPlay()
Expand All @@ -161,42 +159,42 @@ void MediaPlayerPrivate::playCallback(void* cookie, void* buffer,
{
MediaPlayerPrivate* player = (MediaPlayerPrivate*)cookie;

if (!player->m_mediaLock.Lock())
return;
if (!player->m_mediaLock.Lock())
return;

// Deleting the BMediaFile release the tracks
if (player->m_audioTrack) {
// TODO handle the case where there is a video, but no audio track.
player->m_currentTime = player->m_audioTrack->CurrentTime() / 1000000.f;

int64 size64;
if (player->m_audioTrack->ReadFrames(buffer, &size64) != B_OK)
{
// Notify that we're done playing...
player->m_currentTime = player->m_audioTrack->Duration() / 1000000.f;
player->m_soundPlayer->Stop(false);

WeakPtr<MediaPlayerPrivate> p = makeWeakPtr(player);
callOnMainThread([p] {
if (!p)
return;
p->m_player->timeChanged();
});

player->m_audioTrack = nullptr;
}
}
// TODO handle the case where there is a video, but no audio track.
player->m_currentTime = player->m_audioTrack->CurrentTime() / 1000000.f;

int64 size64;
if (player->m_audioTrack->ReadFrames(buffer, &size64) != B_OK)
{
// Notify that we're done playing...
player->m_currentTime = player->m_audioTrack->Duration() / 1000000.f;
player->m_soundPlayer->Stop(false);

WeakPtr<MediaPlayerPrivate> p = makeWeakPtr(player);
callOnMainThread([p] {
if (!p)
return;
p->m_player->timeChanged();
});

player->m_audioTrack = nullptr;
}
}

if (player->m_videoTrack && player->m_audioTrack) {
if (player->m_videoTrack->CurrentTime()
if (player->m_videoTrack->CurrentTime()
< player->m_audioTrack->CurrentTime())
{
// Decode a video frame and show it on screen
int64 count;
if (player->m_videoTrack->ReadFrames(player->m_frameBuffer->Bits(),
&count) != B_OK) {
player->m_videoTrack = nullptr;
}
player->m_videoTrack = nullptr;
}

WeakPtr<MediaPlayerPrivate> p = makeWeakPtr(player);
callOnMainThread([p] {
Expand All @@ -206,7 +204,7 @@ void MediaPlayerPrivate::playCallback(void* cookie, void* buffer,
});
}
}
player->m_mediaLock.Unlock();
player->m_mediaLock.Unlock();
}

void MediaPlayerPrivate::play()
Expand Down Expand Up @@ -286,7 +284,7 @@ bool MediaPlayerPrivate::seeking() const
notImplemented();
return false;
}

bool MediaPlayerPrivate::paused() const
{
return m_paused;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ class BDataIO;
class BMediaFile;
class BMediaTrack;
class BSoundPlayer;
class BUrlRequest;
struct media_raw_audio_format;

namespace WebCore {

class MediaPlayerFactoryHaiku;

class MediaPlayerPrivate : public MediaPlayerPrivateInterface,
public CanMakeWeakPtr<MediaPlayerPrivate> {
public CanMakeWeakPtr<MediaPlayerPrivate> {
public:
friend class MediaPlayerFactoryHaiku;
friend class MediaPlayerFactoryHaiku;

static void registerMediaEngine(MediaEngineRegistrar);

Expand Down Expand Up @@ -92,7 +91,7 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface,
void paint(GraphicsContext&, const FloatRect&) override;

private:

void IdentifyTracks(const String& url);

static void playCallback(void*, void*, size_t,
Expand All @@ -108,7 +107,7 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface,
BMediaTrack* m_videoTrack;
BSoundPlayer* m_soundPlayer;
BBitmap* m_frameBuffer;
BLocker m_mediaLock;
BLocker m_mediaLock;

MediaPlayer* m_player;
MediaPlayer::NetworkState m_networkState;
Expand Down
8 changes: 4 additions & 4 deletions Source/WebCore/platform/network/NetworkStorageSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#if PLATFORM(COCOA) || USE(CFURLCONNECTION)
#include <wtf/RetainPtr.h>
#elif PLATFORM(HAIKU)
class BUrlContext;
class BUrlSession;
#endif

#if PLATFORM(COCOA)
Expand Down Expand Up @@ -145,8 +145,8 @@ class NetworkStorageSession {
WEBCORE_EXPORT NetworkStorageSession(PAL::SessionID);
~NetworkStorageSession();

BUrlContext& platformSession() const;
void setPlatformSession(BUrlContext*);
BUrlSession& platformSession() const;
void setPlatformSession(BUrlSession*);
#elif USE(CURL)
WEBCORE_EXPORT NetworkStorageSession(PAL::SessionID);
~NetworkStorageSession();
Expand Down Expand Up @@ -252,7 +252,7 @@ class NetworkStorageSession {
GRefPtr<SoupCookieJar> m_cookieStorage;
Function<void ()> m_cookieObserverHandler;
#elif USE(HAIKU)
BUrlContext* m_context;
BUrlSession* m_context;
#elif USE(CURL)
mutable UniqueRef<CookieJarDB> m_cookieDatabase;
#else
Expand Down
16 changes: 8 additions & 8 deletions Source/WebCore/platform/network/ResourceHandleInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#pragma once
Expand Down Expand Up @@ -82,7 +82,7 @@ class ResourceHandleInternal {
, m_currentRequest(request)
#endif
#if PLATFORM(HAIKU)
, m_urlrequest(0)
, m_urlrequest(0)
#endif
, m_failureTimer(*loader, &ResourceHandle::failureTimerFired)
{
Expand All @@ -91,7 +91,7 @@ class ResourceHandleInternal {
m_password = url.password();
m_firstRequest.removeCredentials();
}

~ResourceHandleInternal();

ResourceHandleClient* client() { return m_client; }
Expand All @@ -105,9 +105,9 @@ class ResourceHandleInternal {
// Suggested credentials for the current redirection step.
String m_user;
String m_password;

Credential m_initialCredential;

int status { 0 };

bool m_defersLoading;
Expand All @@ -130,7 +130,7 @@ class ResourceHandleInternal {
#endif
#if USE(CURL)
std::unique_ptr<CurlResourceHandleDelegate> m_delegate;

bool m_cancelled { false };
unsigned m_redirectCount { 0 };
unsigned m_authFailureCount { 0 };
Expand All @@ -141,8 +141,8 @@ class ResourceHandleInternal {
#endif

#if PLATFORM(HAIKU)
BUrlProtocolHandler* m_urlrequest;
BString m_url;
BUrlProtocolHandler* m_urlrequest;
BString m_url;
#endif

#if PLATFORM(COCOA)
Expand Down
Loading