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