• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavcodec/movsub_bsf.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008 Reimar Döffinger
00003  *
00004  * This file is part of FFmpeg.
00005  *
00006  * FFmpeg is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * FFmpeg is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with FFmpeg; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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 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 mov2textsub_bsf={
00053     "mov2textsub",
00054     0,
00055     mov2textsub,
00056 };

Generated on Fri Sep 16 2011 17:17:39 for FFmpeg by  doxygen 1.7.1