FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions | Variables
mediacodecdec_common.c File Reference
#include <string.h>
#include <sys/types.h>
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
#include "libavutil/time.h"
#include "libavutil/timestamp.h"
#include "avcodec.h"
#include "internal.h"
#include "mediacodec.h"
#include "mediacodec_surface.h"
#include "mediacodec_sw_buffer.h"
#include "mediacodec_wrapper.h"
#include "mediacodecdec_common.h"

Go to the source code of this file.

Macros

#define INPUT_DEQUEUE_TIMEOUT_US   8000
 OMX.k3.video.decoder.avc, OMX.NVIDIA. More...
 
#define OUTPUT_DEQUEUE_TIMEOUT_US   8000
 
#define OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US   1000000
 

Enumerations

enum  {
  COLOR_FormatYUV420Planar = 0x13, COLOR_FormatYUV420SemiPlanar = 0x15, COLOR_FormatYCbYCr = 0x19, COLOR_FormatAndroidOpaque = 0x7F000789,
  COLOR_QCOM_FormatYUV420SemiPlanar = 0x7fa30c00, COLOR_QCOM_FormatYUV420SemiPlanar32m = 0x7fa30c04, COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka = 0x7fa30c03, COLOR_TI_FormatYUV420PackedSemiPlanar = 0x7f000100,
  COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced = 0x7f000001
}
 

Functions

static enum AVPixelFormat mcdec_map_color_format (AVCodecContext *avctx, MediaCodecDecContext *s, int color_format)
 
static void ff_mediacodec_dec_ref (MediaCodecDecContext *s)
 
static void ff_mediacodec_dec_unref (MediaCodecDecContext *s)
 
static void mediacodec_buffer_release (void *opaque, uint8_t *data)
 
static int mediacodec_wrap_hw_buffer (AVCodecContext *avctx, MediaCodecDecContext *s, ssize_t index, FFAMediaCodecBufferInfo *info, AVFrame *frame)
 
static int mediacodec_wrap_sw_buffer (AVCodecContext *avctx, MediaCodecDecContext *s, uint8_t *data, size_t size, ssize_t index, FFAMediaCodecBufferInfo *info, AVFrame *frame)
 
static int mediacodec_dec_parse_format (AVCodecContext *avctx, MediaCodecDecContext *s)
 
static int mediacodec_dec_flush_codec (AVCodecContext *avctx, MediaCodecDecContext *s)
 
int ff_mediacodec_dec_init (AVCodecContext *avctx, MediaCodecDecContext *s, const char *mime, FFAMediaFormat *format)
 
int ff_mediacodec_dec_decode (AVCodecContext *avctx, MediaCodecDecContext *s, AVFrame *frame, int *got_frame, AVPacket *pkt)
 
int ff_mediacodec_dec_flush (AVCodecContext *avctx, MediaCodecDecContext *s)
 
int ff_mediacodec_dec_close (AVCodecContext *avctx, MediaCodecDecContext *s)
 
int ff_mediacodec_dec_is_flushing (AVCodecContext *avctx, MediaCodecDecContext *s)
 

Variables

struct {
   int   color_format
 
   enum AVPixelFormat   pix_fmt
 
color_formats []
 
AVHWAccel ff_h264_mediacodec_hwaccel
 
AVHWAccel ff_hevc_mediacodec_hwaccel
 
AVHWAccel ff_mpeg2_mediacodec_hwaccel
 
AVHWAccel ff_mpeg4_mediacodec_hwaccel
 
AVHWAccel ff_vp8_mediacodec_hwaccel
 
AVHWAccel ff_vp9_mediacodec_hwaccel
 

Macro Definition Documentation

#define INPUT_DEQUEUE_TIMEOUT_US   8000

OMX.k3.video.decoder.avc, OMX.NVIDIA.

