[asterisk-commits] rizzo: branch rizzo/video_v2 r82746 - /team/rizzo/video_v2/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Sep 18 05:00:47 CDT 2007
Author: rizzo
Date: Tue Sep 18 05:00:47 2007
New Revision: 82746
URL: http://svn.digium.com/view/asterisk?view=rev&rev=82746
Log:
move SDL initialization to a better place
Modified:
team/rizzo/video_v2/channels/console_video.c
Modified: team/rizzo/video_v2/channels/console_video.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/video_v2/channels/console_video.c?view=diff&rev=82746&r1=82745&r2=82746
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Tue Sep 18 05:00:47 2007
@@ -705,7 +705,6 @@
char *src = NULL; /* pixel input */
int pix_fmt;
- int fmt = SDL_IYUV_OVERLAY; /* YV12 causes flicker in SDL */
if (out == 2)
ast_log(LOG_WARNING, "out %d initialized %d\n", out, env->initialized);
@@ -731,25 +730,6 @@
pthread_self(),
env->out.w, env->out.h, c->width, c->height, env->w, env->h);
#endif
-
- ast_mutex_lock(&env->lock);
- // ast_log(LOG_WARNING, "in critical section, screen %p\n", env->screen);
- /* first time we run, we also initialize sdl and the two bitmaps we use */
- if(env->screen == NULL) {
- env->screen = SDL_SetVideoMode(2*w, h, 0, 0);
- if(!env->screen) {
- ast_log(LOG_ERROR, "SDL: could not set video mode - exiting\n");
- return;
- }
- SDL_WM_SetCaption("Asterisk console Video Output", NULL);
- }
-
- if(!env->bmp[0])
- env->bmp[0] = SDL_CreateYUVOverlay(w, h, fmt, env->screen);
- if(!env->bmp[1])
- env->bmp[1] = SDL_CreateYUVOverlay(w, h, fmt, env->screen);
- // ast_log(LOG_WARNING, "end critical section\n");
- ast_mutex_unlock(&env->lock);
bmp = env->bmp[out ? 1 : 0];
SDL_LockYUVOverlay(bmp);
@@ -1059,6 +1039,8 @@
static void console_video_start(struct video_desc *env,
struct ast_channel *owner)
{
+ int fmt = SDL_IYUV_OVERLAY; /* YV12 causes flicker in SDL */
+
/*
* Register all codecs supported by the ffmpeg library.
* Doing it once is enough.
@@ -1071,22 +1053,38 @@
fprintf(stderr, "Could not initialize input decoder - %s\n", SDL_GetError());
}
+ /*
+ * initialize the SDL environment
+ */
fprintf(stderr, "prepare SDL initialization\n");
env->screen = NULL;
env->bmp[0] = env->bmp[1] = NULL;
- // SDL specific
- if(SDL_Init(SDL_INIT_VIDEO)) {
+ if (SDL_Init(SDL_INIT_VIDEO)) {
fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
return;
}
+ ast_mutex_lock(&env->lock);
+ // ast_log(LOG_WARNING, "in critical section, screen %p\n", env->screen);
+ /* first time we run, we also initialize sdl and the two bitmaps we use */
+ env->screen = SDL_SetVideoMode(2 * env->w, env->h, 0, 0);
+ if (!env->screen) {
+ ast_log(LOG_ERROR, "SDL: could not set video mode - exiting\n");
+ return;
+ }
+ SDL_WM_SetCaption("Asterisk console Video Output", NULL);
+
+ env->bmp[0] = SDL_CreateYUVOverlay(env->w, env->h, fmt, env->screen);
+ env->bmp[1] = SDL_CreateYUVOverlay(env->w, env->h, fmt, env->screen);
+ ast_mutex_unlock(&env->lock);
+
/* create windows ? */
env->initialized = 1;
env->owner = owner;
ast_pthread_create_background(&env->vthread, NULL, video_thread, env);
video_open(env); /* also allocate out.buf.data */
- show_frame(env, 2);
+ // show_frame(env, 2);
ast_log(LOG_WARNING, "----------------- video_out_init buf %p owner %p\n", env->out.buf.data, owner);
if (env->out.buf.data && owner) { /* talk to the local video source */
More information about the asterisk-commits
mailing list