vhook/drawtext.c File Reference

#include "libavformat/framehook.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <time.h>
#include <ft2build.h>
#include <FT_FREETYPE_H>
#include <FT_GLYPH_H>

Go to the source code of this file.

Data Structures

struct  ContextInfo
 Context info for this vhook - stores the pipe and image buffers. More...

Defines

#define MAXSIZE_TEXT   1024
#define SCALEBITS   10
#define ONE_HALF   (1 << (SCALEBITS - 1))
#define FIX(x)   ((int) ((x) * (1<<SCALEBITS) + 0.5))
#define RGB_TO_YUV(rgb_color, yuv_color)
#define COPY_3(dst, src)
#define SET_PIXEL(picture, yuv_color, x, y)
#define GET_PIXEL(picture, yuv_color, x, y)

Functions

void Release (void *ctx)
static int ParseColor (char *text, unsigned char yuv_color[3])
int Configure (void **ctxp, int argc, char *argv[])
static void draw_glyph (AVPicture *picture, FT_Bitmap *bitmap, unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned char yuv_fgcolor[3], unsigned char yuv_bgcolor[3], int outline)
static void draw_box (AVPicture *picture, unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned char yuv_color[3])
void Process (void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width, int height, int64_t pts)


Define Documentation

#define COPY_3 ( dst,
src   ) 

Value:

{ \
    dst[0]=src[0]; \
    dst[1]=src[1]; \
    dst[2]=src[2]; \
}

Definition at line 74 of file drawtext.c.

Referenced by draw_glyph().

#define FIX (  )     ((int) ((x) * (1<<SCALEBITS) + 0.5))

Definition at line 66 of file drawtext.c.

#define GET_PIXEL ( picture,
yuv_color,
x,
 ) 

Value:

{ \
    yuv_color[0] = picture->data[0][ (x) + (y)*picture->linesize[0] ]; \
    yuv_color[1] = picture->data[1][ (x/2) + (y/2)*picture->linesize[1] ]; \
    yuv_color[2] = picture->data[2][ (x/2) + (y/2)*picture->linesize[2] ]; \
}

Definition at line 88 of file drawtext.c.

Referenced by draw_glyph().

#define MAXSIZE_TEXT   1024

Definition at line 46 of file drawtext.c.

Referenced by Process().

#define ONE_HALF   (1 << (SCALEBITS - 1))

Definition at line 65 of file drawtext.c.

#define RGB_TO_YUV ( rgb_color,
yuv_color   ) 

Value:

do { \
  yuv_color[0] = (FIX(0.29900)    * rgb_color[0] + FIX(0.58700) * rgb_color[1] + FIX(0.11400) * rgb_color[2] + ONE_HALF) >> SCALEBITS; \
  yuv_color[2] = ((FIX(0.50000)   * rgb_color[0] - FIX(0.41869) * rgb_color[1] - FIX(0.08131) * rgb_color[2] + ONE_HALF - 1) >> SCALEBITS) + 128; \
  yuv_color[1] = ((- FIX(0.16874) * rgb_color[0] - FIX(0.33126) * rgb_color[1] + FIX(0.50000) * rgb_color[2] + ONE_HALF - 1) >> SCALEBITS) + 128; \
} while (0)

Definition at line 68 of file drawtext.c.

Referenced by ParseColor().

#define SCALEBITS   10

Definition at line 64 of file drawtext.c.

#define SET_PIXEL ( picture,
yuv_color,
x,
 ) 

Value:

{ \
    picture->data[0][ (x) + (y)*picture->linesize[0] ] = yuv_color[0]; \
    picture->data[1][ ((x/2) + (y/2)*picture->linesize[1]) ] = yuv_color[1]; \
    picture->data[2][ ((x/2) + (y/2)*picture->linesize[2]) ] = yuv_color[2]; \
}

Definition at line 82 of file drawtext.c.

Referenced by draw_box(), and draw_glyph().


Function Documentation

int Configure ( void **  ctxp,
int  argc,
char *  argv[] 
)

Definition at line 149 of file drawtext.c.

static void draw_box ( AVPicture picture,
unsigned int  x,
unsigned int  y,
unsigned int  width,
unsigned int  height,
unsigned char  yuv_color[3] 
) [inline, static]

Definition at line 372 of file drawtext.c.

Referenced by Process().

static void draw_glyph ( AVPicture picture,
FT_Bitmap *  bitmap,
unsigned int  x,
unsigned int  y,
unsigned int  width,
unsigned int  height,
unsigned char  yuv_fgcolor[3],
unsigned char  yuv_bgcolor[3],
int  outline 
) [inline, static]

Definition at line 309 of file drawtext.c.

Referenced by Process().

static int ParseColor ( char *  text,
unsigned char  yuv_color[3] 
) [static]

Definition at line 125 of file drawtext.c.

Referenced by Configure().

void Process ( void *  ctx,
AVPicture picture,
enum PixelFormat  pix_fmt,
int  width,
int  height,
int64_t  pts 
)

Definition at line 387 of file drawtext.c.

void Release ( void *  ctx  ) 

Definition at line 118 of file drawtext.c.


Generated on Fri Oct 26 02:35:46 2012 for FFmpeg by  doxygen 1.5.8