  • OMX.SEC.avc.dec and OMX.google codec workarounds used in various place are taken from the Gstreamer project.

Gstreamer references: https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/sys/androidmedia/

Gstreamer copyright notice:

Copyright (C) 2012, Collabora Ltd. Author: Sebastian Dröge sebas.nosp@m.tian.nosp@m..droe.nosp@m.ge@c.nosp@m.ollab.nosp@m.ora..nosp@m.co.uk

Copyright (C) 2012, Rafaël Carré <funman>

Copyright (C) 2015, Sebastian Dröge sebas.nosp@m.tian.nosp@m.@cent.nosp@m.ricu.nosp@m.lar.c.nosp@m.om

Copyright (C) 2014-2015, Collabora Ltd. Author: Matthieu Bouron matth.nosp@m.ieu..nosp@m.bouro.nosp@m.n@gc.nosp@m.ollab.nosp@m.ora..nosp@m.com

Copyright (C) 2015, Edward Hervey Author: Edward Hervey bilbo.nosp@m.ed@g.nosp@m.mail..nosp@m.com

Copyright (C) 2015, Matthew Waters matth.nosp@m.ew@c.nosp@m.entri.nosp@m.cula.nosp@m.r.com

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation version 2.1 of the License.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Definition at line 83 of file mediacodecdec_common.c.

Referenced by ff_mediacodec_dec_decode().

#define OUTPUT_DEQUEUE_TIMEOUT_US   8000

Definition at line 84 of file mediacodecdec_common.c.

Referenced by ff_mediacodec_dec_decode().

#define OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US   1000000

Definition at line 85 of file mediacodecdec_common.c.

Referenced by ff_mediacodec_dec_decode().

Enumeration Type Documentation

anonymous enum
Enumerator
COLOR_FormatYUV420Planar 
COLOR_FormatYUV420SemiPlanar 
COLOR_FormatYCbYCr 
COLOR_FormatAndroidOpaque 
COLOR_QCOM_FormatYUV420SemiPlanar 
COLOR_QCOM_FormatYUV420SemiPlanar32m 
COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka 
COLOR_TI_FormatYUV420PackedSemiPlanar 
COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced 

Definition at line 87 of file mediacodecdec_common.c.

Function Documentation

static enum AVPixelFormat mcdec_map_color_format ( AVCodecContext avctx,
MediaCodecDecContext s,
int  color_format 
)
static

Definition at line 116 of file mediacodecdec_common.c.

Referenced by mediacodec_dec_parse_format().

static void ff_mediacodec_dec_ref ( MediaCodecDecContext s)
static

Definition at line 143 of file mediacodecdec_common.c.

Referenced by mediacodec_wrap_hw_buffer().

static void ff_mediacodec_dec_unref ( MediaCodecDecContext s)
static

Definition at line 148 of file mediacodecdec_common.c.

Referenced by ff_mediacodec_dec_close(), and mediacodec_buffer_release().

static void mediacodec_buffer_release ( void opaque,
uint8_t data 
)
static

Definition at line 174 of file mediacodecdec_common.c.

Referenced by mediacodec_wrap_hw_buffer().

static int mediacodec_wrap_hw_buffer ( AVCodecContext avctx,
MediaCodecDecContext s,
ssize_t  index,
FFAMediaCodecBufferInfo info,
AVFrame frame 
)
static

Definition at line 188 of file mediacodecdec_common.c.

Referenced by ff_mediacodec_dec_decode().

static int mediacodec_wrap_sw_buffer ( AVCodecContext avctx,
MediaCodecDecContext s,
uint8_t data,
size_t  size,
ssize_t  index,
FFAMediaCodecBufferInfo info,
AVFrame frame 
)
static

Definition at line 258 of file mediacodecdec_common.c.

Referenced by ff_mediacodec_dec_decode().

static int mediacodec_dec_parse_format ( AVCodecContext avctx,
MediaCodecDecContext s 
)
static

Definition at line 341 of file mediacodecdec_common.c.

Referenced by ff_mediacodec_dec_decode(), and ff_mediacodec_dec_init().

static int mediacodec_dec_flush_codec ( AVCodecContext avctx,
MediaCodecDecContext s 
)
static

Definition at line 440 of file mediacodecdec_common.c.

Referenced by ff_mediacodec_dec_flush().

int ff_mediacodec_dec_init ( AVCodecContext avctx,
MediaCodecDecContext s,
const char *  mime,
FFAMediaFormat format 
)

Definition at line 460 of file mediacodecdec_common.c.

Referenced by mediacodec_decode_init().

int ff_mediacodec_dec_decode ( AVCodecContext avctx,
MediaCodecDecContext s,
AVFrame frame,
int got_frame,
AVPacket pkt 
)

Definition at line 546 of file mediacodecdec_common.c.

Referenced by mediacodec_decode_frame(), and mediacodec_process_data().

int ff_mediacodec_dec_flush ( AVCodecContext avctx,
MediaCodecDecContext s 
)

Definition at line 731 of file mediacodecdec_common.c.

Referenced by mediacodec_decode_flush(), and mediacodec_decode_frame().

int ff_mediacodec_dec_close ( AVCodecContext avctx,
MediaCodecDecContext s 
)

Definition at line 749 of file mediacodecdec_common.c.

Referenced by ff_mediacodec_dec_init(), and mediacodec_decode_close().

int ff_mediacodec_dec_is_flushing ( AVCodecContext avctx,
MediaCodecDecContext s 
)

Definition at line 756 of file mediacodecdec_common.c.

Referenced by mediacodec_decode_frame().

Variable Documentation

int color_format

Definition at line 101 of file mediacodecdec_common.c.

enum AVPixelFormat pix_fmt

Definition at line 102 of file mediacodecdec_common.c.

Referenced by ff_mediacodec_dec_init().

const { ... } color_formats[]
AVHWAccel ff_h264_mediacodec_hwaccel
Initial value:
= {
.name = "mediacodec",
}
hardware decoding through MediaCodec
Definition: pixfmt.h:307

Definition at line 761 of file mediacodecdec_common.c.

AVHWAccel ff_hevc_mediacodec_hwaccel
Initial value:
= {
.name = "mediacodec",
}
hardware decoding through MediaCodec
Definition: pixfmt.h:307

Definition at line 768 of file mediacodecdec_common.c.

AVHWAccel ff_mpeg2_mediacodec_hwaccel
Initial value:
= {
.name = "mediacodec",
}
preferred ID for MPEG-1/2 video decoding
Definition: avcodec.h:219
hardware decoding through MediaCodec
Definition: pixfmt.h:307

Definition at line 775 of file mediacodecdec_common.c.

AVHWAccel ff_mpeg4_mediacodec_hwaccel
Initial value:
= {
.name = "mediacodec",
}
hardware decoding through MediaCodec
Definition: pixfmt.h:307

Definition at line 782 of file mediacodecdec_common.c.

AVHWAccel ff_vp8_mediacodec_hwaccel
Initial value:
= {
.name = "mediacodec",
}
hardware decoding through MediaCodec
Definition: pixfmt.h:307

Definition at line 789 of file mediacodecdec_common.c.

AVHWAccel ff_vp9_mediacodec_hwaccel
Initial value:
= {
.name = "mediacodec",
}
hardware decoding through MediaCodec
Definition: pixfmt.h:307

Definition at line 796 of file mediacodecdec_common.c.