diff options
author | Mohamed Naufal <naufal22@gmail.com> | 2012-04-19 01:42:12 +0530 |
---|---|---|
committer | Mohamed Naufal <naufal22@gmail.com> | 2012-04-19 01:42:12 +0530 |
commit | 2343a99cf2d7a7d9c10fde3c7687be5d1dd297d7 (patch) | |
tree | 4f8b7d061752e5e8dc813d3a13a39db83e0d41f2 /libavcodec | |
parent | 1d48e88d4148a271ac56de706265e863e53da94b (diff) | |
download | ffmpeg-2343a99cf2d7a7d9c10fde3c7687be5d1dd297d7.tar.gz |
libstagefright: support more output pixel formats
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libstagefright.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/libstagefright.cpp b/libavcodec/libstagefright.cpp index 9206170d3f..ef45fae9f0 100644 --- a/libavcodec/libstagefright.cpp +++ b/libavcodec/libstagefright.cpp @@ -153,6 +153,7 @@ void* decode_thread(void *arg) { AVCodecContext *avctx = (AVCodecContext*)arg; StagefrightContext *s = (StagefrightContext*)avctx->priv_data; + const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[avctx->pix_fmt]; Frame* frame; MediaBuffer *buffer; int32_t w, h; @@ -207,15 +208,13 @@ void* decode_thread(void *arg) avctx->height = h; } - src_linesize[0] = w; - if (avctx->pix_fmt == PIX_FMT_YUV420P) - src_linesize[1] = src_linesize[2] = w/2; - else if (avctx->pix_fmt == PIX_FMT_NV21) - src_linesize[1] = w; + src_linesize[0] = av_image_get_linesize(avctx->pix_fmt, w, 0); + src_linesize[1] = av_image_get_linesize(avctx->pix_fmt, w, 1); + src_linesize[2] = av_image_get_linesize(avctx->pix_fmt, w, 2); src_data[0] = (uint8_t*)buffer->data(); src_data[1] = src_data[0] + src_linesize[0] * h; - src_data[2] = src_data[1] + src_linesize[1] * h/2; + src_data[2] = src_data[1] + src_linesize[1] * -(-h>>pix_desc->log2_chroma_h); av_image_copy(frame->vframe->data, frame->vframe->linesize, src_data, src_linesize, avctx->pix_fmt, avctx->width, avctx->height); @@ -327,6 +326,10 @@ static av_cold int Stagefright_init(AVCodecContext *avctx) if (colorFormat == OMX_QCOM_COLOR_FormatYVU420SemiPlanar || colorFormat == OMX_COLOR_FormatYUV420SemiPlanar) avctx->pix_fmt = PIX_FMT_NV21; + else if (colorFormat == OMX_COLOR_FormatYCbYCr) + avctx->pix_fmt = PIX_FMT_YUYV422; + else if (colorFormat == OMX_COLOR_FormatCbYCrY) + avctx->pix_fmt = PIX_FMT_UYVY422; else avctx->pix_fmt = PIX_FMT_YUV420P; |