comparison mpeg12.c @ 4623:e541c0dd35dd libavcodec

imx dump header bitstream filter, modifies bitstream to fit in mov and be decoded by final cut pro decoder
author bcoudurier
date Sun, 04 Mar 2007 02:59:11 +0000
parents 5464e5021a67
children fd9e324b3978
comparison
equal deleted inserted replaced
4622:76be6cfd7958 4623:e541c0dd35dd
29 #include "avcodec.h" 29 #include "avcodec.h"
30 #include "dsputil.h" 30 #include "dsputil.h"
31 #include "mpegvideo.h" 31 #include "mpegvideo.h"
32 32
33 #include "mpeg12data.h" 33 #include "mpeg12data.h"
34 #include "bytestream.h"
34 35
35 //#undef NDEBUG 36 //#undef NDEBUG
36 //#include <assert.h> 37 //#include <assert.h>
37 38
38 39
3520 ff_parse1_close, 3521 ff_parse1_close,
3521 mpegvideo_split, 3522 mpegvideo_split,
3522 }; 3523 };
3523 #endif /* !CONFIG_MPEGVIDEO_PARSER */ 3524 #endif /* !CONFIG_MPEGVIDEO_PARSER */
3524 3525
3526 static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
3527 uint8_t **poutbuf, int *poutbuf_size,
3528 const uint8_t *buf, int buf_size, int keyframe)
3529 {
3530 /* MXF essence element key */
3531 static const uint8_t imx_header[16] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x05,0x01,0x01,0x00 };
3532 uint8_t *poutbufp;
3533
3534 if (avctx->codec_id != CODEC_ID_MPEG2VIDEO) {
3535 av_log(avctx, AV_LOG_ERROR, "imx bitstream filter only applies to mpeg2video codec\n");
3536 return 0;
3537 }
3538
3539 *poutbuf = av_malloc(buf_size + 20 + FF_INPUT_BUFFER_PADDING_SIZE);
3540 poutbufp = *poutbuf;
3541 bytestream_put_buffer(&poutbufp, imx_header, 16);
3542 bytestream_put_byte(&poutbufp, 0x83); /* KLV BER long form */
3543 bytestream_put_be24(&poutbufp, buf_size);
3544 bytestream_put_buffer(&poutbufp, buf, buf_size);
3545 *poutbuf_size = poutbufp - *poutbuf;
3546 return 1;
3547 }
3548
3549 AVBitStreamFilter imx_dump_header_bsf = {
3550 "imxdump",
3551 0,
3552 imx_dump_header,
3553 };
3554
3525 /* this is ugly i know, but the alternative is too make 3555 /* this is ugly i know, but the alternative is too make
3526 hundreds of vars global and prefix them with ff_mpeg1_ 3556 hundreds of vars global and prefix them with ff_mpeg1_
3527 which is far uglier. */ 3557 which is far uglier. */
3528 #include "mdec.c" 3558 #include "mdec.c"