[MPlayer-cvslog] r31511 - trunk/stream/stream_cdda.c

diego subversion at mplayerhq.hu
Mon Jun 21 12:40:30 CEST 2010


Author: diego
Date: Mon Jun 21 12:40:30 2010
New Revision: 31511

Log:
cosmetics: Reorder functions to avoid forward declarations.

Modified:
   trunk/stream/stream_cdda.c

Modified: trunk/stream/stream_cdda.c
==============================================================================
--- trunk/stream/stream_cdda.c	Mon Jun 21 12:33:00 2010	(r31510)
+++ trunk/stream/stream_cdda.c	Mon Jun 21 12:40:30 2010	(r31511)
@@ -124,9 +124,112 @@ const m_option_t cdda_opts[] = {
   {NULL, NULL, 0, 0, 0, 0, NULL}
 };
 
-static int seek(stream_t* s,off_t pos);
-static int fill_buffer(stream_t* s, char* buffer, int max_len);
-static void close_cdda(stream_t* s);
+#ifndef CONFIG_LIBCDIO
+static void cdparanoia_callback(long inpos, int function) {
+#else
+static void cdparanoia_callback(long int inpos, paranoia_cb_mode_t function) {
+#endif
+}
+
+static int fill_buffer(stream_t* s, char* buffer, int max_len) {
+  cdda_priv* p = (cdda_priv*)s->priv;
+  cd_track_t *cd_track;
+  int16_t * buf;
+  int i;
+
+  if((p->sector < p->start_sector) || (p->sector > p->end_sector)) {
+    s->eof = 1;
+    return 0;
+  }
+
+  buf = paranoia_read(p->cdp,cdparanoia_callback);
+  if (!buf)
+    return 0;
+
+#if HAVE_BIGENDIAN
+  for(i=0;i<CD_FRAMESIZE_RAW/2;i++)
+          buf[i]=le2me_16(buf[i]);
+#endif
+
+  p->sector++;
+  memcpy(buffer,buf,CD_FRAMESIZE_RAW);
+
+  for(i=0;i<p->cd->tracks;i++){
+	  if(p->cd->disc_toc[i].dwStartSector==p->sector-1) {
+		  cd_track = cd_info_get_track(p->cd_info, i+1);
+//printf("Track %d, sector=%d\n", i, p->sector-1);
+		  if( cd_track!=NULL ) {
+			mp_msg(MSGT_SEEK, MSGL_INFO, "\n%s\n", cd_track->name);
+			mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDA_TRACK=%d\n", cd_track->track_nb);
+		  }
+		  break;
+	  }
+  }
+
+
+  return CD_FRAMESIZE_RAW;
+}
+
+static int seek(stream_t* s,off_t newpos) {
+  cdda_priv* p = (cdda_priv*)s->priv;
+  cd_track_t *cd_track;
+  int sec;
+  int current_track=0, seeked_track=0;
+  int seek_to_track = 0;
+  int i;
+
+  s->pos = newpos;
+  sec = s->pos/CD_FRAMESIZE_RAW;
+  if (s->pos < 0 || sec > p->end_sector) {
+    s->eof = 1;
+    return 0;
+  }
+
+//printf("pos: %d, sec: %d ## %d\n", (int)s->pos, (int)sec, CD_FRAMESIZE_RAW);
+//printf("sector: %d  new: %d\n", p->sector, sec );
+
+  for(i=0;i<p->cd->tracks;i++){
+//        printf("trk #%d: %d .. %d\n",i,p->cd->disc_toc[i].dwStartSector,p->cd->disc_toc[i+1].dwStartSector);
+	if( p->sector>=p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) {
+		current_track = i;
+	}
+	if( sec>=p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) {
+		seeked_track = i;
+		seek_to_track = sec == p->cd->disc_toc[i].dwStartSector;
+	}
+  }
+//printf("current: %d, seeked: %d\n", current_track, seeked_track);
+	if (current_track != seeked_track && !seek_to_track) {
+//printf("Track %d, sector=%d\n", seeked_track, sec);
+		  cd_track = cd_info_get_track(p->cd_info, seeked_track+1);
+		  if( cd_track!=NULL ) {
+			  mp_msg(MSGT_SEEK, MSGL_INFO, "\n%s\n", cd_track->name);
+			  mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDA_TRACK=%d\n", cd_track->track_nb);
+		  }
+
+	}
+#if 0
+  if(sec < p->start_sector)
+    sec = p->start_sector;
+  else if(sec > p->end_sector)
+    sec = p->end_sector;
+#endif
+
+  p->sector = sec;
+//  s->pos = sec*CD_FRAMESIZE_RAW;
+
+//printf("seek: %d, sec: %d\n", (int)s->pos, sec);
+  paranoia_seek(p->cdp,sec,SEEK_SET);
+  return 1;
+}
+
+static void close_cdda(stream_t* s) {
+  cdda_priv* p = (cdda_priv*)s->priv;
+  paranoia_free(p->cdp);
+  cdda_close(p->cd);
+  cd_info_free(p->cd_info);
+  free(p);
+}
 
 static int get_track_by_sector(cdda_priv *p, unsigned int sector) {
   int i;
@@ -356,113 +459,6 @@ static int open_cdda(stream_t *st,int m,
   return STREAM_OK;
 }
 
-#ifndef CONFIG_LIBCDIO
-static void cdparanoia_callback(long inpos, int function) {
-#else
-static void cdparanoia_callback(long int inpos, paranoia_cb_mode_t function) {
-#endif
-}
-
-static int fill_buffer(stream_t* s, char* buffer, int max_len) {
-  cdda_priv* p = (cdda_priv*)s->priv;
-  cd_track_t *cd_track;
-  int16_t * buf;
-  int i;
-
-  if((p->sector < p->start_sector) || (p->sector > p->end_sector)) {
-    s->eof = 1;
-    return 0;
-  }
-
-  buf = paranoia_read(p->cdp,cdparanoia_callback);
-  if (!buf)
-    return 0;
-
-#if HAVE_BIGENDIAN
-  for(i=0;i<CD_FRAMESIZE_RAW/2;i++)
-          buf[i]=le2me_16(buf[i]);
-#endif
-
-  p->sector++;
-  memcpy(buffer,buf,CD_FRAMESIZE_RAW);
-
-  for(i=0;i<p->cd->tracks;i++){
-	  if(p->cd->disc_toc[i].dwStartSector==p->sector-1) {
-		  cd_track = cd_info_get_track(p->cd_info, i+1);
-//printf("Track %d, sector=%d\n", i, p->sector-1);
-		  if( cd_track!=NULL ) {
-			mp_msg(MSGT_SEEK, MSGL_INFO, "\n%s\n", cd_track->name);
-			mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDA_TRACK=%d\n", cd_track->track_nb);
-		  }
-		  break;
-	  }
-  }
-
-
-  return CD_FRAMESIZE_RAW;
-}
-
-static int seek(stream_t* s,off_t newpos) {
-  cdda_priv* p = (cdda_priv*)s->priv;
-  cd_track_t *cd_track;
-  int sec;
-  int current_track=0, seeked_track=0;
-  int seek_to_track = 0;
-  int i;
-
-  s->pos = newpos;
-  sec = s->pos/CD_FRAMESIZE_RAW;
-  if (s->pos < 0 || sec > p->end_sector) {
-    s->eof = 1;
-    return 0;
-  }
-
-//printf("pos: %d, sec: %d ## %d\n", (int)s->pos, (int)sec, CD_FRAMESIZE_RAW);
-//printf("sector: %d  new: %d\n", p->sector, sec );
-
-  for(i=0;i<p->cd->tracks;i++){
-//        printf("trk #%d: %d .. %d\n",i,p->cd->disc_toc[i].dwStartSector,p->cd->disc_toc[i+1].dwStartSector);
-	if( p->sector>=p->cd->disc_toc[i].dwStartSector && p->sector<p->cd->disc_toc[i+1].dwStartSector ) {
-		current_track = i;
-	}
-	if( sec>=p->cd->disc_toc[i].dwStartSector && sec<p->cd->disc_toc[i+1].dwStartSector ) {
-		seeked_track = i;
-		seek_to_track = sec == p->cd->disc_toc[i].dwStartSector;
-	}
-  }
-//printf("current: %d, seeked: %d\n", current_track, seeked_track);
-	if (current_track != seeked_track && !seek_to_track) {
-//printf("Track %d, sector=%d\n", seeked_track, sec);
-		  cd_track = cd_info_get_track(p->cd_info, seeked_track+1);
-		  if( cd_track!=NULL ) {
-			  mp_msg(MSGT_SEEK, MSGL_INFO, "\n%s\n", cd_track->name);
-			  mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDA_TRACK=%d\n", cd_track->track_nb);
-		  }
-
-	}
-#if 0
-  if(sec < p->start_sector)
-    sec = p->start_sector;
-  else if(sec > p->end_sector)
-    sec = p->end_sector;
-#endif
-
-  p->sector = sec;
-//  s->pos = sec*CD_FRAMESIZE_RAW;
-
-//printf("seek: %d, sec: %d\n", (int)s->pos, sec);
-  paranoia_seek(p->cdp,sec,SEEK_SET);
-  return 1;
-}
-
-static void close_cdda(stream_t* s) {
-  cdda_priv* p = (cdda_priv*)s->priv;
-  paranoia_free(p->cdp);
-  cdda_close(p->cd);
-  cd_info_free(p->cd_info);
-  free(p);
-}
-
 const stream_info_t stream_info_cdda = {
   "CDDA",
   "cdda",


More information about the MPlayer-cvslog mailing list