summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 02:09:20 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 02:09:20 +0000
commit0b9695e4d7207c23fec64eb685ddcd8ff76f4c9f (patch)
tree15301aa63239983bd1ebb0224c5fc47d0ceac8e1 /media
parentfc25aab270029d68109c4a1cc99bdc1e46f3c03b (diff)
downloadchromium_src-0b9695e4d7207c23fec64eb685ddcd8ff76f4c9f.zip
chromium_src-0b9695e4d7207c23fec64eb685ddcd8ff76f4c9f.tar.gz
chromium_src-0b9695e4d7207c23fec64eb685ddcd8ff76f4c9f.tar.bz2
Retry of enabling video on linux. See related review: http://codereview.chromium.org/100195
The effective changes were: 1) Adding av_register_protocol into the def file for ffmpeg in windows. 2) Commenting out the drawing glue code for non-skia platforms. 3) Fixing some mac compilation error caused by code drift. Review URL: http://codereview.chromium.org/99306 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/media_posix.cc36
-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/filters/ffmpeg_glue_unittest.cc2
-rw-r--r--media/media.gyp13
6 files changed, 41 insertions, 19 deletions
diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc
index edbced0..4bddf6d 100644
--- a/media/base/media_posix.cc
+++ b/media/base/media_posix.cc
@@ -24,7 +24,7 @@ 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);
+ return av_get_bits_per_sample_format_ptr(sample_fmt);
}
void (*avcodec_init_ptr)(void) = NULL;
@@ -99,12 +99,29 @@ 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"
@@ -210,13 +227,23 @@ 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 &&
+ if (av_get_bits_per_sample_format_ptr &&
+ avcodec_init_ptr &&
avcodec_find_decoder_ptr &&
avcodec_thread_init_ptr &&
avcodec_open_ptr &&
@@ -228,8 +255,11 @@ bool InitializeMediaLibrary(const FilePath& module_dir) {
av_open_input_file_ptr &&
av_find_stream_info_ptr &&
av_read_frame_ptr &&
+ av_seek_frame_ptr &&
+ av_register_protocol_ptr &&
- av_malloc_ptr) {
+ av_malloc_ptr &&
+ av_free_ptr) {
return true;
}
diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc
index 019bc15..77b602d 100644
--- a/media/filters/ffmpeg_audio_decoder.cc
+++ b/media/filters/ffmpeg_audio_decoder.cc
@@ -77,7 +77,11 @@ void FFmpegAudioDecoder::OnDecode(Buffer* input) {
input->GetData(),
input->GetDataSize());
- if (result < 0 || output_buffer_size > kOutputBufferSize) {
+ // 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) {
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 640f9cc..9e92cd4 100644
--- a/media/filters/ffmpeg_demuxer.h
+++ b/media/filters/ffmpeg_demuxer.h
@@ -35,7 +35,6 @@ 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 820f850..ca3ed1d 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();
- register_protocol(&kFFmpegProtocol);
+ av_register_protocol(&kFFmpegProtocol);
// Now register the rest of FFmpeg.
av_register_all();
diff --git a/media/filters/ffmpeg_glue_unittest.cc b/media/filters/ffmpeg_glue_unittest.cc
index d1d2a83..0fe7d04 100644
--- a/media/filters/ffmpeg_glue_unittest.cc
+++ b/media/filters/ffmpeg_glue_unittest.cc
@@ -19,7 +19,7 @@ void avcodec_init() {
g_avcodec_init = true;
}
-int register_protocol(URLProtocol* protocol) {
+int av_register_protocol(URLProtocol* protocol) {
EXPECT_FALSE(g_protocol);
g_protocol = protocol;
return 0;
diff --git a/media/media.gyp b/media/media.gyp
index 15a7ecc..58297ed 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -99,13 +99,6 @@
},
'conditions': [
['OS =="linux"', {
- '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?$' ] ],
}],
@@ -116,12 +109,8 @@
'$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework',
],
},
- 'sources!': [
- 'filters/ffmpeg_audio_decoder.cc',
- 'filters/ffmpeg_glue.cc',
- 'filters/ffmpeg_video_decoder.cc',
+ 'sources/': [ ['exclude', '_(linux|win)\\.cc$'],
],
- 'sources/': [ ['exclude', '_(linux|win)\\.cc$'] ],
}],
[ 'OS == "win"', {
'sources/': [ ['exclude', '_(linux|mac|posix)\\.cc$'],