logo       

[patch] xine-engine/video_out.c: msg#00115

video.xine.devel

Subject: [patch] xine-engine/video_out.c

Hi Miguel and Xine team,

I work with Miguel on xine-slave/PVR frontend. I had to add something
out of the ordinary--suspend and resume function. These functions must
pause close the video and audio ports and drivers while not releasing
the stream! This will allow, for example, a video conference session to
interrupt Xine, use XVideo, and then let the user resume their program
at the end of the call.
Basically, I accomplish this by creating audio and video ports using
"none." Then, on suspend, I use xine_post_wire_video_port() to the none
port, close the drivers (ports), and pause the stream. Then, on resume,
I create new audio/video ports using "auto" or whatever, start playback,
and call xine_post_wire_video_port() to the newly allocated port.

Believe it nor not, this works! Well, I did have to change something in
xine-engine/video_out.c to make it safe. I do not think it is the best
solution, but I have struggled and failed to develop a better one.
Basically, what happens is that after vo_exit() is called, there are
still some frames held by the video decoder because it will often crash
in one of the callbacks upon resume. I have not been able to figure out
how to make the decoder return all these frames. So, I try to make it
exit the callbacks and avoid bad pointers. Essentially, the
free_img_buf_queue and display_img_buf_queue track these frame objects,
except frames can be retrieved by a decoder plugin and are no longer
tracked by these queues. Therefore, the engine must trust these decoder
plugins, but maybe it shouldn't. I have tried telling the decoder to
flush, but it just tells the plugin to flush, which it apparanlty does
not do correctly. Or, I misunderstand the purpose of the decoder plugin
flush callback.

Index: video_out.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/xine-engine/video_out.c,v
retrieving revision 1.164
diff -u -p -r1.164 video_out.c
--- video_out.c 22 Jun 2003 17:10:41 -0000 1.164
+++ video_out.c 1 Aug 2003 23:43:13 -0000
@@ -207,6 +207,10 @@ static void vo_frame_dec_lock (vo_frame_
img->lock_counter--;
if (!img->lock_counter) {
vos_t *this = (vos_t *) img->port;
+
+ if (this->free_img_buf_queue == NULL)
+ return;
+
vo_append_to_img_buf_queue (this->free_img_buf_queue, img);
}

@@ -310,6 +314,9 @@ static int vo_frame_draw (vo_frame_t *im
int64_t cur_vpts;
int64_t pic_vpts ;
int frames_to_skip;
+
+ if (this->free_img_buf_queue == NULL)
+ return 0;

img->stream = stream;
extra_info_merge( img->extra_info, stream->video_decoder_extra_info );
@@ -1324,8 +1331,6 @@ static void vo_exit (xine_video_port_t *
pthread_join (this->video_thread, &p);
}

- vo_free_img_buffers (this_gen);
-
this->driver->dispose (this->driver);

#ifdef LOG
@@ -1339,7 +1344,9 @@ static void vo_exit (xine_video_port_t *
xine_list_free(this->streams);
pthread_mutex_destroy(&this->streams_lock);

+ vo_free_img_buffers (this_gen);
free (this->free_img_buf_queue);
+ this->free_img_buf_queue = NULL;
free (this->display_img_buf_queue);

free (this);





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise