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
d20c8d66
Commit
d20c8d66
authored
Nov 22, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved statistic update from sout to input.
It allows to avoid the inclusion of input_internal.h
parent
087f8dc2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
28 deletions
+77
-28
src/input/input.c
src/input/input.c
+39
-0
src/input/input_interface.h
src/input/input_interface.h
+19
-1
src/stream_output/stream_output.c
src/stream_output/stream_output.c
+19
-27
No files found.
src/input/input.c
View file @
d20c8d66
...
@@ -3154,6 +3154,45 @@ bool input_AddSubtitles( input_thread_t *p_input, char *psz_subtitle,
...
@@ -3154,6 +3154,45 @@ bool input_AddSubtitles( input_thread_t *p_input, char *psz_subtitle,
return
true
;
return
true
;
}
}
/*****************************************************************************
* Statistics
*****************************************************************************/
void
input_UpdateStatistic
(
input_thread_t
*
p_input
,
input_statistic_t
i_type
,
int
i_delta
)
{
assert
(
p_input
->
i_state
!=
INIT_S
);
vlc_mutex_lock
(
&
p_input
->
p
->
counters
.
counters_lock
);
switch
(
i_type
)
{
#define I(c) stats_UpdateInteger( p_input, p_input->p->counters.c, i_delta, NULL )
case
INPUT_STATISTIC_DECODED_VIDEO
:
I
(
p_decoded_video
);
break
;
case
INPUT_STATISTIC_DECODED_AUDIO
:
I
(
p_decoded_audio
);
break
;
case
INPUT_STATISTIC_DECODED_SUBTITLE
:
I
(
p_decoded_sub
);
break
;
case
INPUT_STATISTIC_SENT_PACKET
:
I
(
p_sout_sent_packets
);
break
;
#undef I
case
INPUT_STATISTIC_SENT_BYTE
:
{
int
i_bytes
;
/* That's pretty stupid to define it as an integer, it will overflow
really fast ... */
if
(
!
stats_UpdateInteger
(
p_input
,
p_input
->
p
->
counters
.
p_sout_sent_bytes
,
i_delta
,
&
i_bytes
)
)
stats_UpdateFloat
(
p_input
,
p_input
->
p
->
counters
.
p_sout_send_bitrate
,
i_bytes
,
NULL
);
break
;
}
default:
msg_Err
(
p_input
,
"Invalid statistic type %d (internal error)"
,
i_type
);
break
;
}
vlc_mutex_unlock
(
&
p_input
->
p
->
counters
.
counters_lock
);
}
/*****************************************************************************
/*****************************************************************************
* input_get_event_manager
* input_get_event_manager
*****************************************************************************/
*****************************************************************************/
...
...
src/input/input_interface.h
View file @
d20c8d66
...
@@ -39,7 +39,7 @@ int input_DownloadAndCacheArt( playlist_t *, input_item_t * );
...
@@ -39,7 +39,7 @@ int input_DownloadAndCacheArt( playlist_t *, input_item_t * );
void
input_item_SetPreparsed
(
input_item_t
*
p_i
,
bool
b_preparsed
);
void
input_item_SetPreparsed
(
input_item_t
*
p_i
,
bool
b_preparsed
);
typedef
struct
playlist_album_t
typedef
struct
{
{
char
*
psz_artist
;
char
*
psz_artist
;
char
*
psz_album
;
char
*
psz_album
;
...
@@ -61,4 +61,22 @@ input_thread_t *__input_CreateThreadExtended ( vlc_object_t *, input_item_t *, c
...
@@ -61,4 +61,22 @@ input_thread_t *__input_CreateThreadExtended ( vlc_object_t *, input_item_t *, c
sout_instance_t
*
input_DetachSout
(
input_thread_t
*
p_input
);
sout_instance_t
*
input_DetachSout
(
input_thread_t
*
p_input
);
/* */
typedef
enum
{
INPUT_STATISTIC_DECODED_VIDEO
,
INPUT_STATISTIC_DECODED_AUDIO
,
INPUT_STATISTIC_DECODED_SUBTITLE
,
/* Use them only if you do not goes through a access_out module */
INPUT_STATISTIC_SENT_PACKET
,
INPUT_STATISTIC_SENT_BYTE
,
}
input_statistic_t
;
/**
* It will update internal input statistics from external sources.
* XXX For now, the only one allowed to do it is stream_out and input core.
*/
void
input_UpdateStatistic
(
input_thread_t
*
,
input_statistic_t
,
int
i_delta
);
#endif
#endif
src/stream_output/stream_output.c
View file @
d20c8d66
...
@@ -42,8 +42,9 @@
...
@@ -42,8 +42,9 @@
#include "stream_output.h"
#include "stream_output.h"
#include <vlc_meta.h>
#include <vlc_meta.h>
#include <vlc_block.h>
#include "input/input_inter
nal
.h"
#include "input/input_inter
face
.h"
#undef DEBUG_BUFFER
#undef DEBUG_BUFFER
/*****************************************************************************
/*****************************************************************************
...
@@ -154,52 +155,43 @@ void sout_DeleteInstance( sout_instance_t * p_sout )
...
@@ -154,52 +155,43 @@ void sout_DeleteInstance( sout_instance_t * p_sout )
*****************************************************************************/
*****************************************************************************/
void
sout_UpdateStatistic
(
sout_instance_t
*
p_sout
,
sout_statistic_t
i_type
,
int
i_delta
)
void
sout_UpdateStatistic
(
sout_instance_t
*
p_sout
,
sout_statistic_t
i_type
,
int
i_delta
)
{
{
input_thread_t
*
p_input
;
if
(
!
libvlc_stats
(
p_sout
)
)
int
i_bytes
;
/* That's pretty stupid to define it as an integer, it will overflow
really fast ... */
if
(
!
libvlc_stats
(
p_sout
)
)
return
;
return
;
/* FIXME that's ugly
/* */
* TODO add a private (ie not VLC_EXPORTed) input_UpdateStatistic for that */
input_thread_t
*
p_input
=
vlc_object_find
(
p_sout
,
VLC_OBJECT_INPUT
,
FIND_PARENT
);
p_input
=
vlc_object_find
(
p_sout
,
VLC_OBJECT_INPUT
,
FIND_PARENT
);
if
(
!
p_input
)
if
(
!
p_input
||
p_input
->
i_state
==
INIT_S
||
p_input
->
i_state
==
ERROR_S
)
return
;
return
;
int
i_input_type
;
switch
(
i_type
)
switch
(
i_type
)
{
{
#define I(c) stats_UpdateInteger( p_input, p_input->p->counters.c, i_delta, NULL )
case
SOUT_STATISTIC_DECODED_VIDEO
:
case
SOUT_STATISTIC_DECODED_VIDEO
:
I
(
p_decoded_video
)
;
i_input_type
=
SOUT_STATISTIC_DECODED_VIDEO
;
break
;
break
;
case
SOUT_STATISTIC_DECODED_AUDIO
:
case
SOUT_STATISTIC_DECODED_AUDIO
:
I
(
p_decoded_audio
)
;
i_input_type
=
SOUT_STATISTIC_DECODED_AUDIO
;
break
;
break
;
case
SOUT_STATISTIC_DECODED_SUBTITLE
:
case
SOUT_STATISTIC_DECODED_SUBTITLE
:
I
(
p_decoded_sub
)
;
i_input_type
=
SOUT_STATISTIC_DECODED_SUBTITLE
;
break
;
break
;
#if 0
case SOUT_STATISTIC_ENCODED_VIDEO:
case SOUT_STATISTIC_ENCODED_AUDIO:
case SOUT_STATISTIC_ENCODED_SUBTITLE:
msg_Warn( p_sout, "Not yet supported statistic type %d", i_type );
break;
#endif
case
SOUT_STATISTIC_SENT_PACKET
:
case
SOUT_STATISTIC_SENT_PACKET
:
I
(
p_sout_sent_packets
)
;
i_input_type
=
SOUT_STATISTIC_SENT_PACKET
;
break
;
break
;
#undef I
case
SOUT_STATISTIC_SENT_BYTE
:
case
SOUT_STATISTIC_SENT_BYTE
:
if
(
!
stats_UpdateInteger
(
p_input
,
p_input
->
p
->
counters
.
p_sout_sent_bytes
,
i_delta
,
&
i_bytes
)
)
i_input_type
=
SOUT_STATISTIC_SENT_BYTE
;
stats_UpdateFloat
(
p_input
,
p_input
->
p
->
counters
.
p_sout_send_bitrate
,
i_bytes
,
NULL
);
break
;
break
;
default:
default:
msg_Err
(
p_sout
,
"Invalid statistic type %d (internal error)"
,
i_type
);
msg_Err
(
p_sout
,
"Not yet supported statistic type %d"
,
i_type
);
break
;
vlc_object_release
(
p_input
);
return
;
}
}
input_UpdateStatistic
(
p_input
,
i_input_type
,
i_delta
);
vlc_object_release
(
p_input
);
vlc_object_release
(
p_input
);
}
}
/*****************************************************************************
/*****************************************************************************
...
...
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