mirror of
https://github.com/dyne/FreeJ.git
synced 2026-06-16 12:59:33 +02:00
fixes for RSSPlaylist
now working with audio (jack) and not crashing when a video is closed
This commit is contained in:
@@ -70,6 +70,7 @@ class RSSPlaylist(object):
|
||||
"""A RSSPlaylist is a running freej context and a video playlist from an RSS."""
|
||||
|
||||
def __init__(self, width=320, height=240, url = "http://giss.tv/dmmdb/rss.php?channel=piksel08"):
|
||||
global end_of_video
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.rsssucker = RSSsucker(url)
|
||||
@@ -90,7 +91,7 @@ class RSSPlaylist(object):
|
||||
self.audio = freej.AudioCollector('freej', 1024, 44100);
|
||||
|
||||
while (not self.cx.quit):
|
||||
|
||||
|
||||
for file in self.rsssucker.list:
|
||||
print file
|
||||
self.lay = freej.VideoLayer()
|
||||
@@ -102,12 +103,13 @@ class RSSPlaylist(object):
|
||||
|
||||
self.scr.add_layer(self.lay)
|
||||
|
||||
self.scr.add_audio( self.audio.Jack )
|
||||
self.scr.add_audio( self.audio.Jack )
|
||||
|
||||
while(not end_of_video): time.sleep(5)
|
||||
print "end of video"
|
||||
self.lay.quit = True
|
||||
self.cx.rem_layer(self.lay)
|
||||
end_of_video = False
|
||||
|
||||
else:
|
||||
print "Cannot start a show without playlist!"
|
||||
|
||||
+15
-6
@@ -663,16 +663,25 @@ int VideoLayer::decode_video_packet(int *got_picture) {
|
||||
}
|
||||
|
||||
void VideoLayer::close() {
|
||||
if(frame_number!=0)
|
||||
if(frame_number!=0) {
|
||||
func("free packet");
|
||||
av_free_packet(&pkt);
|
||||
}
|
||||
|
||||
if(video_codec_ctx)
|
||||
if(video_codec_ctx->codec)
|
||||
if(video_codec_ctx->codec) {
|
||||
func("close video codec");
|
||||
avcodec_close(video_codec_ctx);
|
||||
}
|
||||
|
||||
if(audio_codec_ctx) {
|
||||
if(audio_codec_ctx->codec)
|
||||
if(audio_codec_ctx)
|
||||
if(audio_codec_ctx->codec) {
|
||||
func("close audio codec");
|
||||
avcodec_close(audio_codec_ctx);
|
||||
if(audio_buf) free(audio_buf);
|
||||
if(audio_buf) {
|
||||
func("free audio buffer");
|
||||
free(audio_buf);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIB_SWSCALE
|
||||
@@ -682,7 +691,7 @@ void VideoLayer::close() {
|
||||
if(avformat_context) {
|
||||
av_close_input_file(avformat_context);
|
||||
}
|
||||
free_fifo();
|
||||
// free_fifo();
|
||||
if(rgba_picture) free_picture(rgba_picture);
|
||||
if(deinterlace_buffer) free(deinterlace_buffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user