OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_MEDIA_FRAMEWORK_FFMPEG_FFMPEG_VIDEO_DECODER_H_ |
| 6 #define SERVICES_MEDIA_FRAMEWORK_FFMPEG_FFMPEG_VIDEO_DECODER_H_ |
| 7 |
| 8 #include "services/media/framework_ffmpeg/ffmpeg_decoder_base.h" |
| 9 |
| 10 namespace mojo { |
| 11 namespace media { |
| 12 |
| 13 // Decoder implementation employing and ffmpeg video decoder. |
| 14 // TODO(dalesat): Complete this. |
| 15 class FfmpegVideoDecoder : public FfmpegDecoderBase { |
| 16 public: |
| 17 FfmpegVideoDecoder(AvCodecContextPtr av_codec_context); |
| 18 |
| 19 ~FfmpegVideoDecoder() override; |
| 20 |
| 21 protected: |
| 22 // FfmpegDecoderBase overrides. |
| 23 int Decode(PayloadAllocator* allocator, bool* frame_decoded_out) override; |
| 24 |
| 25 PacketPtr CreateOutputPacket(PayloadAllocator* allocator) override; |
| 26 |
| 27 PacketPtr CreateOutputEndOfStreamPacket() override; |
| 28 |
| 29 private: |
| 30 // Callback used by the ffmpeg decoder to acquire a buffer. |
| 31 static int AllocateBufferForAvFrame( |
| 32 AVCodecContext* av_codec_context, |
| 33 AVFrame* av_frame, |
| 34 int flags); |
| 35 |
| 36 // Callback used by the ffmpeg decoder to release a buffer. |
| 37 static void ReleaseBufferForAvFrame(void* opaque, uint8_t* buffer); |
| 38 |
| 39 // AllocateBufferForAvFrame deposits the packet size here, because there's |
| 40 // no good evidence of it after avcodec_decode_audio4 completes. |
| 41 uint64_t packet_size_; |
| 42 |
| 43 // This is used to verify that an allocated buffer is being used as expected |
| 44 // by ffmpeg avcodec_decode_audio4. AllocateBufferForAvFrame sets it. |
| 45 //void* packet_buffer_; |
| 46 }; |
| 47 |
| 48 } // namespace media |
| 49 } // namespace mojo |
| 50 |
| 51 #endif // SERVICES_MEDIA_FRAMEWORK_FFMPEG_FFMPEG_VIDEO_DECODER_H_ |
OLD | NEW |