diff options
Diffstat (limited to 'src/libffmpeg/libavcodec/raw.c')
-rw-r--r-- | src/libffmpeg/libavcodec/raw.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/libffmpeg/libavcodec/raw.c b/src/libffmpeg/libavcodec/raw.c index 4f829fd02..28c3cad54 100644 --- a/src/libffmpeg/libavcodec/raw.c +++ b/src/libffmpeg/libavcodec/raw.c @@ -14,14 +14,14 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - + /** * @file raw.c * Raw Video Codec */ - + #include "avcodec.h" typedef struct RawVideoContext { @@ -31,7 +31,7 @@ typedef struct RawVideoContext { AVFrame pic; ///< AVCodecContext.coded_frame } RawVideoContext; -typedef struct PixleFormatTag { +typedef struct PixelFormatTag { int pix_fmt; unsigned int fourcc; } PixelFormatTag; @@ -70,8 +70,8 @@ unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat fmt) const PixelFormatTag * tags = pixelFormatTags; while (tags->pix_fmt >= 0) { if (tags->pix_fmt == fmt) - return tags->fourcc; - tags++; + return tags->fourcc; + tags++; } return 0; } @@ -92,18 +92,18 @@ static int raw_init_decoder(AVCodecContext *avctx) case 32: avctx->pix_fmt= PIX_FMT_RGBA32; break; } } - + context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); context->buffer = av_malloc(context->length); context->p = context->buffer; context->pic.pict_type = FF_I_TYPE; context->pic.key_frame = 1; - + avctx->coded_frame= &context->pic; - + if (!context->buffer) return -1; - + return 0; } @@ -115,18 +115,22 @@ static void flip(AVCodecContext *avctx, AVPicture * picture){ } static int raw_decode(AVCodecContext *avctx, - void *data, int *data_size, - uint8_t *buf, int buf_size) + void *data, int *data_size, + uint8_t *buf, int buf_size) { RawVideoContext *context = avctx->priv_data; int bytesNeeded; + AVFrame * frame = (AVFrame *) data; AVPicture * picture = (AVPicture *) data; + frame->interlaced_frame = avctx->coded_frame->interlaced_frame; + frame->top_field_first = avctx->coded_frame->top_field_first; + /* Early out without copy if packet size == frame size */ if (buf_size == context->length && context->p == context->buffer) { avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height); - flip(avctx, picture); + flip(avctx, picture); *data_size = sizeof(AVPicture); return buf_size; } @@ -141,7 +145,7 @@ static int raw_decode(AVCodecContext *avctx, memcpy(context->p, buf, bytesNeeded); context->p = context->buffer; avpicture_fill(picture, context->buffer, avctx->pix_fmt, avctx->width, avctx->height); - flip(avctx, picture); + flip(avctx, picture); *data_size = sizeof(AVPicture); return bytesNeeded; } @@ -149,7 +153,7 @@ static int raw_decode(AVCodecContext *avctx, static int raw_close_decoder(AVCodecContext *avctx) { RawVideoContext *context = avctx->priv_data; - + av_freep(&context->buffer); return 0; } @@ -167,7 +171,7 @@ static int raw_init_encoder(AVCodecContext *avctx) } static int raw_encode(AVCodecContext *avctx, - unsigned char *frame, int buf_size, void *data) + unsigned char *frame, int buf_size, void *data) { return avpicture_layout((AVPicture *)data, avctx->pix_fmt, avctx->width, avctx->height, frame, buf_size); |