Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
f525191b
Commit
f525191b
authored
Aug 20, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvlc_log_*: deprecated and reimplement as compatibility stubs
parent
6fdf44fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
165 deletions
+42
-165
include/vlc/libvlc.h
include/vlc/libvlc.h
+33
-26
src/control/log.c
src/control/log.c
+9
-139
No files found.
include/vlc/libvlc.h
View file @
f525191b
...
@@ -328,74 +328,81 @@ LIBVLC_API unsigned libvlc_get_log_verbosity( const libvlc_instance_t *p_instanc
...
@@ -328,74 +328,81 @@ LIBVLC_API unsigned libvlc_get_log_verbosity( const libvlc_instance_t *p_instanc
LIBVLC_API
void
libvlc_set_log_verbosity
(
libvlc_instance_t
*
p_instance
,
unsigned
level
);
LIBVLC_API
void
libvlc_set_log_verbosity
(
libvlc_instance_t
*
p_instance
,
unsigned
level
);
/**
/**
* Open a VLC message log instance.
* This function does nothing useful.
* It is only provided for backward compatibility.
*
*
* \param p_instance libvlc instance
* \param p_instance libvlc instance
* \return
log message instance
or NULL on error
* \return
an unique pointer
or NULL on error
*/
*/
LIBVLC_DEPRECATED
LIBVLC_API
libvlc_log_t
*
libvlc_log_open
(
libvlc_instance_t
*
p_instance
);
LIBVLC_API
libvlc_log_t
*
libvlc_log_open
(
libvlc_instance_t
*
p_instance
);
/**
/**
*
Close a VLC message log instance
.
*
Frees memory allocated by libvlc_log_open()
.
*
*
* \param p_log libvlc log instance or NULL
* \param p_log libvlc log instance or NULL
*/
*/
LIBVLC_DEPRECATED
LIBVLC_API
void
libvlc_log_close
(
libvlc_log_t
*
p_log
);
LIBVLC_API
void
libvlc_log_close
(
libvlc_log_t
*
p_log
);
/**
/**
* Returns the number of messages in a log instance.
* Always returns zero.
* This function is only provided for backward compatibility.
*
*
* \param p_log
libvlc log instance or NULL
* \param p_log
ignored
* \return
number of log messages, 0 if p_log is NULL
* \return
always zero
*/
*/
LIBVLC_DEPRECATED
LIBVLC_API
unsigned
libvlc_log_count
(
const
libvlc_log_t
*
p_log
);
LIBVLC_API
unsigned
libvlc_log_count
(
const
libvlc_log_t
*
p_log
);
/**
/**
* Clear a log instance.
* This function does nothing.
*
* It is only provided for backward compatibility.
* All messages in the log are removed. The log should be cleared on a
* regular basis to avoid clogging.
*
*
* \param p_log
libvlc log instance or NULL
* \param p_log
ignored
*/
*/
LIBVLC_DEPRECATED
LIBVLC_API
void
libvlc_log_clear
(
libvlc_log_t
*
p_log
);
LIBVLC_API
void
libvlc_log_clear
(
libvlc_log_t
*
p_log
);
/**
/**
* Allocate and returns a new iterator to messages in log.
* This function does nothing useful.
* It is only provided for backward compatibility.
*
*
* \param p_log
libvlc log instance
* \param p_log
ignored
* \return
log iterator object or NULL on error
* \return
an unique pointer or NULL on error or if the parameter was NULL
*/
*/
LIBVLC_DEPRECATED
LIBVLC_API
libvlc_log_iterator_t
*
libvlc_log_get_iterator
(
const
libvlc_log_t
*
p_log
);
LIBVLC_API
libvlc_log_iterator_t
*
libvlc_log_get_iterator
(
const
libvlc_log_t
*
p_log
);
/**
/**
*
Release a previoulsy allocated iterator
.
*
Frees memory allocated by libvlc_log_get_iterator()
.
*
*
* \param p_iter libvlc log iterator or NULL
* \param p_iter libvlc log iterator or NULL
*/
*/
LIBVLC_DEPRECATED
LIBVLC_API
void
libvlc_log_iterator_free
(
libvlc_log_iterator_t
*
p_iter
);
LIBVLC_API
void
libvlc_log_iterator_free
(
libvlc_log_iterator_t
*
p_iter
);
/**
/**
* Return whether log iterator has more messages.
* Always returns zero.
* This function is only provided for backward compatibility.
*
*
* \param p_iter libvlc log iterator or NULL
* \param p_iter ignored
* \return true if iterator has more message objects, else false
* \return always zero
*
* \libvlc_return_bool
*/
*/
LIBVLC_DEPRECATED
LIBVLC_API
int
libvlc_log_iterator_has_next
(
const
libvlc_log_iterator_t
*
p_iter
);
LIBVLC_API
int
libvlc_log_iterator_has_next
(
const
libvlc_log_iterator_t
*
p_iter
);
/**
/**
* Return the next log message.
* Always returns NULL.
*
* This function is only provided for backward compatibility.
* The message contents must not be freed
*
*
* \param p_iter libvlc log iterator or NULL
* \param p_iter libvlc log iterator or NULL
* \param p_buffer
log buffer
* \param p_buffer
ignored
* \return
log message object or NULL if none left
* \return
always NULL
*/
*/
LIBVLC_DEPRECATED
LIBVLC_API
libvlc_log_message_t
*
libvlc_log_iterator_next
(
libvlc_log_iterator_t
*
p_iter
,
LIBVLC_API
libvlc_log_message_t
*
libvlc_log_iterator_next
(
libvlc_log_iterator_t
*
p_iter
,
libvlc_log_message_t
*
p_buffer
);
libvlc_log_message_t
*
p_buffer
);
/** @} */
/** @} */
...
...
src/control/log.c
View file @
f525191b
...
@@ -30,51 +30,9 @@
...
@@ -30,51 +30,9 @@
#include <vlc/libvlc.h>
#include <vlc/libvlc.h>
#include <assert.h>
#include <assert.h>
/* This API is terminally broken.
* First, it does not implement any kind of notification.
* Second, the iterating scheme is hermetic to any kind of thread-safety
* owing to its constant pointer constraints.
* -- Courmisch
*
* "If you break your leg, don't run to me for sympathy"
* -- some character, Beneath a Steel Sky
*/
typedef
struct
{
vlc_spinlock_t
lock
;
msg_item_t
*
items
[
VLC_MSG_QSIZE
];
unsigned
count
;
int
verbosity
;
}
msg_cb_data_t
;
static
void
handler
(
void
*
opaque
,
const
msg_item_t
*
p_item
)
{
msg_cb_data_t
*
d
=
opaque
;
if
(
p_item
->
i_type
>
d
->
verbosity
)
return
;
msg_item_t
*
msg
=
msg_Copy
(
p_item
);
vlc_spin_lock
(
&
d
->
lock
);
if
(
d
->
count
<
VLC_MSG_QSIZE
)
d
->
items
[
d
->
count
++
]
=
msg
;
vlc_spin_unlock
(
&
d
->
lock
);
}
struct
libvlc_log_t
struct
libvlc_log_t
{
{
libvlc_instance_t
*
p_instance
;
libvlc_instance_t
*
p_instance
;
msg_subscription_t
*
p_messages
;
msg_cb_data_t
data
;
};
struct
libvlc_log_iterator_t
{
msg_cb_data_t
*
p_data
;
unsigned
i_pos
;
unsigned
i_end
;
};
};
unsigned
libvlc_get_log_verbosity
(
const
libvlc_instance_t
*
p_instance
)
unsigned
libvlc_get_log_verbosity
(
const
libvlc_instance_t
*
p_instance
)
...
@@ -91,95 +49,29 @@ void libvlc_set_log_verbosity( libvlc_instance_t *p_instance, unsigned level )
...
@@ -91,95 +49,29 @@ void libvlc_set_log_verbosity( libvlc_instance_t *p_instance, unsigned level )
libvlc_log_t
*
libvlc_log_open
(
libvlc_instance_t
*
p_instance
)
libvlc_log_t
*
libvlc_log_open
(
libvlc_instance_t
*
p_instance
)
{
{
struct
libvlc_log_t
*
p_log
=
malloc
(
sizeof
(
*
p_log
));
(
void
)
p_instance
;
if
(
unlikely
(
p_log
==
NULL
))
return
malloc
(
1
);
{
libvlc_printerr
(
"Not enough memory"
);
return
NULL
;
}
p_log
->
p_instance
=
p_instance
;
vlc_spin_init
(
&
p_log
->
data
.
lock
);
p_log
->
data
.
count
=
0
;
p_log
->
data
.
verbosity
=
p_instance
->
verbosity
;
p_log
->
p_messages
=
vlc_Subscribe
(
handler
,
&
p_log
->
data
);
if
(
!
p_log
->
p_messages
)
{
free
(
p_log
);
libvlc_printerr
(
"Not enough memory"
);
return
NULL
;
}
libvlc_retain
(
p_instance
);
return
p_log
;
}
}
void
libvlc_log_close
(
libvlc_log_t
*
p_log
)
void
libvlc_log_close
(
libvlc_log_t
*
p_log
)
{
{
if
(
!
p_log
)
return
;
assert
(
p_log
->
p_messages
);
vlc_Unsubscribe
(
p_log
->
p_messages
);
libvlc_release
(
p_log
->
p_instance
);
libvlc_log_clear
(
p_log
);
vlc_spin_destroy
(
&
p_log
->
data
.
lock
);
free
(
p_log
);
free
(
p_log
);
}
}
unsigned
libvlc_log_count
(
const
libvlc_log_t
*
p_log
)
unsigned
libvlc_log_count
(
const
libvlc_log_t
*
p_log
)
{
{
if
(
!
p_log
)
(
void
)
p_log
;
return
0
;
return
0
;
msg_cb_data_t
*
data
=
&
((
libvlc_log_t
*
)
p_log
)
->
data
;
unsigned
ret
;
/* We cannot lock due to constant pointer constraints. Break them.
* Even then, this si not really thread safe anyway. */
vlc_spin_lock
(
&
data
->
lock
);
ret
=
data
->
count
;
vlc_spin_unlock
(
&
data
->
lock
);
return
ret
;
}
}
void
libvlc_log_clear
(
libvlc_log_t
*
p_log
)
void
libvlc_log_clear
(
libvlc_log_t
*
p_log
)
{
{
if
(
!
p_log
)
(
void
)
p_log
;
return
;
vlc_spin_lock
(
&
p_log
->
data
.
lock
);
msg_item_t
*
tab
[
p_log
->
data
.
count
];
memcpy
(
tab
,
p_log
->
data
.
items
,
sizeof
(
tab
));
p_log
->
data
.
count
=
0
;
vlc_spin_unlock
(
&
p_log
->
data
.
lock
);
for
(
unsigned
i
=
0
;
i
<
sizeof
(
tab
)
/
sizeof
(
tab
[
0
]);
i
++
)
msg_Free
(
tab
[
i
]);
}
}
libvlc_log_iterator_t
*
libvlc_log_get_iterator
(
const
libvlc_log_t
*
p_log
)
libvlc_log_iterator_t
*
libvlc_log_get_iterator
(
const
libvlc_log_t
*
p_log
)
{
{
if
(
p_log
==
NULL
)
return
(
p_log
!=
NULL
)
?
malloc
(
1
)
:
NULL
;
return
NULL
;
struct
libvlc_log_iterator_t
*
p_iter
=
malloc
(
sizeof
(
*
p_iter
));
if
(
unlikely
(
p_iter
==
NULL
))
{
libvlc_printerr
(
"Not enough memory"
);
return
NULL
;
}
/* FIXME: break constant pointer constraints */
msg_cb_data_t
*
data
=
&
((
libvlc_log_t
*
)
p_log
)
->
data
;
vlc_spin_lock
(
&
data
->
lock
);
p_iter
->
p_data
=
data
;
p_iter
->
i_pos
=
0
;
p_iter
->
i_end
=
data
->
count
;
vlc_spin_unlock
(
&
data
->
lock
);
return
p_iter
;
}
}
void
libvlc_log_iterator_free
(
libvlc_log_iterator_t
*
p_iter
)
void
libvlc_log_iterator_free
(
libvlc_log_iterator_t
*
p_iter
)
...
@@ -189,35 +81,13 @@ void libvlc_log_iterator_free( libvlc_log_iterator_t *p_iter )
...
@@ -189,35 +81,13 @@ void libvlc_log_iterator_free( libvlc_log_iterator_t *p_iter )
int
libvlc_log_iterator_has_next
(
const
libvlc_log_iterator_t
*
p_iter
)
int
libvlc_log_iterator_has_next
(
const
libvlc_log_iterator_t
*
p_iter
)
{
{
if
(
!
p_iter
)
(
void
)
p_iter
;
return
0
;
return
0
;
return
p_iter
->
i_pos
!=
p_iter
->
i_end
;
}
}
libvlc_log_message_t
*
libvlc_log_iterator_next
(
libvlc_log_iterator_t
*
p_iter
,
libvlc_log_message_t
*
libvlc_log_iterator_next
(
libvlc_log_iterator_t
*
p_iter
,
libvlc_log_message_t
*
buffer
)
libvlc_log_message_t
*
buffer
)
{
{
unsigned
i_pos
;
(
void
)
p_iter
;
(
void
)
buffer
;
if
(
!
p_iter
)
return
NULL
;
assert
(
buffer
!=
NULL
);
i_pos
=
p_iter
->
i_pos
;
if
(
i_pos
!=
p_iter
->
i_end
)
{
msg_item_t
*
msg
;
vlc_spin_lock
(
&
p_iter
->
p_data
->
lock
);
msg
=
p_iter
->
p_data
->
items
[
i_pos
];
buffer
->
i_severity
=
msg
->
i_type
;
buffer
->
psz_type
=
msg
->
psz_object_type
;
buffer
->
psz_name
=
msg
->
psz_module
;
buffer
->
psz_header
=
msg
->
psz_header
;
buffer
->
psz_message
=
msg
->
psz_msg
;
vlc_spin_unlock
(
&
p_iter
->
p_data
->
lock
);
p_iter
->
i_pos
++
;
return
buffer
;
}
return
NULL
;
return
NULL
;
}
}
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