framehook.h File Reference

#include "libavcodec/avcodec.h"

Go to the source code of this file.

Typedefs

typedef int( FrameHookConfigure )(void **ctxp, int argc, char *argv[])
typedef FrameHookConfigureFrameHookConfigureFn
typedef void( FrameHookProcess )(void *ctx, struct AVPicture *pict, enum PixelFormat pix_fmt, int width, int height, int64_t pts)
typedef FrameHookProcessFrameHookProcessFn
typedef void( FrameHookRelease )(void *ctx)
typedef FrameHookReleaseFrameHookReleaseFn

Functions

int frame_hook_add (int argc, char *argv[])
void frame_hook_process (struct AVPicture *pict, enum PixelFormat pix_fmt, int width, int height, int64_t pts)
void frame_hook_release (void)

Variables

FrameHookConfigure Configure
FrameHookProcess Process
FrameHookRelease Release


Typedef Documentation

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

Definition at line 34 of file framehook.h.

typedef FrameHookConfigure* FrameHookConfigureFn

Definition at line 35 of file framehook.h.

typedef void( FrameHookProcess)(void *ctx, struct AVPicture *pict, enum PixelFormat pix_fmt, int width, int height, int64_t pts)

Definition at line 39 of file framehook.h.

typedef FrameHookProcess* FrameHookProcessFn

Definition at line 40 of file framehook.h.

typedef void( FrameHookRelease)(void *ctx)

Definition at line 44 of file framehook.h.

typedef FrameHookRelease* FrameHookReleaseFn

Definition at line 45 of file framehook.h.


Function Documentation

int frame_hook_add ( int  argc,
char *  argv[] 
)

Definition at line 42 of file framehook.c.

References av_log(), AV_LOG_ERROR, av_mallocz(), AVERROR, dlopen, first_hook, and NULL.

00043 {
00044 #ifdef CONFIG_VHOOK
00045     void *loaded;
00046     FrameHookEntry *fhe, **fhep;
00047 
00048     if (argc < 1) {
00049         return ENOENT;
00050     }
00051 
00052     loaded = dlopen(argv[0], RTLD_NOW);
00053     if (!loaded) {
00054         av_log(NULL, AV_LOG_ERROR, "%s\n", dlerror());
00055         return -1;
00056     }
00057 
00058     fhe = av_mallocz(sizeof(*fhe));
00059     if (!fhe) {
00060         return AVERROR(ENOMEM);
00061     }
00062 
00063     fhe->Configure = dlsym(loaded, "Configure");
00064     fhe->Process = dlsym(loaded, "Process");
00065     fhe->Release = dlsym(loaded, "Release");    /* Optional */
00066 
00067     if (!fhe->Process) {
00068         av_log(NULL, AV_LOG_ERROR, "Failed to find Process entrypoint in %s\n", argv[0]);
00069         return AVERROR(ENOENT);
00070     }
00071 
00072     if (!fhe->Configure && argc > 1) {
00073         av_log(NULL, AV_LOG_ERROR, "Failed to find Configure entrypoint in %s\n", argv[0]);
00074         return AVERROR(ENOENT);
00075     }
00076 
00077     if (argc > 1 || fhe->Configure) {
00078         if (fhe->Configure(&fhe->ctx, argc, argv)) {
00079             av_log(NULL, AV_LOG_ERROR, "Failed to Configure %s\n", argv[0]);
00080             return AVERROR(EINVAL);
00081         }
00082     }
00083 
00084     for (fhep = &first_hook; *fhep; fhep = &((*fhep)->next)) {
00085     }
00086 
00087     *fhep = fhe;
00088 
00089     return 0;
00090 #else
00091     av_log(NULL, AV_LOG_ERROR, "Video hooking not compiled into this version\n");
00092     return 1;
00093 #endif
00094 }

void frame_hook_process ( struct AVPicture pict,
enum PixelFormat  pix_fmt,
int  width,
int  height,
int64_t  pts 
)

Definition at line 96 of file framehook.c.

References FrameHookEntry::ctx, first_hook, FrameHookEntry::next, and FrameHookEntry::Process.

Referenced by pre_process_video_frame().

00097 {
00098     if (first_hook) {
00099         FrameHookEntry *fhe;
00100 
00101         for (fhe = first_hook; fhe; fhe = fhe->next) {
00102             fhe->Process(fhe->ctx, pict, pix_fmt, width, height, pts);
00103         }
00104     }
00105 }

void frame_hook_release ( void   ) 

Definition at line 107 of file framehook.c.

References av_free(), FrameHookEntry::ctx, first_hook, FrameHookEntry::next, NULL, and FrameHookEntry::Release.

00108 {
00109     FrameHookEntry *fhe;
00110     FrameHookEntry *fhenext;
00111 
00112     for (fhe = first_hook; fhe; fhe = fhenext) {
00113         fhenext = fhe->next;
00114         if (fhe->Release)
00115             fhe->Release(fhe->ctx);
00116         av_free(fhe);
00117     }
00118 
00119     first_hook = NULL;
00120 }


Variable Documentation

FrameHookConfigure Configure

Referenced by Configure().

FrameHookProcess Process

Referenced by Process().

FrameHookRelease Release

Referenced by Release().


Generated on Fri Jan 9 15:45:03 2009 for libextractor by  doxygen 1.5.1