Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
828eb5fe
Commit
828eb5fe
authored
Jul 07, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cdda: fix error handling
parent
96095a84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
31 deletions
+42
-31
modules/access/cdda.c
modules/access/cdda.c
+42
-31
No files found.
modules/access/cdda.c
View file @
828eb5fe
...
...
@@ -466,36 +466,49 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
/* Build title table */
for
(
int
i
=
0
;
i
<
i_titles
;
i
++
)
{
input_item_t
*
p_input_item
;
char
*
psz_uri
,
*
psz_opt
,
*
psz_first
,
*
psz_last
;
char
*
psz_name
;
char
*
psz_uri
,
*
psz_opt
,
*
psz_name
;
msg_Dbg
(
p_access
,
"track[%d] start=%d"
,
i
,
p_sys
->
p_sectors
[
i
]
);
/* */
if
(
asprintf
(
&
psz_uri
,
"cdda://%s"
,
p_access
->
psz_location
)
==
-
1
)
psz_uri
=
NULL
;
if
(
asprintf
(
&
psz_opt
,
"cdda-track=%i"
,
i
+
1
)
==
-
1
)
psz_opt
=
NULL
;
if
(
asprintf
(
&
psz_first
,
"cdda-first-sector=%i"
,
p_sys
->
p_sectors
[
i
]
)
==
-
1
)
psz_first
=
NULL
;
if
(
asprintf
(
&
psz_last
,
"cdda-last-sector=%i"
,
p_sys
->
p_sectors
[
i
+
1
]
)
==
-
1
)
psz_last
=
NULL
;
continue
;
/* Define a "default name" */
if
(
asprintf
(
&
psz_name
,
_
(
"Audio CD - Track %02i"
),
(
i
+
1
)
)
==
-
1
)
psz_name
=
NULL
;
psz_name
=
psz_uri
;
/* Create playlist items */
const
mtime_t
i_duration
=
(
int64_t
)(
p_sys
->
p_sectors
[
i
+
1
]
-
p_sys
->
p_sectors
[
i
]
)
*
CDDA_DATA_SIZE
*
1000000
/
44100
/
2
/
2
;
p_input_item
=
input_item_NewWithType
(
psz_uri
,
psz_name
,
0
,
NULL
,
0
,
i_duration
,
ITEM_TYPE_DISC
);
input_item_CopyOptions
(
p_current
,
p_input_item
);
input_item_AddOption
(
p_input_item
,
psz_first
,
VLC_INPUT_OPTION_TRUSTED
);
input_item_AddOption
(
p_input_item
,
psz_last
,
VLC_INPUT_OPTION_TRUSTED
);
input_item_AddOption
(
p_input_item
,
psz_opt
,
VLC_INPUT_OPTION_TRUSTED
);
input_item_t
*
p_item
=
input_item_NewWithType
(
psz_uri
,
psz_name
,
0
,
NULL
,
0
,
i_duration
,
ITEM_TYPE_DISC
);
if
(
likely
(
psz_name
!=
psz_uri
)
)
free
(
psz_name
);
free
(
psz_uri
);
if
(
unlikely
(
p_item
==
NULL
)
)
continue
;
input_item_CopyOptions
(
p_current
,
p_item
);
if
(
likely
(
asprintf
(
&
psz_opt
,
"cdda-track=%i"
,
i
+
1
)
!=
-
1
)
)
{
input_item_AddOption
(
p_item
,
psz_opt
,
VLC_INPUT_OPTION_TRUSTED
);
free
(
psz_opt
);
}
if
(
likely
(
asprintf
(
&
psz_opt
,
"cdda-first-sector=%i"
,
p_sys
->
p_sectors
[
i
]
)
!=
-
1
)
)
{
input_item_AddOption
(
p_item
,
psz_opt
,
VLC_INPUT_OPTION_TRUSTED
);
free
(
psz_opt
);
}
if
(
likely
(
asprintf
(
&
psz_opt
,
"cdda-last-sector=%i"
,
p_sys
->
p_sectors
[
i
+
1
]
)
!=
-
1
)
)
{
input_item_AddOption
(
p_item
,
psz_opt
,
VLC_INPUT_OPTION_TRUSTED
);
free
(
psz_opt
);
}
const
char
*
psz_track_title
=
NULL
;
const
char
*
psz_track_artist
=
NULL
;
...
...
@@ -534,33 +547,31 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
/* */
if
(
NONEMPTY
(
psz_track_title
)
)
{
input_item_SetName
(
p_i
nput_i
tem
,
psz_track_title
);
input_item_SetTitle
(
p_i
nput_i
tem
,
psz_track_title
);
input_item_SetName
(
p_item
,
psz_track_title
);
input_item_SetTitle
(
p_item
,
psz_track_title
);
}
if
(
NONEMPTY
(
psz_track_artist
)
)
input_item_SetArtist
(
p_i
nput_i
tem
,
psz_track_artist
);
input_item_SetArtist
(
p_item
,
psz_track_artist
);
if
(
NONEMPTY
(
psz_track_genre
)
)
input_item_SetGenre
(
p_i
nput_i
tem
,
psz_track_genre
);
input_item_SetGenre
(
p_item
,
psz_track_genre
);
if
(
NONEMPTY
(
psz_track_description
)
)
input_item_SetDescription
(
p_i
nput_i
tem
,
psz_track_description
);
input_item_SetDescription
(
p_item
,
psz_track_description
);
if
(
NONEMPTY
(
psz_album
)
)
input_item_SetAlbum
(
p_i
nput_i
tem
,
psz_album
);
input_item_SetAlbum
(
p_item
,
psz_album
);
if
(
NONEMPTY
(
psz_year
)
)
input_item_SetDate
(
p_i
nput_i
tem
,
psz_year
);
input_item_SetDate
(
p_item
,
psz_year
);
char
psz_num
[
3
+
1
];
snprintf
(
psz_num
,
sizeof
(
psz_num
),
"%d"
,
1
+
i
);
input_item_SetTrackNum
(
p_i
nput_i
tem
,
psz_num
);
input_item_SetTrackNum
(
p_item
,
psz_num
);
input_item_node_AppendItem
(
p_root
,
p_input_item
);
vlc_gc_decref
(
p_input_item
);
free
(
psz_uri
);
free
(
psz_opt
);
free
(
psz_name
);
free
(
psz_first
);
free
(
psz_last
);
input_item_node_AppendItem
(
p_root
,
p_item
);
vlc_gc_decref
(
p_item
);
}
#undef ON_EMPTY
#undef NONEMPTY
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment