Chromium Code Reviews| Index: media/test/ffmpeg_tests/ffmpeg_tests.cc |
| =================================================================== |
| --- media/test/ffmpeg_tests/ffmpeg_tests.cc (revision 90887) |
| +++ media/test/ffmpeg_tests/ffmpeg_tests.cc (working copy) |
| @@ -130,7 +130,7 @@ |
| NULL, 0, NULL); |
| if (result < 0) { |
| switch (result) { |
| - case AVERROR_NOFMT: |
| + case AVERROR(EINVAL): |
| std::cerr << "Error: File format not supported " |
| << in_path.value() << std::endl; |
| break; |
| @@ -166,13 +166,13 @@ |
| for (size_t i = 0; i < format_context->nb_streams; ++i) { |
| AVCodecContext* codec_context = format_context->streams[i]->codec; |
| - if (codec_context->codec_type == CODEC_TYPE_VIDEO && video_stream < 0) { |
| + if (codec_context->codec_type == AVMEDIA_TYPE_VIDEO && video_stream < 0) { |
| #if SHOW_VERBOSE |
| *log_out << "V "; |
| #endif |
| video_stream = i; |
| } else { |
| - if (codec_context->codec_type == CODEC_TYPE_AUDIO && audio_stream < 0) { |
| + if (codec_context->codec_type == AVMEDIA_TYPE_AUDIO && audio_stream < 0) { |
| #if SHOW_VERBOSE |
| *log_out << "A "; |
| #endif |
| @@ -186,7 +186,7 @@ |
| #if SHOW_VERBOSE |
| AVCodec* codec = avcodec_find_decoder(codec_context->codec_id); |
| - if (!codec || (codec_context->codec_type == CODEC_TYPE_UNKNOWN)) { |
| + if (!codec || (codec_context->codec_type == AVMEDIA_TYPE_UNKNOWN)) { |
| *log_out << "Stream #" << i << ": Unknown" << std::endl; |
| } else { |
| // Print out stream information |
| @@ -196,10 +196,10 @@ |
| #endif |
| } |
| int target_stream = video_stream; |
| - CodecType target_codec = CODEC_TYPE_VIDEO; |
| + AVMediaType target_codec = AVMEDIA_TYPE_VIDEO; |
| if (target_stream < 0) { |
| target_stream = audio_stream; |
| - target_codec = CODEC_TYPE_AUDIO; |
| + target_codec = AVMEDIA_TYPE_AUDIO; |
| } |
| // Only continue if we found our target stream. |
| @@ -232,11 +232,9 @@ |
| codec_context->error_recognition = FF_ER_CAREFUL; |
| // Initialize threaded decode. |
| - if (target_codec == CODEC_TYPE_VIDEO && video_threads > 0) { |
| - if (avcodec_thread_init(codec_context, video_threads) < 0) { |
| - std::cerr << "Warning: Could not initialize threading!\n" |
| - << "Did you build with pthread/w32thread support?" << std::endl; |
| - } |
| + if (target_codec == AVMEDIA_TYPE_VIDEO && video_threads > 0) { |
| + codec_context->thread_count = video_threads; |
| + // avcodec_thread_init deprecated |
|
scherkus (not reviewing)
2011/06/29 17:00:36
you can remove this comment
ilja
2011/06/29 21:40:05
Done.
|
| } |
| // Initialize our codec. |
| @@ -291,7 +289,7 @@ |
| // Only decode packets from our target stream. |
| if (packet.stream_index == target_stream) { |
| int result = -1; |
| - if (target_codec == CODEC_TYPE_AUDIO) { |
| + if (target_codec == AVMEDIA_TYPE_AUDIO) { |
| int size_out = AVCODEC_MAX_AUDIO_FRAME_SIZE; |
| base::TimeTicks decode_start = base::TimeTicks::HighResNow(); |
| @@ -323,7 +321,7 @@ |
| MD5Update(&ctx, u8_samples, size_out); |
| } |
| } |
| - } else if (target_codec == CODEC_TYPE_VIDEO) { |
| + } else if (target_codec == AVMEDIA_TYPE_VIDEO) { |
| int got_picture = 0; |
| base::TimeTicks decode_start = base::TimeTicks::HighResNow(); |
| @@ -425,7 +423,7 @@ |
| } |
| if (sum > 0) { |
| - if (target_codec == CODEC_TYPE_AUDIO) { |
| + if (target_codec == AVMEDIA_TYPE_AUDIO) { |
| // Calculate the average milliseconds per frame. |
| // Audio decoding is usually in the millisecond or range, and |
| // best expressed in time (ms) rather than FPS, which can approach |
| @@ -435,7 +433,7 @@ |
| log_out->setf(std::ios::fixed); |
| log_out->precision(2); |
| *log_out << "TIME PER FRAME (MS):" << std::setw(11) << ms << std::endl; |
| - } else if (target_codec == CODEC_TYPE_VIDEO) { |
| + } else if (target_codec == AVMEDIA_TYPE_VIDEO) { |
| // Calculate the average frames per second. |
| // Video decoding is expressed in Frames Per Second - a term easily |
| // understood and should exceed a typical target of 30 fps. |