Mercurial > mplayer.hg
annotate stream/stream_cue.c @ 33432:4ecf8f0b024c
Simplify by using av_strlcpy.
author | reimar |
---|---|
date | Sun, 29 May 2011 12:23:38 +0000 |
parents | cdc8cec139ad |
children | a010c375947c |
rev | line source |
---|---|
30426
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
1 /* |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
2 * VideoCD BinCue |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
3 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
4 * This file is part of MPlayer. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
5 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
6 * MPlayer is free software; you can redistribute it and/or modify |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
9 * (at your option) any later version. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
10 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
11 * MPlayer is distributed in the hope that it will be useful, |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
14 * GNU General Public License for more details. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
15 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
16 * You should have received a copy of the GNU General Public License along |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29920
diff
changeset
|
19 */ |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
20 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
21 #include <stdio.h> |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
22 #include <stdlib.h> |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
23 #include <string.h> |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
24 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
25 #include <sys/types.h> |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
26 #include <sys/stat.h> |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
27 #include <unistd.h> |
8812 | 28 #include <fcntl.h> |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
29 |
8812 | 30 #include "config.h" |
31 #include "mp_msg.h" | |
16967
32e2c59c8e86
[TRIVIAL] More translatables to help_mp and printfs to mp_msg on libmpdemux
reynaldo
parents:
15482
diff
changeset
|
32 #include "help_mp.h" |
8812 | 33 |
34 #include "stream.h" | |
35 | |
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
|
36 #include "help_mp.h" |
17012 | 37 #include "m_option.h" |
38 #include "m_struct.h" | |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
19298
diff
changeset
|
39 #include "libavutil/avstring.h" |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
40 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
41 #define SIZERAW 2352 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
42 #define SIZEISO_MODE1 2048 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
43 #define SIZEISO_MODE2_RAW 2352 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
44 #define SIZEISO_MODE2_FORM1 2048 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
45 #define SIZEISO_MODE2_FORM2 2336 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
46 #define AUDIO 0 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
47 #define MODE1 1 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
48 #define MODE2 2 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
49 #define MODE1_2352 10 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
50 #define MODE2_2352 20 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
51 #define MODE1_2048 30 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
52 #define MODE2_2336 40 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
53 #define UNKNOWN -1 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
54 |
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
|
55 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
|
56 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
|
57 } 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
|
58 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
|
59 }; |
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
|
60 |
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
|
61 #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
|
62 /// URL definition |
25242 | 63 static const m_option_t stream_opts_fields[] = { |
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
|
64 { "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
|
65 { 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
|
66 }; |
25691 | 67 static const struct m_struct_st stream_opts = { |
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
|
68 "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
|
69 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
|
70 &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
|
71 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
|
72 }; |
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
|
73 |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
74 static char cue_filename[256]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
75 static char bincue_path[256]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
76 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
77 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
78 typedef struct track |
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 short mode; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
81 unsigned short minute; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
82 unsigned short second; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
83 unsigned short frame; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
84 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
85 /* (min*60 + sec) * 75 + fps */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
86 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
87 unsigned long start_sector; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
88 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
89 /* = 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
|
90 /* 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
|
91 unsigned long start_offset; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
92 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
93 /* unsigned char num[3]; */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
94 } tTrack; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
95 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
96 /* max 99 tracks on a cd */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
97 static tTrack tracks[100]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
98 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
99 static struct cue_track_pos { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
100 int track; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
101 unsigned short mode; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
102 unsigned short minute; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
103 unsigned short second; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
104 unsigned short frame; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
105 } cue_current_pos; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
106 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
107 /* number of tracks on the cd */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
108 static int nTracks = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
109 |
33424 | 110 static int digits2int(const char s[2], int errval) { |
25704 | 111 uint8_t a = s[0] - '0'; |
112 uint8_t b = s[1] - '0'; | |
113 if (a > 9 || b > 9) | |
114 return errval; | |
115 return a * 10 + b; | |
116 } | |
117 | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
118 /* presumes Line is preloaded with the "current" line of the file */ |
30763 | 119 static int cue_getTrackinfo(FILE *fd_cue, char *Line, tTrack *track) |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
120 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
121 int already_set = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
122 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
123 /* Get the 'mode' */ |
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 /* 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
|
127 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
128 track->mode = UNKNOWN; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
129 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
|
130 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
|
131 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
|
132 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
|
133 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
|
134 } |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25704
diff
changeset
|
135 else return 1; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
136 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
137 /* Get the track indexes */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
138 while(1) { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
139 if(! fgets( Line, 256, fd_cue ) ) { break;} |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
140 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
141 if (strncmp(&Line[2], "TRACK ", 6)==0) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
142 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
143 /* next track starting */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
144 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
145 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
146 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
147 /* 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
|
148 if (strncmp(&Line[4], "INDEX ", 6)==0) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
149 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
150 /* check stuff here so if the answer is false the else stuff below won't be executed */ |
25704 | 151 if ((already_set == 0) && digits2int(Line + 10, 100) <= 1) |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
152 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
153 already_set = 1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
154 |
25704 | 155 track->minute = digits2int(Line + 13, 0); |
156 track->second = digits2int(Line + 16, 0); | |
157 track->frame = digits2int(Line + 19, 0); | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
158 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
159 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
160 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
|
161 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
|
162 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
|
163 MSGTR_MPDEMUX_CUEREAD_UnexpectedCuefileLine, Line); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
164 } |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25704
diff
changeset
|
165 return 0; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
166 } |
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 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
169 |
12646 | 170 /* FIXME: the string operations ( strcpy,strcat ) below depend |
171 * on the arrays to have the same size, thus we need to make | |
172 * sure the sizes are in sync. | |
173 */ | |
33424 | 174 static int cue_find_bin (const char *firstline) { |
33429
2e2a56ca2d0b
Only accept regular files as .bin files for .cue files.
reimar
parents:
33428
diff
changeset
|
175 struct stat filestat; |
30760
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
176 const char *cur_name; |
30762 | 177 char bin_filename[256]; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
178 char s[256]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
179 char t[256]; |
30763 | 180 int fd_bin; |
33428
043d9e61e043
Ensure 0-termination even if line does not start with FILE "
reimar
parents:
33427
diff
changeset
|
181 int i = 0; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
182 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
183 /* get the filename out of that */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
184 /* 12345 6 */ |
15482 | 185 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
|
186 if (strncmp(firstline, "FILE \"",6)==0) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
187 { |
33423 | 188 firstline += 6; |
33426 | 189 while ( *firstline && *firstline != '"') |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
190 { |
33423 | 191 bin_filename[i] = *firstline++; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
192 |
33422 | 193 /* if I found a path info, then delete all before it */ |
33423 | 194 switch (bin_filename[i]) |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
195 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
196 case '\\': |
33423 | 197 i = 0; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
198 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
199 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
200 case '/': |
33423 | 201 i = 0; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
202 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
203 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
204 default: |
33423 | 205 i++; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
206 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
207 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
208 } |
33428
043d9e61e043
Ensure 0-termination even if line does not start with FILE "
reimar
parents:
33427
diff
changeset
|
209 bin_filename[i] = '\0'; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
210 |
30760
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
211 fd_bin = -1; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
212 for (i = 0; fd_bin == -1 && i < 6; i++) { |
33431
cdc8cec139ad
Avoid possible crash if cue filename is very short.
reimar
parents:
33430
diff
changeset
|
213 if (i > 1 && strlen(cue_filename) < 3) |
cdc8cec139ad
Avoid possible crash if cue filename is very short.
reimar
parents:
33430
diff
changeset
|
214 break; |
30760
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
215 switch (i) { |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
216 case 0: |
30761 | 217 /* now try to open that file, without path */ |
30760
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
218 cur_name = bin_filename; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
219 break; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
220 case 1: |
30761 | 221 /* now try to find it with the path of the cue file */ |
222 snprintf(s,sizeof( s ),"%s/%s",bincue_path,bin_filename); | |
30760
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
223 cur_name = s; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
224 break; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
225 case 2: |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
226 /* now I would say the whole filename is shit, build our own */ |
33432 | 227 av_strlcpy(s, cue_filename, strlen(cue_filename) - 3 ); |
228 strcat(s, ".bin"); | |
30760
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
229 cur_name = s; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
230 break; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
231 case 3: |
30761 | 232 /* ok try it with path */ |
233 snprintf(t, sizeof( t ), "%s/%s", bincue_path, s); | |
30760
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
234 cur_name = t; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
235 break; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
236 case 4: |
30761 | 237 /* now I would say the whole filename is shit, build our own */ |
33432 | 238 av_strlcpy(s, cue_filename, strlen(cue_filename) - 3 ); |
239 strcat(s, ".img"); | |
30760
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
240 cur_name = s; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
241 break; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
242 case 5: |
30761 | 243 /* ok try it with path */ |
244 snprintf(t, sizeof( t ), "%s/%s", bincue_path, s); | |
30760
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
245 cur_name = t; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
246 break; |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
247 } |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
248 fd_bin = open(cur_name, O_RDONLY); |
33429
2e2a56ca2d0b
Only accept regular files as .bin files for .cue files.
reimar
parents:
33428
diff
changeset
|
249 if (fstat(fd_bin, &filestat) == -1 || !S_ISREG(filestat.st_mode)) { |
2e2a56ca2d0b
Only accept regular files as .bin files for .cue files.
reimar
parents:
33428
diff
changeset
|
250 close(fd_bin); |
2e2a56ca2d0b
Only accept regular files as .bin files for .cue files.
reimar
parents:
33428
diff
changeset
|
251 fd_bin = -1; |
2e2a56ca2d0b
Only accept regular files as .bin files for .cue files.
reimar
parents:
33428
diff
changeset
|
252 } |
30760
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
253 if (fd_bin == -1) { |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
254 mp_msg(MSGT_OPEN,MSGL_STATUS, MSGTR_MPDEMUX_CUEREAD_BinFilenameTested, |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
255 cur_name); |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
256 } |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
257 } |
937621eaa290
Avoid code duplication and excessively deep nesting in cue_find_bin
reimar
parents:
30759
diff
changeset
|
258 |
30761 | 259 if (fd_bin == -1) |
260 { | |
261 /* I'll give up */ | |
262 mp_msg(MSGT_OPEN,MSGL_ERR, | |
263 MSGTR_MPDEMUX_CUEREAD_CannotFindBinFile); | |
264 return -1; | |
265 } | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
266 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
267 mp_msg(MSGT_OPEN,MSGL_INFO, |
30762 | 268 MSGTR_MPDEMUX_CUEREAD_UsingBinFile, cur_name); |
30763 | 269 return fd_bin; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
270 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
271 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
272 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
|
273 return frame + (second + minute * 60 ) * 75; |
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 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17012
diff
changeset
|
276 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
|
277 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
|
278 cue_current_pos.second, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
279 cue_current_pos.frame); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
280 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
281 |
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
|
282 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
|
283 cue_current_pos.frame=sect%75; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
284 sect=sect/75; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
285 cue_current_pos.second=sect%60; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
286 sect=sect/60; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
287 cue_current_pos.minute=sect; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
288 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
289 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
290 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
|
291 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
292 switch (mode) |
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 case AUDIO: return AUDIO; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
295 case MODE1_2352: return SIZERAW; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
296 case MODE1_2048: return SIZEISO_MODE1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
297 case MODE2_2352: return SIZEISO_MODE2_RAW; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
298 case MODE2_2336: return SIZEISO_MODE2_FORM2; |
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 default: |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
301 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
|
302 MSGTR_MPDEMUX_CUEREAD_UnknownModeForBinfile); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
303 abort(); |
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 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
306 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
307 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
308 |
33424 | 309 static int cue_read_cue (const char *in_cue_filename) |
8782
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 struct stat filestat; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
312 char sLine[256]; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
313 unsigned int sect; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
314 char *s,*t; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
315 int i; |
30763 | 316 int fd_bin; |
317 FILE *fd_cue; | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
318 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
319 /* we have no tracks at the beginning */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
320 nTracks = 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
321 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
322 /* 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
|
323 s = strdup(in_cue_filename); |
8815 | 324 t = strrchr(s, '/'); |
33425 | 325 if (!t) |
8815 | 326 t = "."; |
327 else { | |
328 *t = '\0'; | |
329 t = s; | |
8817
84522accebc0
10l, hopefully correct fix, before path was always overwritten to '/'
atmos4
parents:
8815
diff
changeset
|
330 if (*t == '\0') |
8815 | 331 strcpy(t, "/"); |
332 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26756
diff
changeset
|
333 |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
19298
diff
changeset
|
334 av_strlcpy(bincue_path,t,sizeof( bincue_path )); |
15482 | 335 mp_msg(MSGT_OPEN,MSGL_V,"dirname: %s, cuepath: %s\n", t, bincue_path); |
30772
191606885380
Fix memleak due to strdup'd filename not being freed.
reimar
parents:
30771
diff
changeset
|
336 free(s); |
191606885380
Fix memleak due to strdup'd filename not being freed.
reimar
parents:
30771
diff
changeset
|
337 s = t = NULL; |
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 /* no path at all? */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
340 if (strcmp(bincue_path, ".") == 0) { |
15477 | 341 mp_msg(MSGT_OPEN,MSGL_V,"bincue_path: %s\n", bincue_path); |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
19298
diff
changeset
|
342 av_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
|
343 } else { |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
19298
diff
changeset
|
344 av_strlcpy(cue_filename,in_cue_filename + strlen(bincue_path) + 1, |
12646 | 345 sizeof( cue_filename )); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
346 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
347 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
348 |
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 /* open the cue file */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
351 fd_cue = fopen (in_cue_filename, "r"); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
352 if (fd_cue == NULL) |
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 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
|
355 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
|
356 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
357 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
358 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
359 /* 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
|
360 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
|
361 |
30759 | 362 if(! fgets( sLine, sizeof(sLine), fd_cue ) ) |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
363 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
364 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
|
365 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
|
366 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
367 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
368 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
369 |
30763 | 370 fd_bin = cue_find_bin(sLine); |
371 if (fd_bin == -1) { | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
372 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
373 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
374 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
375 |
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 /* now build the track list */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
378 /* red the next line and call our track finder */ |
30759 | 379 if(! fgets( sLine, sizeof(sLine), fd_cue ) ) |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
380 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
381 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
|
382 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
|
383 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
384 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
385 } |
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 while(!feof(fd_cue)) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
388 { |
30763 | 389 if (cue_getTrackinfo(fd_cue, sLine, &tracks[nTracks++]) != 0) |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
390 { |
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_ErrReadingFromCueFile, in_cue_filename); |
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 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
398 /* 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
|
399 if (fstat (fd_bin, &filestat) == -1) { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
400 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
|
401 MSGTR_MPDEMUX_CUEREAD_ErrGettingBinFileSize); |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
402 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
403 return -1; |
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 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
406 sect = filestat.st_size / 2352; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
407 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
408 tracks[nTracks].frame = sect%75; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
409 sect=sect/75; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
410 tracks[nTracks].second = sect%60; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
411 sect=sect/60; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
412 tracks[nTracks].minute = sect; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
413 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
414 |
11000 | 415 /* 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
|
416 for(i = 0; i <= nTracks; i++) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
417 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
418 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
|
419 tracks[nTracks].second, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
420 tracks[nTracks].frame); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
421 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
422 /* 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
|
423 if (i == 0) |
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 /* 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
|
426 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
|
427 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
|
428 } else |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
429 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
430 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
|
431 (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
|
432 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
|
433 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
434 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
435 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
436 fclose (fd_cue); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
437 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
438 return fd_bin; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
439 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
440 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
441 |
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 |
30768
6032dd934340
Ensure that cue_current_pos.track is not set to an invalid value after
reimar
parents:
30767
diff
changeset
|
444 static int cue_read_toc_entry(int track) { |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
445 /* check if its a valid track, if not return -1 */ |
30768
6032dd934340
Ensure that cue_current_pos.track is not set to an invalid value after
reimar
parents:
30767
diff
changeset
|
446 if (track <= 0 || track > nTracks) |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
447 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
448 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
449 |
30768
6032dd934340
Ensure that cue_current_pos.track is not set to an invalid value after
reimar
parents:
30767
diff
changeset
|
450 cue_current_pos.track = track; |
6032dd934340
Ensure that cue_current_pos.track is not set to an invalid value after
reimar
parents:
30767
diff
changeset
|
451 track--; |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
452 switch (tracks[track].mode) |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
453 { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
454 case AUDIO: |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
455 cue_current_pos.mode = AUDIO; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
456 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
457 case MODE1_2352: |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
458 cue_current_pos.mode = MODE1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
459 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
460 case MODE1_2048: |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
461 cue_current_pos.mode = MODE1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
462 break; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
463 default: /* MODE2_2352 and MODE2_2336 */ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
464 cue_current_pos.mode = MODE2; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
465 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
466 cue_current_pos.minute = tracks[track].minute; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
467 cue_current_pos.second = tracks[track].second; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
468 cue_current_pos.frame = tracks[track].frame; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
469 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
470 return 0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
471 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
472 |
30771
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
473 static int cue_vcd_get_track_end (int track){ |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
474 int sector = cue_msf_2_sector(tracks[track].minute, tracks[track].second, |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
475 tracks[track].frame); |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
476 |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
477 return VCD_SECTOR_DATA * sector; |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
478 } |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
479 |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
480 static int seek(stream_t *s,off_t newpos) { |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
481 s->pos=newpos; |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
482 cue_set_msf(s->pos/VCD_SECTOR_DATA); |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
483 return 1; |
51a05cd3fa06
Move functions into proper order to avoid extra declarations.
reimar
parents:
30770
diff
changeset
|
484 } |
30770 | 485 |
486 static int cue_vcd_seek_to_track (stream_t *stream, int track){ | |
487 int pos; | |
30768
6032dd934340
Ensure that cue_current_pos.track is not set to an invalid value after
reimar
parents:
30767
diff
changeset
|
488 if (cue_read_toc_entry (track)) |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
489 return -1; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
490 |
30770 | 491 pos = VCD_SECTOR_DATA * cue_get_msf(); |
492 stream->start_pos = pos; | |
493 stream->end_pos = cue_vcd_get_track_end(track); | |
494 seek(stream, pos); | |
495 return pos; | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
496 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
497 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
17012
diff
changeset
|
498 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
|
499 int i; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
500 for (i = 0; i < nTracks; ++i) { |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
501 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
502 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
|
503 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
|
504 i+1, |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
505 tracks[i].mode, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
506 tracks[i].minute, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
507 tracks[i].second, |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
508 tracks[i].frame |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
509 ); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
510 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
511 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
512 |
15477 | 513 static int cue_vcd_read(stream_t *stream, char *mem, int size) { |
514 unsigned long position; | |
30763 | 515 int fd_bin = stream->fd; |
15477 | 516 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
|
517 |
15477 | 518 position = tracks[track].start_offset + |
519 (cue_msf_2_sector(cue_current_pos.minute, | |
520 cue_current_pos.second, | |
521 cue_current_pos.frame) - | |
522 tracks[track].start_sector) | |
523 * 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
|
524 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26756
diff
changeset
|
525 |
15477 | 526 if(position >= tracks[track+1].start_offset) |
527 return 0; | |
528 | |
15482 | 529 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
|
530 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_MPDEMUX_CUEREAD_UnexpectedBinFileEOF); |
15477 | 531 return 0; |
532 } | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
533 |
15477 | 534 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
|
535 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_MPDEMUX_CUEREAD_CannotReadNBytesOfPayload, VCD_SECTOR_DATA); |
15477 | 536 return 0; |
537 } | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
538 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
539 cue_current_pos.frame++; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
540 if (cue_current_pos.frame==75){ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
541 cue_current_pos.frame=0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
542 cue_current_pos.second++; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
543 if (cue_current_pos.second==60){ |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
544 cue_current_pos.second=0; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
545 cue_current_pos.minute++; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
546 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
547 } |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
548 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
549 return VCD_SECTOR_DATA; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
diff
changeset
|
550 } |
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
|
551 |
30765
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
552 static int control(stream_t *stream, int cmd, void *arg) { |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
553 switch(cmd) { |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
554 case STREAM_CTRL_GET_NUM_CHAPTERS: |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
555 { |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
556 *(unsigned int *)arg = nTracks; |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
557 return STREAM_OK; |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
558 } |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
559 case STREAM_CTRL_SEEK_TO_CHAPTER: |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
560 { |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
561 int r; |
30767
29588c0eafd3
Fix off-by-one error in chapter<->VCD track conversion.
reimar
parents:
30766
diff
changeset
|
562 unsigned int track = *(unsigned int *)arg + 1; |
30770 | 563 r = cue_vcd_seek_to_track(stream, track); |
30765
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
564 if (r >= 0) { |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
565 return STREAM_OK; |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
566 } |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
567 break; |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
568 } |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
569 case STREAM_CTRL_GET_CURRENT_CHAPTER: |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
570 { |
30767
29588c0eafd3
Fix off-by-one error in chapter<->VCD track conversion.
reimar
parents:
30766
diff
changeset
|
571 *(unsigned int *)arg = cue_current_pos.track - 1; |
30765
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
572 return STREAM_OK; |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
573 } |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
574 } |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
575 return STREAM_UNSUPPORTED; |
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
576 } |
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
|
577 |
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 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
|
579 struct stream_priv_s* p = (struct stream_priv_s*)opts; |
30770 | 580 int ret,f,track = 0; |
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
|
581 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
|
582 |
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 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
|
584 m_struct_free(&stream_opts,opts); |
24257 | 585 return STREAM_UNSUPPORTED; |
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
|
586 } |
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 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
|
588 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
|
589 m_struct_free(&stream_opts,opts); |
24257 | 590 return STREAM_UNSUPPORTED; |
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
|
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 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
|
593 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
|
594 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
|
595 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
|
596 *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
|
597 } |
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 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
|
599 track = 1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26756
diff
changeset
|
600 |
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
|
601 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
|
602 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
|
603 m_struct_free(&stream_opts,opts); |
24257 | 604 return STREAM_UNSUPPORTED; |
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
|
605 } |
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
|
606 cue_vcd_read_toc(); |
30770 | 607 ret=cue_vcd_seek_to_track(stream, track); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26756
diff
changeset
|
608 if(ret<0){ |
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
|
609 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (seek)\n"); |
24257 | 610 return STREAM_UNSUPPORTED; |
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
|
611 } |
30770 | 612 mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_MPDEMUX_CUEREAD_CueStreamInfo_FilenameTrackTracksavail, |
613 filename, track, ret, (int)stream->end_pos); | |
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
|
614 |
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
|
615 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
|
616 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
|
617 stream->sector_size = VCD_SECTOR_DATA; |
29920
4f740437ed2b
Finally rename the STREAM_SEEK define to MP_STREAM_SEEK, there are just too many
reimar
parents:
29263
diff
changeset
|
618 stream->flags = STREAM_READ | MP_STREAM_SEEK_FW; |
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
|
619 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
|
620 stream->seek = seek; |
30765
3e230b384997
Implement cue:// track switching via chapter forward/backward like for audio CDs.
reimar
parents:
30764
diff
changeset
|
621 stream->control = control; |
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
|
622 |
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
|
623 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
|
624 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
|
625 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
|
626 } |
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
|
627 |
25211 | 628 const stream_info_t stream_info_cue = { |
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
|
629 "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
|
630 "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
|
631 "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
|
632 "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
|
633 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
|
634 { "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
|
635 &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
|
636 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
|
637 }; |