[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-promo
Subject: Re: [kde-promo] recording a KDE session
From: Tim Jansen <ml () tjansen ! de>
Date: 2003-01-30 23:48:28
[Download RAW message or body]
On Thursday 30 January 2003 19:24, Tim Jansen wrote:
> On Thursday 30 January 2003 13:58, Philippe FREMY wrote:
> > > http://www.tjansen.de/krfb/demo.html
> > Now, do you think it would be possible to integrate audio comments to
> > this ? That would be top of the top.
> 1. Fix the MP3 parser in Ming. Then you can live-encode the MP3 to a fifo
> and give the fifo's name to vnc2swf as argument.
Ok, fixed it (patch attached). I can now live-encode mp3 from a wav source and
stream that into vnc2swf.
It goes like this:
# create a FiFo
mkfifo /tmp/t.mp3
# feed the MP3 stream
cat test.wav | lame -m m -a -s 11 -b 32 - /tmp/t.mp3 &
# start vnc2swf
vnc2swf -dumpfile test.swf -soundfile /tmp/t.mp3 -framerate 15
Not comfortable, but works very well :)
My last, remaining problem is that I havent found a command line tool for
recording. The requirements are:
- must take a OSS source (there is no ALSA driver for my USB headset)
- must be able to specify the OSS device (because I have several OSS devices)
- must be able to stream the sound into a wavfile while it is recording
- should be able to write the data to STDOUT (even though a fifo solution may
be possible as well)
I haven't found a tool that fulfills all these requirements. As soon as I
have, I can record with live-audio...
bye..
["ming-input-stream.patch" (text/x-diff)]
diff -ru ming-0.2a.orig/src/blocks/input.c ming-0.2a/src/blocks/input.c
--- ming-0.2a.orig/src/blocks/input.c 2001-08-17 19:06:11.000000000 +0200
+++ ming-0.2a/src/blocks/input.c 2003-01-30 23:53:24.000000000 +0100
@@ -220,7 +220,8 @@
/* SWFInput_stream */
-#define INPUTSTREAM_INCREMENT 1024
+#define INPUTSTREAM_INCREMENT 32768
+#define MAX_INPUTSTREAM 32*1024*1024 // 32 mb
struct _inputStreamData
{
@@ -230,11 +231,11 @@
void SWFInput_stream_seek(SWFInput input, long offset, int whence)
{
- int len;
+ int len, l, readOffset;
unsigned char *buffer;
if(whence == SEEK_CUR)
- input->offset = min(input->length, input->offset + offset);
+ input->offset = input->offset + offset;
else if(whence == SEEK_SET)
input->offset = offset;
@@ -242,34 +243,44 @@
else if(whence == SEEK_END)
{
/* suck data until EOF */
- /* XXX - might want to put a limit on how much we suck */
while(SWFInput_getChar(input) != EOF)
- ;
+ if (input->length > MAX_INPUTSTREAM)
+ break;
input->offset = input->length - offset;
}
+ if (input->offset < 0)
+ input->offset = 0;
+
if(input->offset < input->length)
return;
/* now slurp up as much data as we need to get here */
- len = ((input->offset/INPUTSTREAM_INCREMENT)+1) * INPUTSTREAM_INCREMENT;
+ len = (((input->offset - input->length)/INPUTSTREAM_INCREMENT)+1) * INPUTSTREAM_INCREMENT;
+ readOffset = input->length;
+ input->length += len;
buffer = ((struct _inputStreamData *)input->data)->buffer =
realloc(((struct _inputStreamData *)input->data)->buffer,
- sizeof(unsigned char) * len);
+ sizeof(unsigned char) * (input->length + len));
- while(len > 0)
+ while((len > 0) && (l > 0))
{
- len -= fread(buffer, sizeof(unsigned char), len,
- ((struct _inputStreamData *)input->data)->file);
+ l = fread(buffer + readOffset, sizeof(unsigned char), len,
+ (((struct _inputStreamData *)input->data)->file));
+ len -= l;
+ readOffset += l;
}
}
int SWFInput_stream_getChar(SWFInput input)
{
+ if (input->offset >= MAX_INPUTSTREAM)
+ return EOF;
+
if(input->offset == input->length)
{
/* fetch from stream, save in buffer */
@@ -310,6 +321,11 @@
free(input->data);
}
+static int SWFInput_stream_eof(SWFInput input)
+{
+ return ((input->offset >= input->length) ? feof((FILE *)input->data) : 0);
+}
+
SWFInput newSWFInput_stream(FILE *f)
{
SWFInput input = calloc(1, sizeof(struct _swfInput));
@@ -317,7 +333,7 @@
input->getChar = SWFInput_stream_getChar;
input->destroy = SWFInput_stream_dtor;
- input->eof = SWFInput_file_eof;
+ input->eof = SWFInput_stream_eof;
input->seek = SWFInput_stream_seek;
input->data = (void *)f;
["vnc2swf-mp3.patch" (text/x-diff)]
diff -u vnc2swf-0.2/argsresources.c vnc2swf-0.2.mp3/argsresources.c
--- vnc2swf-0.2/argsresources.c 2002-06-19 01:10:55.000000000 +0200
+++ vnc2swf-0.2.mp3/argsresources.c 2003-01-30 19:11:57.000000000 +0100
@@ -198,6 +198,9 @@
{"dumpFile", "DumpFile", XtRString, sizeof(String),
XtOffsetOf(AppData, dumpfileString), XtRImmediate, (XtPointer) "out.swf"},
+ {"soundFile", "SoundMP3File", XtRString, sizeof(String),
+ XtOffsetOf(AppData, soundfileString), XtRImmediate, (XtPointer) 0},
+
{"frameRate", "FrameRate", XtRInt, sizeof(int),
XtOffsetOf(AppData, frameRate), XtRImmediate, (XtPointer) 12},
@@ -224,6 +227,7 @@
{"-truecolour", "*forceTrueColour", XrmoptionNoArg, "True"},
{"-depth", "*requestedDepth", XrmoptionSepArg, 0},
{"-dumpfile", "*dumpFile", XrmoptionSepArg, 0},
+ {"-soundfile", "*soundFile", XrmoptionSepArg, 0},
{"-framerate", "*frameRate", XrmoptionSepArg, 0},
{"-nommhack", "*macromediaHack", XrmoptionNoArg, "False"},
};
@@ -274,6 +278,7 @@
" -truecolour\n"
" -depth <depth>\n"
" -dumpfile <file-to-dump>\n"
+ " -soundfile <mp3-to-play>\n"
" -framerate <frames-per-sec>\n"
" -nommhack\n"
,programName,programName);
diff -u vnc2swf-0.2/rfbproto.c vnc2swf-0.2.mp3/rfbproto.c
--- vnc2swf-0.2/rfbproto.c 2002-06-19 01:10:55.000000000 +0200
+++ vnc2swf-0.2.mp3/rfbproto.c 2003-01-30 19:11:57.000000000 +0100
@@ -233,6 +233,7 @@
PrintPixelFormat(&si.format);
if (!WriteInitMovie(appData.dumpfileString,
+ appData.soundfileString,
appData.frameRate,
appData.macromediaHack,
si.framebufferWidth,
diff -u vnc2swf-0.2/vncviewer.h vnc2swf-0.2.mp3/vncviewer.h
--- vnc2swf-0.2/vncviewer.h 2002-06-19 18:43:19.000000000 +0200
+++ vnc2swf-0.2.mp3/vncviewer.h 2003-01-30 19:11:57.000000000 +0100
@@ -88,6 +88,7 @@
int bumpScrollPixels;
String dumpfileString;
+ String soundfileString;
int frameRate;
int macromediaHack;
} AppData;
@@ -236,7 +237,7 @@
extern Widget toplevel;
/* writeswf.c */
-extern Bool WriteInitMovie(char* filename, int frate, int mmhack, int w, int h);
+extern Bool WriteInitMovie(char* filename, char *soundfile, int frate, int mmhack, int w, int h);
extern Bool WriteFinishMovie(void);
extern Bool WriteRawImage(char* buf, int x, int y, int w, int h, int skip);
extern Bool WriteMoveImage(Display* dpy, Drawable d, XImage* img,
diff -u vnc2swf-0.2/writeswf.c vnc2swf-0.2.mp3/writeswf.c
--- vnc2swf-0.2/writeswf.c 2002-06-19 19:56:54.000000000 +0200
+++ vnc2swf-0.2.mp3/writeswf.c 2003-01-30 19:11:57.000000000 +0100
@@ -348,7 +348,7 @@
/* WriteInitMovie:
* Initialize Ming and prepare a movie file.
*/
-Bool WriteInitMovie(char* filename, int frate, int mmhack, int w, int h)
+Bool WriteInitMovie(char* filename, char *soundname, int frate, int mmhack, int w, int h)
{
fprintf(stderr,"WriteInitMovie: Opening file: \"%s\" with frame rate %d\n",
filename, frate);
@@ -372,6 +372,8 @@
movie = newSWFMovie();
Ming_init();
SWFMovie_setRate(movie, frate);
+ if (soundname)
+ SWFMovie_setSoundStream(movie, newSWFSound(fopen(soundname, "r")));
SWFMovie_setDimension(movie, w, h);
intervalusec = 1000000L / frate;
tv0.tv_sec = tv0.tv_usec = -1;
_______________________________________________
This message is from the kde-promo mailing list.
Visit http://mail.kde.org/mailman/listinfo/kde-promo to unsubscribe, set digest on or \
temporarily stop your subscription.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic