00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00028 #include "avcodec.h"
00029 #include "bytestream.h"
00030
00031
00032 static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
00033 uint8_t **poutbuf, int *poutbuf_size,
00034 const uint8_t *buf, int buf_size, int keyframe)
00035 {
00036
00037 static const uint8_t imx_header[16] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x05,0x01,0x01,0x00 };
00038 uint8_t *poutbufp;
00039
00040 if (avctx->codec_id != CODEC_ID_MPEG2VIDEO) {
00041 av_log(avctx, AV_LOG_ERROR, "imx bitstream filter only applies to mpeg2video codec\n");
00042 return 0;
00043 }
00044
00045 *poutbuf = av_malloc(buf_size + 20 + FF_INPUT_BUFFER_PADDING_SIZE);
00046 poutbufp = *poutbuf;
00047 bytestream_put_buffer(&poutbufp, imx_header, 16);
00048 bytestream_put_byte(&poutbufp, 0x83);
00049 bytestream_put_be24(&poutbufp, buf_size);
00050 bytestream_put_buffer(&poutbufp, buf, buf_size);
00051 *poutbuf_size = poutbufp - *poutbuf;
00052 return 1;
00053 }
00054
00055 AVBitStreamFilter ff_imx_dump_header_bsf = {
00056 "imxdump",
00057 0,
00058 imx_dump_header,
00059 };