[Mplayer-cvslog] CVS: main/libmpdemux demux_audio.c,1.23,1.24 demux_ogg.c,1.34,1.35 extension.c,1.4,1.5

Dmitry Baryshkov CVS lumag at mplayerhq.hu
Sun Oct 5 00:00:29 CEST 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv11397/libmpdemux

Modified Files:
	demux_audio.c demux_ogg.c extension.c 
Log Message:
FLAC decoding support via imported libmpflac.
TODO: fix FLAC-in-ogg decoding.



Index: demux_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_audio.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- demux_audio.c	20 Sep 2003 12:50:25 -0000	1.23
+++ demux_audio.c	4 Oct 2003 22:00:25 -0000	1.24
@@ -17,6 +17,7 @@
 
 #define MP3 1
 #define WAV 2
+#define fLaC 3
 
 
 #define HDR_SIZE 4
@@ -79,6 +80,10 @@
     } else if((n = mp_get_mp3_header(hdr,&mp3_chans,&mp3_freq)) > 0) {
       frmt = MP3;
       break;
+    } else if( hdr[0] == 'f' && hdr[1] == 'L' && hdr[2] == 'a' && hdr[3] == 'C' ) {
+      frmt = fLaC;
+      stream_skip(s,-4);
+      break;
     }
     // Add here some other audio format detection
     if(step < HDR_SIZE)
@@ -202,6 +207,11 @@
     demuxer->movi_end = s->end_pos;
 //    printf("wav: %X .. %X\n",(int)demuxer->movi_start,(int)demuxer->movi_end);
   } break;
+  case fLaC:
+	    sh_audio->format = mmioFOURCC('f', 'L', 'a', 'C');
+	    demuxer->movi_start = stream_tell(s);
+	    demuxer->movi_end = s->end_pos;
+	    break;
   }
 
   priv = (da_priv_t*)malloc(sizeof(da_priv_t));
@@ -264,6 +274,16 @@
     } break;
   case WAV : {
     int l = sh_audio->wf->nAvgBytesPerSec;
+    demux_packet_t*  dp = new_demux_packet(l);
+    l = stream_read(s,dp->buffer,l);
+    resize_demux_packet(dp, l);
+    priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps;
+    ds->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
+    ds_add_packet(ds,dp);
+    return 1;
+  }
+  case fLaC: {
+    int l = 65535;
     demux_packet_t*  dp = new_demux_packet(l);
     l = stream_read(s,dp->buffer,l);
     resize_demux_packet(dp, l);

Index: demux_ogg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ogg.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- demux_ogg.c	4 Oct 2003 17:29:01 -0000	1.34
+++ demux_ogg.c	4 Oct 2003 22:00:25 -0000	1.35
@@ -112,6 +112,7 @@
   int hdr_packets;
   int vorbis;
   int theora;
+  int flac;
 } ogg_stream_t;
 
 typedef struct ogg_demuxer {
@@ -362,6 +363,11 @@
 	}
      }
 #endif /* HAVE_OGGTHEORA */
+# ifdef HAVE_FLAC
+  } else if (os->flac) {
+     /* we pass complete packets to flac, mustn't strip the header! */
+     data = pack->packet;
+#endif /* HAVE_FLAC */
   } else {
     // Find data start
     int16_t hdrlen = (*pack->packet & PACKET_LEN_BITS01)>>6;
@@ -679,6 +685,16 @@
 	    if(verbose>0) print_video_header(sh_v->bih);
 	}
 #   endif /* HAVE_OGGTHEORA */
+#   ifdef HAVE_FLAC
+    } else if (pack.bytes >= 4 && !strncmp (&pack.packet[0], "fLaC", 4)) {
+	sh_a = new_sh_audio(demuxer,ogg_d->num_sub);
+	sh_a->format =  mmioFOURCC('f', 'L', 'a', 'C');
+	n_audio++;
+	ogg_d->subs[ogg_d->num_sub].flac = 1;
+	sh_a->wf = NULL;
+	mp_msg(MSGT_DEMUX,MSGL_V,"OGG : stream %d is FLAC\n",ogg_d->num_sub);
+#   endif /* HAVE_FLAC */
+
       /// Check for old header
     } else if(pack.bytes >= 142 && ! strncmp(&pack.packet[1],"Direct Show Samples embedded in Ogg",35) ) {
 

Index: extension.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/extension.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- extension.c	28 Jan 2003 01:18:43 -0000	1.4
+++ extension.c	4 Oct 2003 22:00:25 -0000	1.5
@@ -36,6 +36,8 @@
         { "y4m", DEMUXER_TYPE_Y4M },
         { "mp3", DEMUXER_TYPE_AUDIO },
         { "wav", DEMUXER_TYPE_AUDIO },
+        { "flac", DEMUXER_TYPE_AUDIO },
+        { "fla", DEMUXER_TYPE_AUDIO },
         { "ogg", DEMUXER_TYPE_OGG },
         { "ogm", DEMUXER_TYPE_OGG },
 //        { "pls", DEMUXER_TYPE_PLAYLIST },



More information about the MPlayer-cvslog mailing list