Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
7e0c2e1b
Commit
7e0c2e1b
authored
Dec 02, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed INPUT_GET_BOOKMARK locking scheme.
parent
4d60f5b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
30 deletions
+34
-30
src/input/control.c
src/input/control.c
+23
-28
src/input/input.c
src/input/input.c
+9
-1
src/input/input_internal.h
src/input/input_internal.h
+2
-1
No files found.
src/input/control.c
View file @
7e0c2e1b
...
@@ -204,7 +204,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
...
@@ -204,7 +204,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
p_bkmk
->
psz_name
=
NULL
;
p_bkmk
->
psz_name
=
NULL
;
}
}
TAB_APPEND
(
p_input
->
p
->
i_bookmark
,
p_input
->
p
->
bookmark
,
p_bkmk
);
TAB_APPEND
(
p_input
->
p
->
i_bookmark
,
p_input
->
p
->
pp_
bookmark
,
p_bkmk
);
/* Reflect the changes on the object var */
/* Reflect the changes on the object var */
var_Change
(
p_input
,
"bookmark"
,
VLC_VAR_CLEARCHOICES
,
0
,
0
);
var_Change
(
p_input
,
"bookmark"
,
VLC_VAR_CLEARCHOICES
,
0
,
0
);
...
@@ -215,7 +215,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
...
@@ -215,7 +215,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
{
{
val
.
i_int
=
i
;
val
.
i_int
=
i
;
text
.
psz_string
=
p_input
->
p
->
bookmark
[
i
]
->
psz_name
;
text
.
psz_string
=
p_input
->
p
->
pp_
bookmark
[
i
]
->
psz_name
;
var_Change
(
p_input
,
"bookmark"
,
VLC_VAR_ADDCHOICE
,
var_Change
(
p_input
,
"bookmark"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
&
val
,
&
text
);
}
}
...
@@ -236,14 +236,14 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
...
@@ -236,14 +236,14 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
vlc_value_t
val
,
text
;
vlc_value_t
val
,
text
;
int
i
;
int
i
;
p_input
->
p
->
bookmark
[
i_bkmk
]
=
p_bkmk
;
p_input
->
p
->
pp_
bookmark
[
i_bkmk
]
=
p_bkmk
;
/* Reflect the changes on the object var */
/* Reflect the changes on the object var */
var_Change
(
p_input
,
"bookmark"
,
VLC_VAR_CLEARCHOICES
,
0
,
0
);
var_Change
(
p_input
,
"bookmark"
,
VLC_VAR_CLEARCHOICES
,
0
,
0
);
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
{
{
val
.
i_int
=
i
;
val
.
i_int
=
i
;
text
.
psz_string
=
p_input
->
p
->
bookmark
[
i
]
->
psz_name
;
text
.
psz_string
=
p_input
->
p
->
pp_
bookmark
[
i
]
->
psz_name
;
var_Change
(
p_input
,
"bookmark"
,
VLC_VAR_ADDCHOICE
,
var_Change
(
p_input
,
"bookmark"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
&
val
,
&
text
);
}
}
...
@@ -263,8 +263,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
...
@@ -263,8 +263,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
vlc_value_t
val
,
text
;
vlc_value_t
val
,
text
;
int
i
;
int
i
;
p_bkmk
=
p_input
->
p
->
bookmark
[
i_bkmk
];
p_bkmk
=
p_input
->
p
->
pp_
bookmark
[
i_bkmk
];
TAB_REMOVE
(
p_input
->
p
->
i_bookmark
,
p_input
->
p
->
bookmark
,
TAB_REMOVE
(
p_input
->
p
->
i_bookmark
,
p_input
->
p
->
pp_
bookmark
,
p_bkmk
);
p_bkmk
);
vlc_seekpoint_Delete
(
p_bkmk
);
vlc_seekpoint_Delete
(
p_bkmk
);
...
@@ -273,7 +273,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
...
@@ -273,7 +273,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
{
{
val
.
i_int
=
i
;
val
.
i_int
=
i
;
text
.
psz_string
=
p_input
->
p
->
bookmark
[
i
]
->
psz_name
;
text
.
psz_string
=
p_input
->
p
->
pp_
bookmark
[
i
]
->
psz_name
;
var_Change
(
p_input
,
"bookmark"
,
VLC_VAR_ADDCHOICE
,
var_Change
(
p_input
,
"bookmark"
,
VLC_VAR_ADDCHOICE
,
&
val
,
&
text
);
&
val
,
&
text
);
}
}
...
@@ -302,7 +302,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
...
@@ -302,7 +302,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
{
{
(
*
ppp_bkmk
)[
i
]
=
(
*
ppp_bkmk
)[
i
]
=
vlc_seekpoint_Duplicate
(
p_input
->
p
->
bookmark
[
i
]);
vlc_seekpoint_Duplicate
(
p_input
->
p
->
pp_
bookmark
[
i
]);
}
}
vlc_mutex_unlock
(
&
p_input
->
p
->
p_item
->
lock
);
vlc_mutex_unlock
(
&
p_input
->
p
->
p_item
->
lock
);
...
@@ -327,8 +327,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
...
@@ -327,8 +327,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
for
(
i
=
p_input
->
p
->
i_bookmark
-
1
;
i
>=
0
;
i
--
)
for
(
i
=
p_input
->
p
->
i_bookmark
-
1
;
i
>=
0
;
i
--
)
{
{
p_bkmk
=
p_input
->
p
->
bookmark
[
i
];
p_bkmk
=
p_input
->
p
->
pp_
bookmark
[
i
];
TAB_REMOVE
(
p_input
->
p
->
i_bookmark
,
p_input
->
p
->
bookmark
,
TAB_REMOVE
(
p_input
->
p
->
i_bookmark
,
p_input
->
p
->
pp_
bookmark
,
p_bkmk
);
p_bkmk
);
vlc_seekpoint_Delete
(
p_bkmk
);
vlc_seekpoint_Delete
(
p_bkmk
);
}
}
...
@@ -349,12 +349,12 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
...
@@ -349,12 +349,12 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
vlc_value_t
pos
;
vlc_value_t
pos
;
int
i_ret
;
int
i_ret
;
if
(
p_input
->
p
->
bookmark
[
i_bkmk
]
->
i_time_offset
!=
-
1
)
if
(
p_input
->
p
->
pp_
bookmark
[
i_bkmk
]
->
i_time_offset
!=
-
1
)
{
{
pos
.
i_time
=
p_input
->
p
->
bookmark
[
i_bkmk
]
->
i_time_offset
;
pos
.
i_time
=
p_input
->
p
->
pp_
bookmark
[
i_bkmk
]
->
i_time_offset
;
i_ret
=
var_Set
(
p_input
,
"time"
,
pos
);
i_ret
=
var_Set
(
p_input
,
"time"
,
pos
);
}
}
else
if
(
p_input
->
p
->
bookmark
[
i_bkmk
]
->
i_byte_offset
!=
-
1
)
else
if
(
p_input
->
p
->
pp_
bookmark
[
i_bkmk
]
->
i_byte_offset
!=
-
1
)
{
{
// don't crash on bookmarks in live streams
// don't crash on bookmarks in live streams
if
(
stream_Size
(
p_input
->
p
->
input
.
p_stream
)
==
0
)
if
(
stream_Size
(
p_input
->
p
->
input
.
p_stream
)
==
0
)
...
@@ -363,7 +363,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
...
@@ -363,7 +363,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
pos
.
f_float
=
!
p_input
->
p
->
input
.
p_stream
?
0
:
pos
.
f_float
=
!
p_input
->
p
->
input
.
p_stream
?
0
:
p_input
->
p
->
bookmark
[
i_bkmk
]
->
i_byte_offset
/
p_input
->
p
->
pp_
bookmark
[
i_bkmk
]
->
i_byte_offset
/
stream_Size
(
p_input
->
p
->
input
.
p_stream
);
stream_Size
(
p_input
->
p
->
input
.
p_stream
);
i_ret
=
var_Set
(
p_input
,
"position"
,
pos
);
i_ret
=
var_Set
(
p_input
,
"position"
,
pos
);
}
}
...
@@ -387,14 +387,9 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
...
@@ -387,14 +387,9 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
case
INPUT_GET_BOOKMARK
:
case
INPUT_GET_BOOKMARK
:
p_bkmk
=
(
seekpoint_t
*
)
va_arg
(
args
,
seekpoint_t
*
);
p_bkmk
=
(
seekpoint_t
*
)
va_arg
(
args
,
seekpoint_t
*
);
memset
(
p_bkmk
,
0
,
sizeof
(
*
p_bkmk
)
);
vlc_mutex_lock
(
&
p_input
->
p
->
p_item
->
lock
);
p_bkmk
->
psz_name
=
NULL
;
*
p_bkmk
=
p_input
->
p
->
bookmark
;
p_bkmk
->
i_level
=
0
;
vlc_mutex_unlock
(
&
p_input
->
p
->
p_item
->
lock
);
p_bkmk
->
i_byte_offset
=
0
;
/* FIXME not safe at all ! */
if
(
p_input
->
p
->
input
.
p_stream
)
p_bkmk
->
i_byte_offset
=
stream_Tell
(
p_input
->
p
->
input
.
p_stream
);
p_bkmk
->
i_time_offset
=
var_GetTime
(
p_input
,
"time"
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
case
INPUT_ADD_OPTION
:
case
INPUT_ADD_OPTION
:
...
@@ -510,18 +505,18 @@ static void UpdateBookmarksOption( input_thread_t *p_input )
...
@@ -510,18 +505,18 @@ static void UpdateBookmarksOption( input_thread_t *p_input )
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
{
{
i_len
+=
snprintf
(
NULL
,
0
,
"{name=%s,bytes=%"
PRId64
",time=%"
PRId64
"}"
,
i_len
+=
snprintf
(
NULL
,
0
,
"{name=%s,bytes=%"
PRId64
",time=%"
PRId64
"}"
,
p_input
->
p
->
bookmark
[
i
]
->
psz_name
,
p_input
->
p
->
pp_
bookmark
[
i
]
->
psz_name
,
p_input
->
p
->
bookmark
[
i
]
->
i_byte_offset
,
p_input
->
p
->
pp_
bookmark
[
i
]
->
i_byte_offset
,
p_input
->
p
->
bookmark
[
i
]
->
i_time_offset
/
1000000
);
p_input
->
p
->
pp_
bookmark
[
i
]
->
i_time_offset
/
1000000
);
}
}
psz_value
=
psz_next
=
malloc
(
i_len
+
p_input
->
p
->
i_bookmark
);
psz_value
=
psz_next
=
malloc
(
i_len
+
p_input
->
p
->
i_bookmark
);
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
for
(
i
=
0
;
i
<
p_input
->
p
->
i_bookmark
;
i
++
)
{
{
sprintf
(
psz_next
,
"{name=%s,bytes=%"
PRId64
",time=%"
PRId64
"}"
,
sprintf
(
psz_next
,
"{name=%s,bytes=%"
PRId64
",time=%"
PRId64
"}"
,
p_input
->
p
->
bookmark
[
i
]
->
psz_name
,
p_input
->
p
->
pp_
bookmark
[
i
]
->
psz_name
,
p_input
->
p
->
bookmark
[
i
]
->
i_byte_offset
,
p_input
->
p
->
pp_
bookmark
[
i
]
->
i_byte_offset
,
p_input
->
p
->
bookmark
[
i
]
->
i_time_offset
/
1000000
);
p_input
->
p
->
pp_
bookmark
[
i
]
->
i_time_offset
/
1000000
);
psz_next
+=
strlen
(
psz_next
);
psz_next
+=
strlen
(
psz_next
);
if
(
i
<
p_input
->
p
->
i_bookmark
-
1
)
if
(
i
<
p_input
->
p
->
i_bookmark
-
1
)
...
...
src/input/input.c
View file @
7e0c2e1b
...
@@ -181,7 +181,8 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
...
@@ -181,7 +181,8 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
p_input
->
i_state
=
INIT_S
;
p_input
->
i_state
=
INIT_S
;
p_input
->
p
->
i_rate
=
INPUT_RATE_DEFAULT
;
p_input
->
p
->
i_rate
=
INPUT_RATE_DEFAULT
;
p_input
->
p
->
b_recording
=
false
;
p_input
->
p
->
b_recording
=
false
;
TAB_INIT
(
p_input
->
p
->
i_bookmark
,
p_input
->
p
->
bookmark
);
memset
(
&
p_input
->
p
->
bookmark
,
0
,
sizeof
(
p_input
->
p
->
bookmark
)
);
TAB_INIT
(
p_input
->
p
->
i_bookmark
,
p_input
->
p
->
pp_bookmark
);
TAB_INIT
(
p_input
->
p
->
i_attachment
,
p_input
->
p
->
attachment
);
TAB_INIT
(
p_input
->
p
->
i_attachment
,
p_input
->
p
->
attachment
);
p_input
->
p
->
p_es_out_display
=
NULL
;
p_input
->
p
->
p_es_out_display
=
NULL
;
p_input
->
p
->
p_es_out
=
NULL
;
p_input
->
p
->
p_es_out
=
NULL
;
...
@@ -690,6 +691,13 @@ static void MainLoopInterface( input_thread_t *p_input )
...
@@ -690,6 +691,13 @@ static void MainLoopInterface( input_thread_t *p_input )
i_length
=
0
;
i_length
=
0
;
es_out_SetTimes
(
p_input
->
p
->
p_es_out
,
f_position
,
i_time
,
i_length
);
es_out_SetTimes
(
p_input
->
p
->
p_es_out
,
f_position
,
i_time
,
i_length
);
/* update current bookmark */
vlc_mutex_lock
(
&
p_input
->
p
->
p_item
->
lock
);
p_input
->
p
->
bookmark
.
i_time_offset
=
i_time
;
if
(
p_input
->
p
->
input
.
p_stream
)
p_input
->
p
->
bookmark
.
i_byte_offset
=
stream_Tell
(
p_input
->
p
->
input
.
p_stream
);
vlc_mutex_unlock
(
&
p_input
->
p
->
p_item
->
lock
);
}
}
/**
/**
...
...
src/input/input_internal.h
View file @
7e0c2e1b
...
@@ -98,8 +98,9 @@ struct input_thread_private_t
...
@@ -98,8 +98,9 @@ struct input_thread_private_t
int
i_seekpoint_offset
;
int
i_seekpoint_offset
;
/* User bookmarks FIXME won't be easy with multiples input */
/* User bookmarks FIXME won't be easy with multiples input */
seekpoint_t
bookmark
;
int
i_bookmark
;
int
i_bookmark
;
seekpoint_t
**
bookmark
;
seekpoint_t
**
pp_
bookmark
;
/* Input attachment */
/* Input attachment */
int
i_attachment
;
int
i_attachment
;
...
...
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