[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/server/asobj NetStream.cpp NetStream.h
From: |
Vitaly Alexeev |
Subject: |
[Gnash-commit] gnash/server/asobj NetStream.cpp NetStream.h |
Date: |
Wed, 01 Nov 2006 16:16:12 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Vitaly Alexeev <alexeev> 06/11/01 16:16:12
Modified files:
server/asobj : NetStream.cpp NetStream.h
Log message:
clean up
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.h?cvsroot=gnash&r1=1.8&r2=1.9
Patches:
Index: NetStream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- NetStream.cpp 30 Oct 2006 09:27:30 -0000 1.10
+++ NetStream.cpp 1 Nov 2006 16:16:12 -0000 1.11
@@ -18,7 +18,7 @@
//
//
-/* $Id: NetStream.cpp,v 1.10 2006/10/30 09:27:30 bik Exp $ */
+/* $Id: NetStream.cpp,v 1.11 2006/11/01 16:16:12 alexeev Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -33,7 +33,7 @@
#include "movie_root.h"
#if defined(_WIN32) || defined(WIN32)
- #include <Windows.h> // for sleep() //vv
+ #include <Windows.h> // for sleep()
#define sleep Sleep
#else
#include "unistd.h" // for sleep()
@@ -116,7 +116,7 @@
}
-void
+int
NetStream::play(const char* c_url)
{
@@ -139,9 +139,11 @@
// with the library so they will be used automatically when
// a file with the corresponding format/codec is opened
#ifdef USE_FFMPEG
+
+ // Is it already playing ?
if (m_FormatCtx)
{
- return;
+ return 0;
}
av_register_all();
@@ -153,7 +155,7 @@
if (av_open_input_file(&m_FormatCtx, c_url, NULL, 0, NULL) != 0)
{
printf("Couldn't open file\n");
- return;
+ return -1;
}
// Next, we need to retrieve information about the streams contained in
the file
@@ -161,7 +163,7 @@
if (av_find_stream_info(m_FormatCtx) < 0)
{
printf("Couldn't find stream information\n");
- return;
+ return -1;
}
m_FormatCtx->pb.eof_reached = 0;
@@ -194,7 +196,7 @@
if (m_video_index < 0)
{
printf("Didn't find a video stream\n");
- return;
+ return -1;
}
// Get a pointer to the codec context for the video stream
@@ -205,7 +207,7 @@
if (pCodec == NULL)
{
printf("Codec not found\n");
- return;
+ return -1;
}
// Open codec
@@ -219,7 +221,6 @@
// Determine required buffer size and allocate buffer
m_yuv = render::create_YUV_video(m_VCodecCtx->width,
m_VCodecCtx->height);
-// avpicture_get_size(PIX_FMT_YUV420P, m_VCodecCtx->width,
m_VCodecCtx->height));
if (m_audio_index >= 0)
{
@@ -262,6 +263,8 @@
#endif
pthread_create(&m_thread, NULL, NetStream::av_streamer, this);
+
+ return 0;
}
// decoder thread
@@ -283,6 +286,8 @@
ns->advance(delta_t);
// Don't hog the CPU.
+ // Queues have filled, video frame have shown
+ // now it is possible and to have a rest
if (unqueued_data)
{
sleep(10);
@@ -492,7 +497,10 @@
return;
}
- ns->obj.play(fn.arg(0).to_string());
+ if (ns->obj.play(fn.arg(0).to_string()) != 0)
+ {
+ ns->obj.close();
+ };
}
void netstream_seek(const fn_call& /*fn*/) {
Index: NetStream.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- NetStream.h 29 Oct 2006 18:34:12 -0000 1.8
+++ NetStream.h 1 Nov 2006 16:16:12 -0000 1.9
@@ -18,7 +18,7 @@
//
//
-/* $Id: NetStream.h,v 1.8 2006/10/29 18:34:12 rsavoye Exp $ */
+/* $Id: NetStream.h,v 1.9 2006/11/01 16:16:12 alexeev Exp $ */
#ifndef __NETSTREAM_H__
#define __NETSTREAM_H__
@@ -148,7 +148,7 @@
~NetStream();
void close();
void pause();
- void play(const char* source);
+ int play(const char* source);
void seek();
void setBufferTime();
@@ -161,7 +161,7 @@
}
static void* av_streamer(void* arg);
- static void audio_streamer(void *udata, uint8 *stream, int len);
//vv
+ static void audio_streamer(void *udata, uint8 *stream, int len);
private:
bool _bufferLength;
- [Gnash-commit] gnash/server/asobj NetStream.cpp NetStream.h,
Vitaly Alexeev <=