FreeBSD VCD support in mpeglib and some questions

Vladimir Kushnir vkushnir at Alfacom.net
Fri Sep 12 23:56:58 BST 2003


Hello,

Here's a patch to add VCD support for FreeBSD (Net and Open would be a
bit different but not much). It's against -HEAD. Tested with yaf-mpgplay
- it works (as is supposed to :-). BTW, does anything use this input stream?

Secondly, I've got a couple of questions. First off, kaudiocreator
works here under FreeBSD (with cdparanoia) perfectly all right, but
it's marked as Linux-only and I got to compile it manually. Perhaps it
would make sense to tie it to cdparanoia presense instead of
linux/cdrom.h? Just as well works kio_audiocd, though there one has to
#define CDPARANOIA_STATIC to avoid FixupTOC() - I can find no analog to
CDROMMULTISESSION under FreeBSD :-(
And the last for tonight. For some reason xine_artsplugin's thumbnailer
doesn't work for me for quite some time already (again, -HEAD KDE,
FreeBSD-CURRENT, libxine of different versions). It tells that it cannot
load video output "null" and exits with SIGSEGV. Is there any issue or
this is just my luck?

Regards,
Vladimir
-------------- next part --------------
diff --exclude=Makefile.in --exclude=*.orig -crN ../../../ncvs/KDE/ncvs/kdemultimedia/mpeglib/lib/input/cdromAccess.cpp mpeglib/lib/input/cdromAccess.cpp
*** ../../../ncvs/KDE/ncvs/kdemultimedia/mpeglib/lib/input/cdromAccess.cpp	Fri Jun 27 04:40:10 2003
--- mpeglib/lib/input/cdromAccess.cpp	Thu Sep 11 15:55:55 2003
***************
*** 31,37 ****
--- 31,41 ----
  #endif
  
  #ifdef OS_BSD
+ #ifdef __FreeBSD__
+   #include "cdromAccess_FreeBSD.cpp"
+ #else
    #include "cdromAccess_Empty.cpp"
+ #endif
  #endif
  
  #if defined(OS_IRIX) || defined(OS_IRIX64)
