Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: services/media/framework_ffmpeg/ffmpeg_video_decoder.h

Issue 1686363002: Motown: ffmpeg implementations of framework 'parts' (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Changed the way AVBuffer allocation/deallocation is done in the ffmpeg audio decoder. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/media/framework_ffmpeg/ffmpeg_video_decoder.h
diff --git a/services/media/framework_ffmpeg/ffmpeg_video_decoder.h b/services/media/framework_ffmpeg/ffmpeg_video_decoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..6e3d0590662b9ff7b9d6dced90d1cc839e332379
--- /dev/null
+++ b/services/media/framework_ffmpeg/ffmpeg_video_decoder.h
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_MEDIA_FRAMEWORK_FFMPEG_FFMPEG_VIDEO_DECODER_H_
+#define SERVICES_MEDIA_FRAMEWORK_FFMPEG_FFMPEG_VIDEO_DECODER_H_
+
+#include "services/media/framework_ffmpeg/ffmpeg_decoder_base.h"
+
+namespace mojo {
+namespace media {
+
+// Decoder implementation employing and ffmpeg video decoder.
+// TODO(dalesat): Complete this.
+class FfmpegVideoDecoder : public FfmpegDecoderBase {
+ public:
+ FfmpegVideoDecoder(AvCodecContextPtr av_codec_context);
+
+ ~FfmpegVideoDecoder() override;
+
+ protected:
+ // FfmpegDecoderBase overrides.
+ int Decode(PayloadAllocator* allocator, bool* frame_decoded_out) override;
+
+ PacketPtr CreateOutputPacket(PayloadAllocator* allocator) override;
+
+ PacketPtr CreateOutputEndOfStreamPacket() override;
+
+ private:
+ // Callback used by the ffmpeg decoder to acquire a buffer.
+ static int AllocateBufferForAvFrame(
+ AVCodecContext* av_codec_context,
+ AVFrame* av_frame,
+ int flags);
+
+ // Callback used by the ffmpeg decoder to release a buffer.
+ static void ReleaseBufferForAvFrame(void* opaque, uint8_t* buffer);
+
+ // AllocateBufferForAvFrame deposits the packet size here, because there's
+ // no good evidence of it after avcodec_decode_audio4 completes.
+ uint64_t packet_size_;
+
+ // This is used to verify that an allocated buffer is being used as expected
+ // by ffmpeg avcodec_decode_audio4. AllocateBufferForAvFrame sets it.
+ //void* packet_buffer_;
+};
+
+} // namespace media
+} // namespace mojo
+
+#endif // SERVICES_MEDIA_FRAMEWORK_FFMPEG_FFMPEG_VIDEO_DECODER_H_

Powered by Google App Engine
This is Rietveld 408576698