OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 data_source_ = data_source; | 458 data_source_ = data_source; |
459 if (host()) | 459 if (host()) |
460 data_source_->set_host(host()); | 460 data_source_->set_host(host()); |
461 | 461 |
462 // Add ourself to Protocol list and get our unique key. | 462 // Add ourself to Protocol list and get our unique key. |
463 std::string key = FFmpegGlue::GetInstance()->AddProtocol(this); | 463 std::string key = FFmpegGlue::GetInstance()->AddProtocol(this); |
464 | 464 |
465 // Open FFmpeg AVFormatContext. | 465 // Open FFmpeg AVFormatContext. |
466 DCHECK(!format_context_); | 466 DCHECK(!format_context_); |
467 AVFormatContext* context = NULL; | 467 AVFormatContext* context = NULL; |
468 int result = av_open_input_file(&context, key.c_str(), NULL, 0, NULL); | 468 int result = avformat_open_input(&context, key.c_str(), NULL, NULL); |
469 | 469 |
470 // Remove ourself from protocol list. | 470 // Remove ourself from protocol list. |
471 FFmpegGlue::GetInstance()->RemoveProtocol(this); | 471 FFmpegGlue::GetInstance()->RemoveProtocol(this); |
472 | 472 |
473 if (result < 0) { | 473 if (result < 0) { |
474 callback.Run(DEMUXER_ERROR_COULD_NOT_OPEN); | 474 callback.Run(DEMUXER_ERROR_COULD_NOT_OPEN); |
475 return; | 475 return; |
476 } | 476 } |
477 | 477 |
478 DCHECK(context); | 478 DCHECK(context); |
479 format_context_ = context; | 479 format_context_ = context; |
480 | 480 |
481 // Fully initialize AVFormatContext by parsing the stream a little. | 481 // Fully initialize AVFormatContext by parsing the stream a little. |
482 result = av_find_stream_info(format_context_); | 482 result = avformat_find_stream_info(format_context_, NULL); |
483 if (result < 0) { | 483 if (result < 0) { |
484 callback.Run(DEMUXER_ERROR_COULD_NOT_PARSE); | 484 callback.Run(DEMUXER_ERROR_COULD_NOT_PARSE); |
485 return; | 485 return; |
486 } | 486 } |
487 | 487 |
488 // Create demuxer stream entries for each possible AVStream. | 488 // Create demuxer stream entries for each possible AVStream. |
489 streams_.resize(format_context_->nb_streams); | 489 streams_.resize(format_context_->nb_streams); |
490 bool found_audio_stream = false; | 490 bool found_audio_stream = false; |
491 bool found_video_stream = false; | 491 bool found_video_stream = false; |
492 | 492 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 read_event_.Wait(); | 744 read_event_.Wait(); |
745 return last_read_bytes_; | 745 return last_read_bytes_; |
746 } | 746 } |
747 | 747 |
748 void FFmpegDemuxer::SignalReadCompleted(size_t size) { | 748 void FFmpegDemuxer::SignalReadCompleted(size_t size) { |
749 last_read_bytes_ = size; | 749 last_read_bytes_ = size; |
750 read_event_.Signal(); | 750 read_event_.Signal(); |
751 } | 751 } |
752 | 752 |
753 } // namespace media | 753 } // namespace media |
OLD | NEW |