[xiph-cvs] cvs commit: w3d/docs bibliography.tex

Holger Waechtler holger at xiph.org
Tue Feb 26 03:06:38 PST 2002



holger      02/02/26 03:06:37

  Modified:    .        Makefile
               docs     bibliography.tex
  Added:       .        tarkin_sdl_player.c
  Log:
  - added Stefan Knoblich's simple SDL Player
  - add a reference to citeseer in bibliography

Revision  Changes    Path
1.23      +8 -1      w3d/Makefile

Index: Makefile
===================================================================
RCS file: /usr/local/cvsroot/w3d/Makefile,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Makefile	2001/11/20 13:48:47	1.22
+++ Makefile	2002/02/26 11:06:36	1.23
@@ -16,7 +16,7 @@
 #CFLAGS+= -DDBG_MEMLEAKS
 
 # dump a lot debug images
-CFLAGS+= -DDBG_XFORM
+#CFLAGS+= -DDBG_XFORM
 
 # dump ogg packet infos
 #CFLAGS+= -DDBG_OGG
@@ -44,6 +44,12 @@
 tarkin_dec: $(OBJS) tarkin_dec.o
         $(CC) $(LFLAGS) $(OBJS) tarkin_dec.o -o $@
 
+tarkin_sdl_player: $(OBJS) tarkin_sdl_player.o
+	$(CC) $(LFLAGS) `sdl-config --libs` $(OBJS) tarkin_sdl_player.o -o $@
+
+tarkin_sdl_player.o: tarkin_sdl_player.c
+	$(CC) $(CFLAGS) `sdl-config --cflags` -c $< -o $@
+
 .c.o: .depend
         $(CC) $(CFLAGS) -c $<
 
@@ -51,6 +57,7 @@
         $(RM) $(OBJS) $(TARGET) gmon.out core .depend .depend.bak rle.histogram
         $(RM) $(TEST_TARGETS) $(TEST_OBJS)
         $(RM) tarkin_enc tarkin_dec tarkin_enc.o tarkin_dec.o
+	$(RM) tarkin_sdl_player tarkin_sdl_player.o
         $(RM) stream.ogg
         $(RM) *.ppm *.pgm
 

<p><p>1.1                  w3d/tarkin_sdl_player.c

Index: tarkin_sdl_player.c
===================================================================
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include "mem.h"
#include "tarkin.h"
#include "pnm.h"
#include <ogg/ogg.h>

#include <SDL/SDL.h>

#define CHUNK_SIZE 4096

int main (int argc, char **argv)
{
   char *fname = "stream.ogg";
   uint32_t frame = 0;
   uint8_t *rgb;
   int fd;
   TarkinStream *tarkin_stream;
   int nread;
   int nheader = 0;
   ogg_sync_state oy;
   ogg_stream_state os;
   ogg_page og;
   ogg_packet op;
   TarkinInfo ti;
   TarkinComment tc;
   TarkinTime date;
   SDL_Surface * vid_surface = NULL;
   
   char *buffer;
   
   TarkinVideoLayerDesc *layer;

   if (argc == 2) {
      fname = argv[1];
   } else if (argc != 1) {
      printf ("\n usage: %s <tarkin_stream>\n\n", argv[0]);
      exit (-1);
   }

   if ((fd = open (fname, O_RDONLY)) < 0) {
      printf ("error opening '%s'\n", fname);
      exit (-1);
   }

   // init SDL stuff
   if (SDL_Init(SDL_INIT_VIDEO)) {
     atexit(SDL_Quit);
   }

   tarkin_stream = tarkin_stream_new (fd);
   ogg_sync_init(&oy);
   ogg_stream_init(&os,1);
   tarkin_info_init(&ti);
   tarkin_comment_init(&tc);
   while(1){
      buffer = ogg_sync_buffer(&oy, CHUNK_SIZE);
      if((nread = read(fd, buffer, CHUNK_SIZE))>0)
          ogg_sync_wrote(&oy, nread);
      else{
          ogg_sync_wrote(&oy,0);
      }	  
      if(ogg_sync_pageout(&oy,&og)){
          ogg_stream_pagein(&os,&og);
          while(ogg_stream_packetout(&os,&op)){
             if(op.e_o_s)
                break;
             if(nheader<3){ /* 3 first packets to headerin */
                tarkin_synthesis_headerin(&ti, &tc, &op);
                if(nheader == 2){
                   tarkin_synthesis_init(tarkin_stream, &ti);
                }
                nheader++;
             } else {
                tarkin_synthesis_packetin(tarkin_stream, &op);
                while(tarkin_synthesis_frameout(tarkin_stream, &rgb, 0, &date)==0){
                  layer = &tarkin_stream->layer->desc;

                  // if SDL_initialized != true, init sdl stuff
                  if (!vid_surface)
                  {
#ifdef DEBUG
 printf("initializing sdl surface...");
#endif
                     if ((vid_surface = SDL_SetVideoMode(layer->width, layer->height, 24, SDL_SWSURFACE)) == NULL) {
                        tarkin_synthesis_freeframe(tarkin_stream, rgb);
                        tarkin_stream_destroy (tarkin_stream);
                        close (fd);
                        exit(1);
                     }
                  }

                  if (SDL_MUSTLOCK(vid_surface))
                     SDL_LockSurface(vid_surface);

                  memcpy(vid_surface->pixels, rgb, layer->width * layer->height * 3);  //...
                  
                  if (SDL_MUSTLOCK(vid_surface))		  
                     SDL_UnlockSurface(vid_surface);

                  SDL_UpdateRect(vid_surface, 0, 0, 0, 0);
/*
  sk : removed this stuff
                  snprintf(ofname, 11, layer->format == TARKIN_GRAYSCALE ? "out%03d.pgm" : "out%03d.ppm", frame);
                  printf ("write '%s' %dx%d\n", ofname, layer->width, layer->height);
                  write_pnm (ofname, rgb, layer->width, layer->height);
*/
                  tarkin_synthesis_freeframe(tarkin_stream, rgb);

                  frame ++;
                }
             }
          }
      }
      if(nread==0)
          break;
   }
   tarkin_stream_destroy (tarkin_stream);
   close (fd);

   return 0;
}

<p><p><p>1.3       +1 -1      w3d/docs/bibliography.tex

Index: bibliography.tex
===================================================================
RCS file: /usr/local/cvsroot/w3d/docs/bibliography.tex,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- bibliography.tex	2001/09/13 16:27:35	1.2
+++ bibliography.tex	2002/02/26 11:06:37	1.3
@@ -1,7 +1,7 @@
 
 Marco maintains an interesting link and paper collection, the URL is posted
 regulary on the takin-dev mailing list.
-
+Another good place to look for papers is http://citeseer.nj.nec.com/.
 
 \begin{thebibliography}{888}
 

<p><p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list