diff --exclude=Makefile.in --exclude=*.orig -crN ../../../ncvs/KDE/ncvs/kdemultimedia/mpeglib/lib/input/cdromAccess_FreeBSD.cpp mpeglib/lib/input/cdromAccess_FreeBSD.cpp
*** ../../../ncvs/KDE/ncvs/kdemultimedia/mpeglib/lib/input/cdromAccess_FreeBSD.cpp	Thu Jan  1 03:00:00 1970
--- mpeglib/lib/input/cdromAccess_FreeBSD.cpp	Thu Sep 11 23:24:59 2003
***************
*** 0 ****
--- 1,127 ----
+ /*
+   system dependent wrapper for access to cdrom (Linux)
+   Copyright (C) 1999  Martin Vogt
+ 
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Library General Public License as published by
+   the Free Software Foundation.
+ 
+   For more information look at the file COPYRIGHT in this package
+ 
+  */
+ 
+ 
+ #include "cdromToc.h"
+ #include "cdromRawAccess.h"
+ #include <sys/types.h>
+ #include <sys/cdio.h>
+ #include <sys/ioctl.h>
+ 
+ #include <iostream>
+ 
+ #define CDROM_LEADOUT 0xAA
+ typedef struct {
+   uint8_t sync		[12];
+   uint8_t header	[4];
+   uint8_t subheader	[8];
+   uint8_t data		[2324];
+   uint8_t spare		[4];
+ } cdsector_t;
+ 
+ using namespace std;
+ 
+ /** 
+     here you find an example how to port the access method
+     to your system.
+ */
+ 
+ 
+ int CDRomToc::getStartEnd(FILE* file,int& startToc,int& endToc) {
+   struct ioc_toc_header tochdr;
+   int fd=fileno(file);
+   if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) {
+     perror("ioctl cdioreadtocheader");
+     return false;
+   }
+   
+   startToc=tochdr.starting_track;
+   endToc=tochdr.ending_track;
+   return true;
+ }
+ 
+ 
+ int CDRomToc::readToc(FILE* file,int num,int& min,int& sec, int& frame) {
+   struct ioc_read_toc_single_entry tocent;
+   int fd=fileno(file);
+   tocent.track = num;
+   tocent.address_format = CD_MSF_FORMAT;
+   if (ioctl(fd, CDIOREADTOCENTRY, &tocent) == -1 ) {
+     perror("ioctl cdioreadtocentry");
+     return false;
+   }
+   min=tocent.entry.addr.msf.minute;
+   sec=tocent.entry.addr.msf.second;
+   frame=tocent.entry.addr.msf.frame;
+   return true;
+ }
+ 
+ 
+ int CDRomToc::readLeadOut(FILE* file,int& min,int& sec, int& frame) {
+   struct ioc_read_toc_single_entry tocent;
+   int fd=fileno(file);
+   tocent.track = CDROM_LEADOUT;
+   tocent.address_format = CD_MSF_FORMAT;
+   if (ioctl(fd, CDIOREADTOCENTRY, &tocent) == -1 ) {
+     perror("ioctl cdioreadLeadoutn");
+     return false;
+   }
+   min=tocent.entry.addr.msf.minute;
+   sec=tocent.entry.addr.msf.second;
+   frame=tocent.entry.addr.msf.frame;
+   return true;
+ }
+ 
+ 
+ 
+ int CDRomRawAccess::readDirect(int minute,int second, int frame) {
+ 
+   // this comes from smpeg 
+   // smpeg is an mpeg I player from lokigames www.lokigames.com
+ 
+   off_t pos;
+   int fd=fileno(cdfile);
+ //  cdsector_t buf;
+   
+   pos = frame + (second + minute*60)*75;
+   if (pread(fd, data, 2352, pos*2352) != 2352)
+      return 0;  // End of track?
+ 
+   frame++;
+   if (frame==75) {
+      frame=0;
+      second++;
+      if (second==60) {
+         second=0;
+         minute++;
+      }
+   }
+ 
+ //  char* subheader=data+sizeof(int);
+   char* subheader=data+16;
+ 
+   if ((subheader[1]==1) && 
+       (((subheader[2]==0x62) &&
+ 	(subheader[3]==0x0f)) || ((subheader[2]==0x64) &&
+ 				  (subheader[3]==0x7f)))) {
+     lData=true;
+     dataStart=24;
+ //    memcpy(data, &buf, 2352);
+   } else {
+     lData=false;
+   }
+ 
+   len=2324;
+ 
+   return true;
+ }
+ 
diff --exclude=Makefile.in --exclude=*.orig -crN ../../../ncvs/KDE/ncvs/kdemultimedia/mpeglib/lib/input/cdromRawAccess.cpp mpeglib/lib/input/cdromRawAccess.cpp
*** ../../../ncvs/KDE/ncvs/kdemultimedia/mpeglib/lib/input/cdromRawAccess.cpp	Tue Aug 26 01:45:06 2003
--- mpeglib/lib/input/cdromRawAccess.cpp	Thu Sep 11 15:55:59 2003
***************
*** 14,19 ****
--- 14,22 ----
  #include <iostream>
  
  #include "cdromRawAccess.h"
+ #ifdef __FreeBSD__
+ #include <sys/cdrio.h>
+ #endif
  
  using namespace std;
  
***************
*** 58,63 ****
--- 61,72 ----
    char* openfile=strchr(filename,'/');
    cout << "openfile:"<<openfile<<endl;
    cdfile=fopen(openfile, "rb");
+ #ifdef __FreeBSD__
+   int bsize = 2352;
+   if (ioctl (fileno(cdfile), CDRIOCSETBLOCKSIZE, &bsize) == -1) {
+     perror("cdriocsetblocksize");
+   }
+ #endif
    lOpen=false;
  
    if (cdfile == NULL) {
-------------- next part --------------
_______________________________________________
kde-multimedia mailing list
kde-multimedia at mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-multimedia


More information about the kde-multimedia mailing list