Mercurial > mplayer.hg
annotate stream/stream_cue.c @ 22153:0cf24df5d97b
Revert part of commit r22170.
FFmpeg lavcodecs version is still
(or according to ffmpeg commit r7868, it's back to)
49.3.0, so global variables are not yet directly accessable (if ever).
author | iive |
---|---|
date | Wed, 07 Feb 2007 12:31:37 +0000 |
parents | bbce98bb6d05 |
children | 9fb716ab06a3 |
rev | line source |
---|---|
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
1 //=================== VideoCD BinCue ========================== |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
2 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
3 #include <stdio.h> |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
4 #include <stdlib.h> |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
5 #include <string.h> |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
6 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
7 #include <sys/types.h> |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
8 #include <sys/stat.h> |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
9 #include <unistd.h> |
8812 | 10 #include <fcntl.h> |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
11 |
8812 | 12 #include "config.h" |
13 #include "mp_msg.h" | |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
14 #include "help_mp.h" |
8812 | 15 |
16 #include "stream.h" | |
17 | |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
18 #include "help_mp.h" |
17012 | 19 #include "m_option.h" |
20 #include "m_struct.h" | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
21 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
22 #define byte unsigned char |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
23 #define SIZERAW 2352 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
24 #define SIZEISO_MODE1 2048 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
25 #define SIZEISO_MODE2_RAW 2352 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
26 #define SIZEISO_MODE2_FORM1 2048 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
27 #define SIZEISO_MODE2_FORM2 2336 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
28 #define AUDIO 0 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
29 #define MODE1 1 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
30 #define MODE2 2 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
31 #define MODE1_2352 10 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
32 #define MODE2_2352 20 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
33 #define MODE1_2048 30 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
34 #define MODE2_2336 40 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
35 #define UNKNOWN -1 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
36 |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
37 static struct stream_priv_s { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
38 char* filename; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
39 } stream_priv_dflts = { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
40 NULL |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
41 }; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
42 |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
43 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f) |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
44 /// URL definition |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
45 static m_option_t stream_opts_fields[] = { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
46 { "string", ST_OFF(filename), CONF_TYPE_STRING, 0, 0 ,0, NULL}, |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
47 { NULL, NULL, 0, 0, 0, 0, NULL } |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
48 }; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
49 static struct m_struct_st stream_opts = { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
50 "cue", |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
51 sizeof(struct stream_priv_s), |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
52 &stream_priv_dflts, |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
53 stream_opts_fields |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
54 }; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
55 |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
56 static FILE* fd_cue; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
57 static int fd_bin = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
58 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
59 static char bin_filename[256]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
60 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
61 static char cue_filename[256]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
62 static char bincue_path[256]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
63 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
64 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
65 typedef struct track |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
66 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
67 unsigned short mode; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
68 unsigned short minute; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
69 unsigned short second; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
70 unsigned short frame; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
71 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
72 /* (min*60 + sec) * 75 + fps */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
73 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
74 unsigned long start_sector; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
75 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
76 /* = the sizes in bytes off all tracks bevor this one */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
77 /* its needed if there are mode1 tracks befor the mpeg tracks */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
78 unsigned long start_offset; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
79 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
80 /* unsigned char num[3]; */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
81 } tTrack; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
82 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
83 /* max 99 tracks on a cd */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
84 static tTrack tracks[100]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
85 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
86 static struct cue_track_pos { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
87 int track; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
88 unsigned short mode; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
89 unsigned short minute; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
90 unsigned short second; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
91 unsigned short frame; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
92 } cue_current_pos; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
93 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
94 /* number of tracks on the cd */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
95 static int nTracks = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
96 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
97 /* presumes Line is preloaded with the "current" line of the file */ |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
98 static int cue_getTrackinfo(char *Line, tTrack *track) |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
99 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
100 char inum[3]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
101 char min; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
102 char sec; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
103 char fps; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
104 int already_set = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
105 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
106 /* Get the 'mode' */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
107 if (strncmp(&Line[2], "TRACK ", 6)==0) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
108 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
109 /* strncpy(track->num, &Line[8], 2); track->num[2] = '\0'; */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
110 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
111 track->mode = UNKNOWN; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
112 if(strncmp(&Line[11], "AUDIO", 5)==0) track->mode = AUDIO; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
113 if(strncmp(&Line[11], "MODE1/2352", 10)==0) track->mode = MODE1_2352; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
114 if(strncmp(&Line[11], "MODE1/2048", 10)==0) track->mode = MODE1_2048; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
115 if(strncmp(&Line[11], "MODE2/2352", 10)==0) track->mode = MODE2_2352; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
116 if(strncmp(&Line[11], "MODE2/2336", 10)==0) track->mode = MODE2_2336; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
117 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
118 else return(1); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
119 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
120 /* Get the track indexes */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
121 while(1) { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
122 if(! fgets( Line, 256, fd_cue ) ) { break;} |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
123 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
124 if (strncmp(&Line[2], "TRACK ", 6)==0) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
125 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
126 /* next track starting */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
127 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
128 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
129 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
130 /* Track 0 or 1, take the first an get fill the values*/ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
131 if (strncmp(&Line[4], "INDEX ", 6)==0) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
132 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
133 /* check stuff here so if the answer is false the else stuff below won't be executed */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
134 strncpy(inum, &Line[10], 2); inum[2] = '\0'; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
135 if ((already_set == 0) && |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
136 ((strcmp(inum, "00")==0) || (strcmp(inum, "01")==0))) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
137 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
138 already_set = 1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
139 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
140 min = ((Line[13]-'0')<<4) | (Line[14]-'0'); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
141 sec = ((Line[16]-'0')<<4) | (Line[17]-'0'); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
142 fps = ((Line[19]-'0')<<4) | (Line[20]-'0'); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
143 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
144 track->minute = (((min>>4)*10) + (min&0xf)); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
145 track->second = (((sec>>4)*10) + (sec&0xf)); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
146 track->frame = (((fps>>4)*10) + (fps&0xf)); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
147 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
148 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
149 else if (strncmp(&Line[4], "PREGAP ", 7)==0) { ; /* ignore */ } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
150 else if (strncmp(&Line[4], "FLAGS ", 6)==0) { ; /* ignore */ } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
151 else mp_msg (MSGT_OPEN,MSGL_INFO, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
152 MSGTR_MPDEMUX_CUEREAD_UnexpectedCuefileLine, Line); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
153 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
154 return(0); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
155 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
156 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
157 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
158 |
12646 | 159 /* FIXME: the string operations ( strcpy,strcat ) below depend |
160 * on the arrays to have the same size, thus we need to make | |
161 * sure the sizes are in sync. | |
162 */ | |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
163 static int cue_find_bin (char *firstline) { |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
164 int i,j; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
165 char s[256]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
166 char t[256]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
167 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
168 /* get the filename out of that */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
169 /* 12345 6 */ |
15482 | 170 mp_msg (MSGT_OPEN,MSGL_INFO, "[bincue] cue_find_bin(%s)\n", firstline); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
171 if (strncmp(firstline, "FILE \"",6)==0) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
172 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
173 i = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
174 j = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
175 while ( firstline[6 + i] != '"') |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
176 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
177 bin_filename[j] = firstline[6 + i]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
178 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
179 /* if I found a path info, than delete all bevor it */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
180 switch (bin_filename[j]) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
181 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
182 case '\\': |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
183 j = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
184 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
185 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
186 case '/': |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
187 j = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
188 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
189 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
190 default: |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
191 j++; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
192 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
193 i++; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
194 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
195 bin_filename[j+1] = '\0'; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
196 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
197 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
198 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
199 /* now try to open that file, without path */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
200 fd_bin = open (bin_filename, O_RDONLY); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
201 if (fd_bin == -1) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
202 { |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
203 mp_msg(MSGT_OPEN,MSGL_STATUS, MSGTR_MPDEMUX_CUEREAD_BinFilenameTested, |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
204 bin_filename); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
205 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
206 /* now try to find it with the path of the cue file */ |
12646 | 207 snprintf(s,sizeof( s ),"%s/%s",bincue_path,bin_filename); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
208 fd_bin = open (s, O_RDONLY); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
209 if (fd_bin == -1) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
210 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
211 mp_msg(MSGT_OPEN,MSGL_STATUS, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
212 MSGTR_MPDEMUX_CUEREAD_BinFilenameTested, s); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
213 /* now I would say the whole filename is shit, build our own */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
214 strncpy(s, cue_filename, strlen(cue_filename) - 3 ); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
215 s[strlen(cue_filename) - 3] = '\0'; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
216 strcat(s, "bin"); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
217 fd_bin = open (s, O_RDONLY); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
218 if (fd_bin == -1) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
219 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
220 mp_msg(MSGT_OPEN,MSGL_STATUS, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
221 MSGTR_MPDEMUX_CUEREAD_BinFilenameTested, s); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
222 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
223 /* ok try it with path */ |
12646 | 224 snprintf(t, sizeof( t ), "%s/%s", bincue_path, s); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
225 fd_bin = open (t, O_RDONLY); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
226 if (fd_bin == -1) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
227 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
228 mp_msg(MSGT_OPEN,MSGL_STATUS, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
229 MSGTR_MPDEMUX_CUEREAD_BinFilenameTested,t); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
230 /* now I would say the whole filename is shit, build our own */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
231 strncpy(s, cue_filename, strlen(cue_filename) - 3 ); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
232 s[strlen(cue_filename) - 3] = '\0'; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
233 strcat(s, "img"); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
234 fd_bin = open (s, O_RDONLY); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
235 if (fd_bin == -1) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
236 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
237 mp_msg(MSGT_OPEN,MSGL_STATUS, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
238 MSGTR_MPDEMUX_CUEREAD_BinFilenameTested, s); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
239 /* ok try it with path */ |
12646 | 240 snprintf(t, sizeof( t ), "%s/%s", bincue_path, s); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
241 fd_bin = open (t, O_RDONLY); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
242 if (fd_bin == -1) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
243 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
244 mp_msg(MSGT_OPEN,MSGL_STATUS, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
245 MSGTR_MPDEMUX_CUEREAD_BinFilenameTested, s); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
246 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
247 /* I'll give up */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
248 mp_msg(MSGT_OPEN,MSGL_ERR, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
249 MSGTR_MPDEMUX_CUEREAD_CannotFindBinFile); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
250 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
251 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
252 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
253 } else strcpy(bin_filename, t); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
254 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
255 } else strcpy(bin_filename, s); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
256 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
257 } else strcpy(bin_filename, s); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
258 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
259 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
260 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
261 mp_msg(MSGT_OPEN,MSGL_INFO, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
262 MSGTR_MPDEMUX_CUEREAD_UsingBinFile, bin_filename); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
263 return 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
264 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
265 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
266 static inline int cue_msf_2_sector(int minute, int second, int frame) { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
267 return frame + (second + minute * 60 ) * 75; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
268 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
269 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17012
diff
changeset
|
270 static inline int cue_get_msf(void) { |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
271 return cue_msf_2_sector (cue_current_pos.minute, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
272 cue_current_pos.second, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
273 cue_current_pos.frame); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
274 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
275 |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
276 static inline void cue_set_msf(unsigned int sect){ |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
277 cue_current_pos.frame=sect%75; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
278 sect=sect/75; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
279 cue_current_pos.second=sect%60; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
280 sect=sect/60; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
281 cue_current_pos.minute=sect; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
282 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
283 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
284 static inline int cue_mode_2_sector_size(int mode) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
285 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
286 switch (mode) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
287 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
288 case AUDIO: return AUDIO; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
289 case MODE1_2352: return SIZERAW; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
290 case MODE1_2048: return SIZEISO_MODE1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
291 case MODE2_2352: return SIZEISO_MODE2_RAW; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
292 case MODE2_2336: return SIZEISO_MODE2_FORM2; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
293 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
294 default: |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
295 mp_msg(MSGT_OPEN,MSGL_FATAL, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
296 MSGTR_MPDEMUX_CUEREAD_UnknownModeForBinfile); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
297 abort(); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
298 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
299 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
300 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
301 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
302 |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
303 static int cue_read_cue (char *in_cue_filename) |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
304 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
305 struct stat filestat; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
306 char sLine[256]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
307 unsigned int sect; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
308 char *s,*t; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
309 int i; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
310 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
311 /* we have no tracks at the beginning */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
312 nTracks = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
313 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
314 fd_bin = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
315 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
316 /* split the filename into a path and filename part */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
317 s = strdup(in_cue_filename); |
8815 | 318 t = strrchr(s, '/'); |
319 if (t == (char *)NULL) | |
320 t = "."; | |
321 else { | |
322 *t = '\0'; | |
323 t = s; | |
8817
84522accebc0
10l, hopefully correct fix, before path was always overwritten to '/'
atmos4
parents:
8815
diff
changeset
|
324 if (*t == '\0') |
8815 | 325 strcpy(t, "/"); |
326 } | |
15482 | 327 |
12646 | 328 strlcpy(bincue_path,t,sizeof( bincue_path )); |
15482 | 329 mp_msg(MSGT_OPEN,MSGL_V,"dirname: %s, cuepath: %s\n", t, bincue_path); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
330 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
331 /* no path at all? */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
332 if (strcmp(bincue_path, ".") == 0) { |
15477 | 333 mp_msg(MSGT_OPEN,MSGL_V,"bincue_path: %s\n", bincue_path); |
12646 | 334 strlcpy(cue_filename,in_cue_filename,sizeof( cue_filename )); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
335 } else { |
12646 | 336 strlcpy(cue_filename,in_cue_filename + strlen(bincue_path) + 1, |
337 sizeof( cue_filename )); | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
338 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
339 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
340 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
341 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
342 /* open the cue file */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
343 fd_cue = fopen (in_cue_filename, "r"); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
344 if (fd_cue == NULL) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
345 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
346 mp_msg(MSGT_OPEN,MSGL_ERR, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
347 MSGTR_MPDEMUX_CUEREAD_CannotOpenCueFile, in_cue_filename); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
348 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
349 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
350 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
351 /* read the first line and hand it to find_bin, which will |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
352 test more than one possible name of the file */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
353 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
354 if(! fgets( sLine, 256, fd_cue ) ) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
355 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
356 mp_msg(MSGT_OPEN,MSGL_ERR, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
357 MSGTR_MPDEMUX_CUEREAD_ErrReadingFromCueFile, in_cue_filename); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
358 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
359 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
360 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
361 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
362 if (cue_find_bin(sLine)) { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
363 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
364 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
365 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
366 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
367 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
368 /* now build the track list */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
369 /* red the next line and call our track finder */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
370 if(! fgets( sLine, 256, fd_cue ) ) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
371 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
372 mp_msg(MSGT_OPEN,MSGL_ERR, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
373 MSGTR_MPDEMUX_CUEREAD_ErrReadingFromCueFile, in_cue_filename); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
374 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
375 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
376 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
377 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
378 while(!feof(fd_cue)) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
379 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
380 if (cue_getTrackinfo(sLine, &tracks[nTracks++]) != 0) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
381 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
382 mp_msg(MSGT_OPEN,MSGL_ERR, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
383 MSGTR_MPDEMUX_CUEREAD_ErrReadingFromCueFile, in_cue_filename); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
384 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
385 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
386 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
387 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
388 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
389 /* make a fake track with stands for the Lead out */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
390 if (fstat (fd_bin, &filestat) == -1) { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
391 mp_msg(MSGT_OPEN,MSGL_ERR, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
392 MSGTR_MPDEMUX_CUEREAD_ErrGettingBinFileSize); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
393 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
394 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
395 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
396 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
397 sect = filestat.st_size / 2352; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
398 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
399 tracks[nTracks].frame = sect%75; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
400 sect=sect/75; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
401 tracks[nTracks].second = sect%60; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
402 sect=sect/60; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
403 tracks[nTracks].minute = sect; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
404 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
405 |
11000 | 406 /* let's calculate the start sectors and offsets */ |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
407 for(i = 0; i <= nTracks; i++) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
408 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
409 tracks[i].start_sector = cue_msf_2_sector(tracks[i].minute, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
410 tracks[nTracks].second, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
411 tracks[nTracks].frame); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
412 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
413 /* if we're the first track we don't need to offset of the one befor */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
414 if (i == 0) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
415 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
416 /* was always 0 on my svcds, but who knows */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
417 tracks[0].start_offset = tracks[0].start_sector * |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
418 cue_mode_2_sector_size(tracks[0].mode); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
419 } else |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
420 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
421 tracks[i].start_offset = tracks[i-1].start_offset + |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
422 (tracks[i].start_sector - tracks[i-1].start_sector) * |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
423 cue_mode_2_sector_size(tracks[i-1].mode); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
424 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
425 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
426 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
427 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
428 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
429 return fd_bin; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
430 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
431 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
432 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
433 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
434 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17012
diff
changeset
|
435 static int cue_read_toc_entry(void) { |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
436 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
437 int track = cue_current_pos.track - 1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
438 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
439 /* check if its a valid track, if not return -1 */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
440 if (track >= nTracks) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
441 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
442 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
443 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
444 switch (tracks[track].mode) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
445 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
446 case AUDIO: |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
447 cue_current_pos.mode = AUDIO; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
448 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
449 case MODE1_2352: |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
450 cue_current_pos.mode = MODE1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
451 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
452 case MODE1_2048: |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
453 cue_current_pos.mode = MODE1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
454 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
455 default: /* MODE2_2352 and MODE2_2336 */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
456 cue_current_pos.mode = MODE2; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
457 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
458 cue_current_pos.minute = tracks[track].minute; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
459 cue_current_pos.second = tracks[track].second; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
460 cue_current_pos.frame = tracks[track].frame; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
461 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
462 return 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
463 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
464 |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
465 static int cue_vcd_seek_to_track (int track){ |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
466 cue_current_pos.track = track; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
467 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
468 if (cue_read_toc_entry ()) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
469 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
470 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
471 return VCD_SECTOR_DATA * cue_get_msf(); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
472 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
473 |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
474 static int cue_vcd_get_track_end (int track){ |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
475 cue_current_pos.frame = tracks[track].frame; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
476 cue_current_pos.second = tracks[track].second; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
477 cue_current_pos.minute = tracks[track].minute; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
478 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
479 return VCD_SECTOR_DATA * cue_get_msf(); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
480 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
481 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17012
diff
changeset
|
482 static void cue_vcd_read_toc(void){ |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
483 int i; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
484 for (i = 0; i < nTracks; ++i) { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
485 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
486 mp_msg(MSGT_OPEN,MSGL_INFO, |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
487 MSGTR_MPDEMUX_CUEREAD_InfoTrackFormat, |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
488 i+1, |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
489 tracks[i].mode, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
490 tracks[i].minute, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
491 tracks[i].second, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
492 tracks[i].frame |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
493 ); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
494 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
495 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
496 |
15477 | 497 static int cue_vcd_read(stream_t *stream, char *mem, int size) { |
498 unsigned long position; | |
499 int track = cue_current_pos.track - 1; | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
500 |
15477 | 501 position = tracks[track].start_offset + |
502 (cue_msf_2_sector(cue_current_pos.minute, | |
503 cue_current_pos.second, | |
504 cue_current_pos.frame) - | |
505 tracks[track].start_sector) | |
506 * cue_mode_2_sector_size(tracks[track].mode); | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
507 |
15477 | 508 |
509 if(position >= tracks[track+1].start_offset) | |
510 return 0; | |
511 | |
15482 | 512 if(lseek(fd_bin, position+VCD_SECTOR_OFFS, SEEK_SET) == -1) { |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
513 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_MPDEMUX_CUEREAD_UnexpectedBinFileEOF); |
15477 | 514 return 0; |
515 } | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
516 |
15477 | 517 if(read(fd_bin, mem, VCD_SECTOR_DATA) != VCD_SECTOR_DATA) { |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
518 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_MPDEMUX_CUEREAD_CannotReadNBytesOfPayload, VCD_SECTOR_DATA); |
15477 | 519 return 0; |
520 } | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
521 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
522 cue_current_pos.frame++; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
523 if (cue_current_pos.frame==75){ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
524 cue_current_pos.frame=0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
525 cue_current_pos.second++; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
526 if (cue_current_pos.second==60){ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
527 cue_current_pos.second=0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
528 cue_current_pos.minute++; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
529 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
530 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
531 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
532 return VCD_SECTOR_DATA; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
533 } |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
534 |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
535 static int seek(stream_t *s,off_t newpos) { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
536 s->pos=newpos; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
537 cue_set_msf(s->pos/VCD_SECTOR_DATA); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
538 return 1; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
539 } |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
540 |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
541 |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
542 static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
543 struct stream_priv_s* p = (struct stream_priv_s*)opts; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
544 int ret,ret2,f,track = 0; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
545 char *filename = NULL, *colon = NULL; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
546 |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
547 if(mode != STREAM_READ || !p->filename) { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
548 m_struct_free(&stream_opts,opts); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
549 return STREAM_UNSUPORTED; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
550 } |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
551 filename = strdup(p->filename); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
552 if(!filename) { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
553 m_struct_free(&stream_opts,opts); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
554 return STREAM_UNSUPORTED; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
555 } |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
556 colon = strstr(filename, ":"); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
557 if(colon) { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
558 if(strlen(colon)>1) |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
559 track = atoi(colon+1); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
560 *colon = 0; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
561 } |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
562 if(!track) |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
563 track = 1; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
564 |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
565 f = cue_read_cue(filename); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
566 if(f < 0) { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
567 m_struct_free(&stream_opts,opts); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
568 return STREAM_UNSUPORTED; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
569 } |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
570 cue_vcd_read_toc(); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
571 ret2=cue_vcd_get_track_end(track); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
572 ret=cue_vcd_seek_to_track(track); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
573 if(ret<0){ |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
574 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (seek)\n"); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
575 return STREAM_UNSUPORTED; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
576 } |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
577 mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_MPDEMUX_CUEREAD_CueStreamInfo_FilenameTrackTracksavail, filename, track, ret, ret2); |
15476
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
578 |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
579 stream->fd = f; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
580 stream->type = STREAMTYPE_VCDBINCUE; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
581 stream->sector_size = VCD_SECTOR_DATA; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
582 stream->flags = STREAM_READ | STREAM_SEEK_FW; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
583 stream->start_pos = ret; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
584 stream->end_pos = ret2; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
585 stream->fill_buffer = cue_vcd_read; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
586 stream->seek = seek; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
587 |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
588 free(filename); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
589 m_struct_free(&stream_opts,opts); |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
590 return STREAM_OK; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
591 } |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
592 |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
593 stream_info_t stream_info_cue = { |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
594 "CUE track", |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
595 "cue", |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
596 "Albeu", |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
597 "based on the code from ???", |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
598 open_s, |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
599 { "cue", NULL }, |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
600 &stream_opts, |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
601 1 // Urls are an option string |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
602 }; |
5eb4994a691f
ported cue:// to the new stream api; note: this stream must still be optimized in its read() and seek() functions
nicodvb
parents:
12646
diff
changeset
|
603 |