summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/renderer/render_view.cc6
-rw-r--r--chrome/renderer/webmediaplayer_delegate_impl.cc6
-rw-r--r--media/base/media_posix.cc46
-rw-r--r--media/filters/ffmpeg_audio_decoder.cc6
-rw-r--r--media/filters/ffmpeg_demuxer.h1
-rw-r--r--media/filters/ffmpeg_glue.cc2
-rw-r--r--media/media.gyp10
-rw-r--r--webkit/webkit.gyp11
8 files changed, 42 insertions, 46 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 804aff3..1236886 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -1877,7 +1877,13 @@ WebPluginDelegate* RenderView::CreatePluginDelegate(
}
webkit_glue::WebMediaPlayerDelegate* RenderView::CreateMediaPlayerDelegate() {
+#if defined(OS_WIN)
return new WebMediaPlayerDelegateImpl(this);
+#else
+ // TODO(port)
+ NOTIMPLEMENTED();
+ return NULL;
+#endif
}
void RenderView::OnMissingPluginStatus(WebPluginDelegate* delegate,
diff --git a/chrome/renderer/webmediaplayer_delegate_impl.cc b/chrome/renderer/webmediaplayer_delegate_impl.cc
index 1c90a61..bfece7c 100644
--- a/chrome/renderer/webmediaplayer_delegate_impl.cc
+++ b/chrome/renderer/webmediaplayer_delegate_impl.cc
@@ -12,9 +12,12 @@
#include "chrome/renderer/media/video_renderer_impl.h"
#include "chrome/renderer/render_view.h"
#include "googleurl/src/gurl.h"
+#if defined(OS_WIN)
+// FFmpeg is not ready for Linux and Mac yet.
#include "media/filters/ffmpeg_audio_decoder.h"
#include "media/filters/ffmpeg_demuxer.h"
#include "media/filters/ffmpeg_video_decoder.h"
+#endif
#include "media/filters/null_audio_renderer.h"
#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
@@ -63,9 +66,12 @@ WebMediaPlayerDelegateImpl::WebMediaPlayerDelegateImpl(RenderView* view)
view_(view),
tasks_(kLastTaskIndex) {
// TODO(hclam): Add filter factory for demuxer and decoders.
+#if defined(OS_WIN)
+ // FFmpeg is not ready for Linux and Mac yet.
filter_factory_->AddFactory(media::FFmpegDemuxer::CreateFilterFactory());
filter_factory_->AddFactory(media::FFmpegAudioDecoder::CreateFactory());
filter_factory_->AddFactory(media::FFmpegVideoDecoder::CreateFactory());
+#endif
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAudio)) {
filter_factory_->AddFactory(
media::NullAudioRenderer::CreateFilterFactory());
diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc
index 1b3f323..edbced0 100644
--- a/media/base/media_posix.cc
+++ b/media/base/media_posix.cc
@@ -22,6 +22,11 @@
// be promising, but I don't quite understand it yet.
extern "C" {
+int (*av_get_bits_per_sample_format_ptr)(enum SampleFormat sample_fmt);
+int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) {
+ return av_get_bits_per_sample_format(sample_fmt);
+}
+
void (*avcodec_init_ptr)(void) = NULL;
void avcodec_init(void) {
avcodec_init_ptr();
@@ -70,11 +75,6 @@ int avcodec_decode_video(AVCodecContext* avctx, AVFrame* picture,
}
-int (*av_get_bits_per_sample_format_ptr)(enum SampleFormat sample_fmt);
-int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) {
- return av_get_bits_per_sample_format_ptr(sample_fmt);
-}
-
void (*av_register_all_ptr)(void);
void av_register_all(void) {
av_register_all_ptr();
@@ -99,29 +99,12 @@ int av_read_frame(AVFormatContext* s, AVPacket* pkt) {
return av_read_frame_ptr(s, pkt);
}
-int (*av_seek_frame_ptr)(AVFormatContext* s, int stream_index,
- int64_t timestamp, int flags) = NULL;
-int av_seek_frame(AVFormatContext* s, int stream_index,
- int64_t timestamp, int flags) {
- return av_seek_frame_ptr(s, stream_index, timestamp, flags);
-}
-
-int (*av_register_protocol_ptr)(URLProtocol* protocol) = NULL;
-int av_register_protocol(URLProtocol* protocol) {
- return av_register_protocol_ptr(protocol);
-}
-
void* (*av_malloc_ptr)(unsigned int size) = NULL;
void* av_malloc(unsigned int size) {
return av_malloc_ptr(size);
}
-void (*av_free_ptr)(void* ptr) = NULL;
-void av_free(void* ptr) {
- return av_free_ptr(ptr);
-}
-
} // extern "C"
@@ -186,6 +169,9 @@ bool InitializeMediaLibrary(const FilePath& module_dir) {
// TODO(ajwong): Extract this to somewhere saner, and hopefully
// autogenerate the bindings from the .def files. Having all this
// code here is incredibly ugly.
+ av_get_bits_per_sample_format_ptr =
+ reinterpret_cast<int (*)(enum SampleFormat)>(
+ dlsym(libs[FILE_LIBAVCODEC], "av_get_bits_per_sample_format"));
avcodec_init_ptr =
reinterpret_cast<void(*)(void)>(
dlsym(libs[FILE_LIBAVCODEC], "avcodec_init"));
@@ -210,9 +196,6 @@ bool InitializeMediaLibrary(const FilePath& module_dir) {
const uint8_t*, int)>(
dlsym(libs[FILE_LIBAVCODEC], "avcodec_decode_video"));
- av_get_bits_per_sample_format_ptr =
- reinterpret_cast<int (*)(enum SampleFormat)>(
- dlsym(libs[FILE_LIBAVCODEC], "av_get_bits_per_sample_format"));
av_register_all_ptr =
reinterpret_cast<void(*)(void)>(
dlsym(libs[FILE_LIBAVFORMAT], "av_register_all"));
@@ -227,19 +210,10 @@ bool InitializeMediaLibrary(const FilePath& module_dir) {
av_read_frame_ptr =
reinterpret_cast<int (*)(AVFormatContext*, AVPacket*)>(
dlsym(libs[FILE_LIBAVFORMAT], "av_read_frame"));
- av_seek_frame_ptr =
- reinterpret_cast<int (*)(AVFormatContext*, int, int64_t, int)>(
- dlsym(libs[FILE_LIBAVFORMAT], "av_seek_frame"));
- av_register_protocol_ptr =
- reinterpret_cast<int (*)(URLProtocol*)>(
- dlsym(libs[FILE_LIBAVFORMAT], "av_register_protocol"));
av_malloc_ptr =
reinterpret_cast<void* (*)(unsigned int)>(
dlsym(libs[FILE_LIBAVUTIL], "av_malloc"));
- av_free_ptr =
- reinterpret_cast<void (*)(void*)>(
- dlsym(libs[FILE_LIBAVUTIL], "av_free"));
// Check that all the symbols were loaded correctly before returning true.
if (avcodec_init_ptr &&
@@ -250,15 +224,11 @@ bool InitializeMediaLibrary(const FilePath& module_dir) {
avcodec_decode_audio2_ptr &&
avcodec_decode_video_ptr &&
- av_get_bits_per_sample_format_ptr &&
av_register_all_ptr &&
av_open_input_file_ptr &&
av_find_stream_info_ptr &&
av_read_frame_ptr &&
- av_seek_frame_ptr &&
- av_register_protocol_ptr &&
- av_free_ptr &&
av_malloc_ptr) {
return true;
}
diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc
index 77b602d..019bc15 100644
--- a/media/filters/ffmpeg_audio_decoder.cc
+++ b/media/filters/ffmpeg_audio_decoder.cc
@@ -77,11 +77,7 @@ void FFmpegAudioDecoder::OnDecode(Buffer* input) {
input->GetData(),
input->GetDataSize());
- // TODO(ajwong): Consider if kOutputBufferSize should just be an int instead
- // of a size_t.
- if (result < 0 ||
- output_buffer_size < 0 ||
- static_cast<size_t>(output_buffer_size) > kOutputBufferSize) {
+ if (result < 0 || output_buffer_size > kOutputBufferSize) {
host_->Error(PIPELINE_ERROR_DECODE);
} else if (result == 0) {
// TODO(scherkus): does this mark EOS? Do we want to fulfill a read request
diff --git a/media/filters/ffmpeg_demuxer.h b/media/filters/ffmpeg_demuxer.h
index 9e92cd4..640f9cc 100644
--- a/media/filters/ffmpeg_demuxer.h
+++ b/media/filters/ffmpeg_demuxer.h
@@ -35,6 +35,7 @@ struct AVBitStreamFilterContext;
struct AVFormatContext;
struct AVPacket;
struct AVStream;
+enum CodecID;
namespace media {
diff --git a/media/filters/ffmpeg_glue.cc b/media/filters/ffmpeg_glue.cc
index ca3ed1d..820f850 100644
--- a/media/filters/ffmpeg_glue.cc
+++ b/media/filters/ffmpeg_glue.cc
@@ -105,7 +105,7 @@ static URLProtocol kFFmpegProtocol = {
FFmpegGlue::FFmpegGlue() {
// Register our protocol glue code with FFmpeg.
avcodec_init();
- av_register_protocol(&kFFmpegProtocol);
+ register_protocol(&kFFmpegProtocol);
// Now register the rest of FFmpeg.
av_register_all();
diff --git a/media/media.gyp b/media/media.gyp
index 3077008..5379fbe 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -101,7 +101,15 @@
},
'conditions': [
['OS =="linux"', {
- 'sources/': [ ['exclude', '_(mac|win)\\.cc$'] ],
+ 'sources!': [
+ 'filters/ffmpeg_audio_decoder.cc',
+ 'filters/ffmpeg_demuxer.cc',
+ 'filters/ffmpeg_demuxer.h',
+ 'filters/ffmpeg_glue.cc',
+ 'filters/ffmpeg_video_decoder.cc',
+ ],
+ 'sources/': [ ['exclude', '_(mac|win)\\.cc$'],
+ ['exclude', '\\.mm?$' ] ],
}],
['OS =="mac"', {
'link_settings': {
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 320e610..f759ba3 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -19,7 +19,6 @@
'ENABLE_SVG_USE=1',
'ENABLE_SVG_FOREIGN_OBJECT=1',
'ENABLE_SVG_FONTS=1',
- 'ENABLE_VIDEO=1',
'ENABLE_WORKERS=1',
],
'non_feature_defines': [
@@ -107,6 +106,9 @@
],
}],
['OS=="win"', {
+ 'feature_defines': [
+ 'ENABLE_VIDEO=1'
+ ],
'non_feature_defines': [
'CRASH=__debugbreak',
# Match Safari and Mozilla on Windows.
@@ -118,6 +120,10 @@
'../third_party/WebKit/WebCore/platform/text/win',
'../third_party/WebKit/WebCore/platform/win',
],
+ }, { # else: OS!="win"
+ 'feature_defines': [
+ 'ENABLE_VIDEO=0'
+ ],
}],
],
},
@@ -4132,6 +4138,9 @@
['exclude', 'Win\\.cpp$'],
['exclude', '/(Windows|Uniscribe)[^/]*\\.cpp$']
],
+ 'sources!': [
+ '../third_party/WebKit/WebCore/platform/graphics/MediaPlayer.cpp',
+ ],
}],
],
},