00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "libavutil/common.h"
00022 #include "libavutil/intreadwrite.h"
00023 #include "avcodec.h"
00024
00025
00026 static int text2movsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
00027 uint8_t **poutbuf, int *poutbuf_size,
00028 const uint8_t *buf, int buf_size, int keyframe){
00029 if (buf_size > 0xffff) return 0;
00030 *poutbuf_size = buf_size + 2;
00031 *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE);
00032 AV_WB16(*poutbuf, buf_size);
00033 memcpy(*poutbuf + 2, buf, buf_size);
00034 return 1;
00035 }
00036
00037 AVBitStreamFilter ff_text2movsub_bsf={
00038 "text2movsub",
00039 0,
00040 text2movsub,
00041 };
00042
00043 static int mov2textsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
00044 uint8_t **poutbuf, int *poutbuf_size,
00045 const uint8_t *buf, int buf_size, int keyframe){
00046 if (buf_size < 2) return 0;
00047 *poutbuf_size = FFMIN(buf_size - 2, AV_RB16(buf));
00048 *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE);
00049 memcpy(*poutbuf, buf + 2, *poutbuf_size);
00050 return 1;
00051 }
00052
00053 AVBitStreamFilter ff_mov2textsub_bsf={
00054 "mov2textsub",
00055 0,
00056 mov2textsub,
00057 };