[Mplayer-cvslog] CVS: main/libmpdemux stream_vcd.c,NONE,1.1 open.c,1.77,1.78 stream.h,1.62,1.63 stream.c,1.61,1.62 Makefile,1.56,1.57
Alban Bedel CVS
albeu at mplayerhq.hu
Wed Apr 9 09:31:36 CEST 2003
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv4193/libmpdemux
Modified Files:
open.c stream.h stream.c Makefile
Added Files:
stream_vcd.c
Log Message:
Port vcd to the new API
--- NEW FILE ---
#include "config.h"
#ifdef HAVE_VCD
#include "mp_msg.h"
#include "stream.h"
#include "help_mp.h"
#include "../m_option.h"
#include "../m_struct.h"
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <errno.h>
#ifdef __FreeBSD__
#include <sys/cdrio.h>
#include "vcd_read_fbsd.h"
#elif defined(__NetBSD__)
#include "vcd_read_nbsd.h"
#else
#include "vcd_read.h"
#endif
static struct stream_priv_s {
int track;
char* device;
} stream_priv_dflts = {
1,
DEFAULT_CDROM_DEVICE
};
#define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f)
/// URL definition
static m_option_t stream_opts_fields[] = {
{ "track", ST_OFF(track), CONF_TYPE_INT, M_OPT_MIN, 1, 0, NULL },
{ "device", ST_OFF(device), CONF_TYPE_STRING, 0, 0 ,0, NULL},
/// For url parsing
{ "hostname", ST_OFF(track), CONF_TYPE_INT, M_OPT_MIN, 1, 0, NULL },
{ "filename", ST_OFF(device), CONF_TYPE_STRING, 0, 0 ,0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
static struct m_struct_st stream_opts = {
"vcd",
sizeof(struct stream_priv_s),
&stream_priv_dflts,
stream_opts_fields
};
static int fill_buffer(stream_t *s, char* buffer, int max_len){
return vcd_read(s->priv,buffer);
}
static int seek(stream_t *s,off_t newpos) {
s->pos = newpos;
vcd_set_msf(s->priv,s->pos/VCD_SECTOR_DATA);
return 1;
}
static void close_s(stream_t *stream) {
free(stream->priv);
}
static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
struct stream_priv_s* p = (struct stream_priv_s*)opts;
int ret,ret2,f;
mp_vcd_priv_t* vcd;
#ifdef __FreeBSD__
int bsize = VCD_SECTOR_SIZE;
#endif
if(mode != STREAM_READ) {
m_struct_free(&stream_opts,opts);
return STREAM_UNSUPORTED;
}
f=open(p->device,O_RDONLY);
if(f<0){
mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CdDevNotfound,p->device);
close(f);
m_struct_free(&stream_opts,opts);
return STREAM_ERROR;
}
vcd = vcd_read_toc(f);
if(!vcd) {
mp_msg(MSGT_OPEN,MSGL_ERR,"Failed to get cd toc\n");
close(f);
m_struct_free(&stream_opts,opts);
return STREAM_ERROR;
}
ret2=vcd_get_track_end(vcd,p->track);
if(ret2<0){
mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (get)\n");
close(f);
free(vcd);
m_struct_free(&stream_opts,opts);
return STREAM_ERROR;
}
ret=vcd_seek_to_track(vcd,p->track);
if(ret<0){
mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (seek)\n");
close(f);
free(vcd);
m_struct_free(&stream_opts,opts);
return STREAM_ERROR;
}
mp_msg(MSGT_OPEN,MSGL_V,"VCD start byte position: 0x%X end: 0x%X\n",ret,ret2);
#ifdef __FreeBSD__
if (ioctl (f, CDRIOCSETBLOCKSIZE, &bsize) == -1) {
mp_msg(MSGT_OPEN,MSGL_WARN,"Error in CDRIOCSETBLOCKSIZE");
}
#endif
stream->fd = f;
stream->type = STREAMTYPE_VCD;
stream->sector_size = VCD_SECTOR_DATA;
stream->start_pos=ret;
stream->end_pos=ret2;
stream->priv = vcd;
stream->fill_buffer = fill_buffer;
stream->seek = seek;
stream->close = close_s;
m_struct_free(&stream_opts,opts);
return STREAM_OK;
}
stream_info_t stream_info_vcd = {
"Video CD",
"vcd",
"Albeu",
"based on the code from ???",
open_s,
{ "vcd", NULL },
&stream_opts,
1 // Urls are an option string
};
#endif
Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- open.c 8 Apr 2003 05:14:43 -0000 1.77
+++ open.c 9 Apr 2003 07:31:11 -0000 1.78
@@ -144,37 +144,6 @@
return NULL;
}
-//============ Open VideoCD track ==============
-#ifdef HAVE_VCD
-if(strncmp("vcd://",filename,6) == 0){
- int ret,ret2;
- if(!cdrom_device) cdrom_device=strdup(DEFAULT_CDROM_DEVICE);
- f=open(cdrom_device,O_RDONLY);
- if(f<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CdDevNotfound,cdrom_device);return NULL; }
- vcd_track = filename[6] == '\0' ? 1 : strtol(filename+6,NULL,0);
- if(vcd_track < 1){
- mp_msg(MSGT_OPEN,MSGL_ERR,"Invalid vcd track %s\n",filename+6);
- return NULL;
- }
- vcd_read_toc(f);
- ret2=vcd_get_track_end(f,vcd_track);
- if(ret2<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (get)\n");return NULL;}
- ret=vcd_seek_to_track(f,vcd_track);
- if(ret<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (seek)\n");return NULL;}
- mp_msg(MSGT_OPEN,MSGL_V,"VCD start byte position: 0x%X end: 0x%X\n",ret,ret2);
-#ifdef __FreeBSD__
- if (ioctl (f, CDRIOCSETBLOCKSIZE, &bsize) == -1) {
- perror ( "Error in CDRIOCSETBLOCKSIZE");
- }
-#endif
- stream=new_stream(f,STREAMTYPE_VCD);
- stream->start_pos=ret;
- stream->end_pos=ret2;
- return stream;
-}
-#endif
-
-
// for opening of vcds in bincue files
if(strncmp("cue://",filename,6) == 0){
int ret,ret2;
Index: stream.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- stream.h 6 Apr 2003 16:34:26 -0000 1.62
+++ stream.h 9 Apr 2003 07:31:11 -0000 1.63
@@ -51,9 +51,6 @@
#include "network.h"
#endif
-int vcd_seek_to_track(int fd,int track);
-void vcd_read_toc(int fd);
-
struct stream_st;
typedef struct stream_info_st {
const char *info;
Index: stream.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- stream.c 7 Apr 2003 20:44:06 -0000 1.61
+++ stream.c 9 Apr 2003 07:31:11 -0000 1.62
@@ -29,18 +29,6 @@
#include "cue_read.h"
-#ifdef HAVE_VCD
-
-#ifdef __FreeBSD__
-#include "vcd_read_fbsd.h"
-#elif defined(__NetBSD__)
-#include "vcd_read_nbsd.h"
-#else
-#include "vcd_read.h"
-#endif
-
-#endif
-
//#include "vcd_read_bincue.h"
#ifdef USE_DVDREAD
@@ -49,16 +37,13 @@
void dvd_close(dvd_priv_t *d);
#endif
-#ifdef HAVE_CDDA
-int read_cdda(stream_t* s);
-void seek_cdda(stream_t* s);
-void close_cdda(stream_t* s);
-#endif
-
#ifdef LIBSMBCLIENT
#include "libsmbclient.h"
#endif
+#ifdef HAVE_VCD
+extern stream_info_t stream_info_vcd;
+#endif
#ifdef HAVE_CDDA
extern stream_info_t stream_info_cdda;
#endif
@@ -68,6 +53,9 @@
extern stream_info_t stream_info_file;
stream_info_t* auto_open_streams[] = {
+#ifdef HAVE_VCD
+ &stream_info_vcd,
+#endif
#ifdef HAVE_CDDA
&stream_info_cdda,
#endif
@@ -186,10 +174,6 @@
#else
len=read(s->fd,s->buffer,STREAM_BUFFER_SIZE);break;
#endif
-#ifdef HAVE_VCD
- case STREAMTYPE_VCD:
- len=vcd_read(s->fd,s->buffer);break;
-#endif
case STREAMTYPE_VCDBINCUE:
len=cue_vcd_read(s->buffer);break;
#ifdef USE_DVDNAV
@@ -247,8 +231,6 @@
#else
newpos=pos&(~(STREAM_BUFFER_SIZE-1));break;
#endif
- case STREAMTYPE_VCD:
- newpos=(pos/VCD_SECTOR_DATA)*VCD_SECTOR_DATA;break;
case STREAMTYPE_VCDBINCUE:
newpos=(pos/VCD_SECTOR_DATA)*VCD_SECTOR_DATA;break;
case STREAMTYPE_DVD:
@@ -285,12 +267,6 @@
case STREAMTYPE_SMB:
s->pos=newpos; // real seek
if(smbc_lseek(s->fd,s->pos,SEEK_SET)<0) s->eof=1;
- break;
-#endif
-#ifdef HAVE_VCD
- case STREAMTYPE_VCD:
- s->pos=newpos; // real seek
- vcd_set_msf(s->pos/VCD_SECTOR_DATA);
break;
#endif
case STREAMTYPE_VCDBINCUE:
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/Makefile,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- Makefile 6 Apr 2003 16:37:12 -0000 1.56
+++ Makefile 9 Apr 2003 07:31:11 -0000 1.57
@@ -3,7 +3,7 @@
include ../config.mak
-SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c demux_gif.c demux_ts.c
+SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c stream_vcd.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c demux_gif.c demux_ts.c
ifeq ($(XMMS_PLUGINS),yes)
SRCS += demux_xmms.c
endif
More information about the MPlayer-cvslog
mailing list