summaryrefslogtreecommitdiff
path: root/contrib/ffmpeg/vhook
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg/vhook')
-rw-r--r--contrib/ffmpeg/vhook/Makefile7
-rw-r--r--contrib/ffmpeg/vhook/fish.c2
-rw-r--r--contrib/ffmpeg/vhook/imlib2.c11
-rw-r--r--contrib/ffmpeg/vhook/null.c4
-rw-r--r--contrib/ffmpeg/vhook/ppm.c6
-rw-r--r--contrib/ffmpeg/vhook/watermark.c46
6 files changed, 37 insertions, 39 deletions
diff --git a/contrib/ffmpeg/vhook/Makefile b/contrib/ffmpeg/vhook/Makefile
index 06b48935e..167b8bfb0 100644
--- a/contrib/ffmpeg/vhook/Makefile
+++ b/contrib/ffmpeg/vhook/Makefile
@@ -11,7 +11,8 @@ ALLHOOKS=$(HOOKS) imlib2$(SLIBSUF) drawtext$(SLIBSUF)
ifeq ($(HAVE_IMLIB2),yes)
HOOKS += imlib2$(SLIBSUF)
- LIBS_imlib2$(SLIBSUF) = -lImlib2
+ CFLAGS += `imlib2-config --cflags`
+ LIBS_imlib2$(SLIBSUF) = `imlib2-config --libs`
endif
ifeq ($(HAVE_FREETYPE2),yes)
@@ -46,6 +47,4 @@ distclean: clean
.PHONY: all depend dep clean distclean install* uninstall*
-ifneq ($(wildcard .depend),)
-include .depend
-endif
+-include .depend
diff --git a/contrib/ffmpeg/vhook/fish.c b/contrib/ffmpeg/vhook/fish.c
index 2a30d2847..1571cf9b9 100644
--- a/contrib/ffmpeg/vhook/fish.c
+++ b/contrib/ffmpeg/vhook/fish.c
@@ -354,7 +354,7 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
if (ci->toRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the toRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
// sws_scale parameters are context, 4 first source, then 2 destination
diff --git a/contrib/ffmpeg/vhook/imlib2.c b/contrib/ffmpeg/vhook/imlib2.c
index 87c54cf0b..4e6ffb67c 100644
--- a/contrib/ffmpeg/vhook/imlib2.c
+++ b/contrib/ffmpeg/vhook/imlib2.c
@@ -103,7 +103,6 @@
#undef time
#include <sys/time.h>
#include <time.h>
-#include <X11/Xlib.h>
#include <Imlib2.h>
#include "eval.h"
@@ -341,17 +340,17 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
imlib_context_set_image(image);
data = imlib_image_get_data();
- avpicture_fill(&picture1, (uint8_t *) data, PIX_FMT_RGBA32, width, height);
+ avpicture_fill(&picture1, (uint8_t *) data, PIX_FMT_RGB32, width, height);
// if we already got a SWS context, let's realloc if is not re-useable
ci->toRGB_convert_ctx = sws_getCachedContext(ci->toRGB_convert_ctx,
width, height, pix_fmt,
- width, height, PIX_FMT_RGBA32,
+ width, height, PIX_FMT_RGB32,
sws_flags, NULL, NULL, NULL);
if (ci->toRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the toRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
@@ -431,13 +430,13 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
}
ci->fromRGB_convert_ctx = sws_getCachedContext(ci->fromRGB_convert_ctx,
- width, height, PIX_FMT_RGBA32,
+ width, height, PIX_FMT_RGB32,
width, height, pix_fmt,
sws_flags, NULL, NULL, NULL);
if (ci->fromRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the fromRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
// sws_scale parameters are context, 4 first source, then 2 destination
diff --git a/contrib/ffmpeg/vhook/null.c b/contrib/ffmpeg/vhook/null.c
index 041e5abda..c93308906 100644
--- a/contrib/ffmpeg/vhook/null.c
+++ b/contrib/ffmpeg/vhook/null.c
@@ -81,7 +81,7 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
if (ci->toRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the toRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
// sws_scale parameters are context, 4 first source, then 2 destination
@@ -102,7 +102,7 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
if (ci->fromRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the fromRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
// sws_scale parameters are context, 4 first source, then 2 destination
diff --git a/contrib/ffmpeg/vhook/ppm.c b/contrib/ffmpeg/vhook/ppm.c
index 51badd58d..9f618e55b 100644
--- a/contrib/ffmpeg/vhook/ppm.c
+++ b/contrib/ffmpeg/vhook/ppm.c
@@ -81,7 +81,7 @@ static rwpipe *rwpipe_open( int argc, char *argv[] )
close( output[ 1 ] );
execl("/bin/sh", "sh", "-c", command, (char*)NULL );
- exit( 255 );
+ _exit( 255 );
}
else
{
@@ -266,7 +266,7 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
if (ci->toRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the toRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
@@ -335,7 +335,7 @@ void Process(void *ctx, AVPicture *picture, enum PixelFormat pix_fmt, int width,
if (ci->fromRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the fromRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
diff --git a/contrib/ffmpeg/vhook/watermark.c b/contrib/ffmpeg/vhook/watermark.c
index 4d2acd2aa..aa6fee63c 100644
--- a/contrib/ffmpeg/vhook/watermark.c
+++ b/contrib/ffmpeg/vhook/watermark.c
@@ -208,23 +208,23 @@ static void Process0(void *ctx,
int thrG = ci->thrG;
int thrB = ci->thrB;
- if (pix_fmt != PIX_FMT_RGBA32) {
+ if (pix_fmt != PIX_FMT_RGB32) {
int size;
- size = avpicture_get_size(PIX_FMT_RGBA32, src_width, src_height);
+ size = avpicture_get_size(PIX_FMT_RGB32, src_width, src_height);
buf = av_malloc(size);
- avpicture_fill(&picture1, buf, PIX_FMT_RGBA32, src_width, src_height);
+ avpicture_fill(&picture1, buf, PIX_FMT_RGB32, src_width, src_height);
// if we already got a SWS context, let's realloc if is not re-useable
ci->toRGB_convert_ctx = sws_getCachedContext(ci->toRGB_convert_ctx,
src_width, src_height, pix_fmt,
- src_width, src_height, PIX_FMT_RGBA32,
+ src_width, src_height, PIX_FMT_RGB32,
sws_flags, NULL, NULL, NULL);
if (ci->toRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the toRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
@@ -248,7 +248,7 @@ static void Process0(void *ctx,
ym_size = ci->y_size;
// I'll do the *4 => <<2 crap later. Most compilers understand that anyway.
- // According to avcodec.h PIX_FMT_RGBA32 is handled in endian specific manner.
+ // According to avcodec.h PIX_FMT_RGB32 is handled in endian specific manner.
for (y=0; y<src_height; y++) {
offs = y * (src_width * 4);
offsm = (((y * ym_size) / src_height) * 4) * xm_size; // offsm first in maskline. byteoffs!
@@ -291,15 +291,15 @@ static void Process0(void *ctx,
- if (pix_fmt != PIX_FMT_RGBA32) {
+ if (pix_fmt != PIX_FMT_RGB32) {
ci->fromRGB_convert_ctx = sws_getCachedContext(ci->fromRGB_convert_ctx,
- src_width, src_height, PIX_FMT_RGBA32,
+ src_width, src_height, PIX_FMT_RGB32,
src_width, src_height, pix_fmt,
sws_flags, NULL, NULL, NULL);
if (ci->fromRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the fromRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
// sws_scale parameters are context, 4 first source, then 2 destination
@@ -339,23 +339,23 @@ static void Process1(void *ctx,
uint32_t pixel;
uint32_t pixelm;
- if (pix_fmt != PIX_FMT_RGBA32) {
+ if (pix_fmt != PIX_FMT_RGB32) {
int size;
- size = avpicture_get_size(PIX_FMT_RGBA32, src_width, src_height);
+ size = avpicture_get_size(PIX_FMT_RGB32, src_width, src_height);
buf = av_malloc(size);
- avpicture_fill(&picture1, buf, PIX_FMT_RGBA32, src_width, src_height);
+ avpicture_fill(&picture1, buf, PIX_FMT_RGB32, src_width, src_height);
// if we already got a SWS context, let's realloc if is not re-useable
ci->toRGB_convert_ctx = sws_getCachedContext(ci->toRGB_convert_ctx,
src_width, src_height, pix_fmt,
- src_width, src_height, PIX_FMT_RGBA32,
+ src_width, src_height, PIX_FMT_RGB32,
sws_flags, NULL, NULL, NULL);
if (ci->toRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the toRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
@@ -379,7 +379,7 @@ static void Process1(void *ctx,
ym_size = ci->y_size;
// I'll do the *4 => <<2 crap later. Most compilers understand that anyway.
- // According to avcodec.h PIX_FMT_RGBA32 is handled in endian specific manner.
+ // According to avcodec.h PIX_FMT_RGB32 is handled in endian specific manner.
for (y=0; y<src_height; y++) {
offs = y * (src_width * 4);
offsm = (((y * ym_size) / src_height) * 4) * xm_size; // offsm first in maskline. byteoffs!
@@ -402,15 +402,15 @@ static void Process1(void *ctx,
} // foreach X
} // foreach Y
- if (pix_fmt != PIX_FMT_RGBA32) {
+ if (pix_fmt != PIX_FMT_RGB32) {
ci->fromRGB_convert_ctx = sws_getCachedContext(ci->fromRGB_convert_ctx,
- src_width, src_height, PIX_FMT_RGBA32,
+ src_width, src_height, PIX_FMT_RGB32,
src_width, src_height, pix_fmt,
sws_flags, NULL, NULL, NULL);
if (ci->fromRGB_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the fromRGB conversion context\n");
- exit(1);
+ return;
}
// img_convert parameters are 2 first destination, then 4 source
// sws_scale parameters are context, 4 first source, then 2 destination
@@ -577,12 +577,12 @@ int get_watermark_picture(ContextInfo *ci, int cleanup)
}
// Determine required buffer size and allocate buffer
- ci->numBytes = avpicture_get_size(PIX_FMT_RGBA32, ci->pCodecCtx->width,
+ ci->numBytes = avpicture_get_size(PIX_FMT_RGB32, ci->pCodecCtx->width,
ci->pCodecCtx->height);
ci->buffer = av_malloc(ci->numBytes);
// Assign appropriate parts of buffer to image planes in pFrameRGB
- avpicture_fill((AVPicture *)ci->pFrameRGB, ci->buffer, PIX_FMT_RGBA32,
+ avpicture_fill((AVPicture *)ci->pFrameRGB, ci->buffer, PIX_FMT_RGB32,
ci->pCodecCtx->width, ci->pCodecCtx->height);
}
// TODO loop, pingpong etc?
@@ -601,16 +601,16 @@ int get_watermark_picture(ContextInfo *ci, int cleanup)
// Did we get a video frame?
if(ci->frameFinished)
{
- // Convert the image from its native format to RGBA32
+ // Convert the image from its native format to RGB32
ci->watermark_convert_ctx =
sws_getCachedContext(ci->watermark_convert_ctx,
ci->pCodecCtx->width, ci->pCodecCtx->height, ci->pCodecCtx->pix_fmt,
- ci->pCodecCtx->width, ci->pCodecCtx->height, PIX_FMT_RGBA32,
+ ci->pCodecCtx->width, ci->pCodecCtx->height, PIX_FMT_RGB32,
sws_flags, NULL, NULL, NULL);
if (ci->watermark_convert_ctx == NULL) {
av_log(NULL, AV_LOG_ERROR,
"Cannot initialize the watermark conversion context\n");
- exit(1);
+ return -1;
}
// img_convert parameters are 2 first destination, then 4 source
// sws_scale parameters are context, 4 first source, then 2 destination