Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
531
Issue boards
Milestones
Wiki
Code
Merge requests
14
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
8c3c7a34
Commit
8c3c7a34
authored
8 years ago
by
Thomas Guillem
Browse files
Options
Downloads
Patches
Plain Diff
LibVLC: Add demuxdump2 module
parent
e279725e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
compile-libvlc.sh
+6
-0
6 additions, 0 deletions
compile-libvlc.sh
libvlc/jni/Android.mk
+9
-0
9 additions, 0 deletions
libvlc/jni/Android.mk
libvlc/jni/modules/demuxdump2.c
+164
-0
164 additions, 0 deletions
libvlc/jni/modules/demuxdump2.c
with
179 additions
and
0 deletions
compile-libvlc.sh
+
6
−
0
View file @
8c3c7a34
...
...
@@ -585,6 +585,7 @@ get_symbol()
}
VLC_MODULES
=
$(
find_modules vlc/
$VLC_BUILD_DIR
/modules
)
EXTRA_MODULES
=
"demuxdump2"
DEFINITION
=
""
;
BUILTINS
=
"const void *vlc_static_modules[] = {
\n
"
;
for
file
in
$VLC_MODULES
;
do
...
...
@@ -617,6 +618,11 @@ EOF
DEFINITION
=
$DEFINITION
"int vlc_entry__
$name
(int (*)(void *, void *, int, ...), void *);
\n
"
;
BUILTINS
=
"
$BUILTINS
vlc_entry__
$name
,
\n
"
;
done
;
for
module
in
${
EXTRA_MODULES
}
;
do
echo
$module
DEFINITION
=
$DEFINITION
"int vlc_entry__
${
module
}
(int (*)(void *, void *, int, ...), void *);
\n
"
;
BUILTINS
=
"
$BUILTINS
vlc_entry__
${
module
}
,
\n
"
;
done
BUILTINS
=
"
$BUILTINS
NULL
\n
};
\n
"
;
\
printf
"/* Autogenerated from the list of modules */
\n
#include <unistd.h>
\n
$DEFINITION
\n
$BUILTINS
\n
"
>
libvlc/jni/libvlcjni-modules.c
...
...
This diff is collapsed.
Click to expand it.
libvlc/jni/Android.mk
+
9
−
0
View file @
8c3c7a34
LOCAL_PATH
:=
$(
call my-dir
)
ANDROID_PRIVATE_LIBDIR
:=
$(
LOCAL_PATH
)
/../../android-libs
include
$(CLEAR_VARS)
LOCAL_MODULE
:=
demuxdump2_plugin
LOCAL_SRC_FILES
+=
modules/demuxdump2.c
LOCAL_C_INCLUDES
:=
$(
VLC_SRC_DIR
)
/include
LOCAL_CFLAGS
:=
-std
=
gnu99
-DMODULE_NAME
=
demuxdump2
-Wall
include
$(BUILD_STATIC_LIBRARY)
include
$(CLEAR_VARS)
LOCAL_MODULE
:=
libvlc
ARCH
=
$(
APP_ABI
)
...
...
@@ -39,6 +47,7 @@ LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
$(
EXTRA_LDFLAGS
)
LOCAL_SHARED_LIBRARIES
:=
libcompat.7
LOCAL_STATIC_LIBRARIES
:=
libdemuxdump2_plugin
include
$(BUILD_SHARED_LIBRARY)
include
$(CLEAR_VARS)
...
...
This diff is collapsed.
Click to expand it.
libvlc/jni/modules/demuxdump2.c
0 → 100644
+
164
−
0
View file @
8c3c7a34
/*****************************************************************************
* demuxdump2.c : Pseudo demux module for vlc (with write status)
*****************************************************************************
* Copyright (C) 2016 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include
<vlc_common.h>
#include
<vlc_plugin.h>
#include
<vlc_demux.h>
#include
<vlc_interrupt.h>
#include
<vlc_input.h>
#include
<vlc_fs.h>
#include
<sys/types.h>
#include
<sys/stat.h>
#include
<fcntl.h>
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
vlc_module_begin
()
set_shortname
(
"Dump"
)
set_category
(
CAT_INPUT
)
set_subcategory
(
SUBCAT_INPUT_DEMUX
)
set_capability
(
"demux"
,
0
)
change_private
()
add_savefile
(
"demuxdump-file"
,
"stream-demux.dump"
,
NULL
,
NULL
,
false
)
change_private
()
set_callbacks
(
Open
,
Close
)
add_shortcut
(
"dump2"
)
vlc_module_end
()
#define READ_ONCE 32768
struct
demux_sys_t
{
void
*
p_buf
;
int
i_out_fd
;
uint64_t
i_size
;
uint64_t
i_written
;
unsigned
int
i_level
;
};
static
void
SendEventCache
(
demux_t
*
p_demux
,
float
f_value
)
{
vlc_value_t
val
;
val
.
f_float
=
f_value
;
var_Change
(
p_demux
->
p_input
,
"cache"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
var_SetInteger
(
p_demux
->
p_input
,
"intf-event"
,
INPUT_EVENT_CACHE
);
}
static
int
Demux
(
demux_t
*
p_demux
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
ssize_t
i_ret
=
stream_Read
(
p_demux
->
s
,
p_sys
->
p_buf
,
READ_ONCE
);
if
(
i_ret
<
0
)
return
-
1
;
else
if
(
i_ret
==
0
)
return
0
;
size_t
i_towrite
=
i_ret
;
size_t
i_written
=
0
;
while
(
i_written
<
i_towrite
)
{
i_ret
=
vlc_write_i11e
(
p_sys
->
i_out_fd
,
p_sys
->
p_buf
+
i_written
,
i_towrite
-
i_written
);
if
(
i_ret
==
-
1
)
return
-
1
;
i_written
+=
i_ret
;
}
p_sys
->
i_written
+=
i_written
;
if
(
p_sys
->
i_size
>
0
)
{
unsigned
int
i_level
=
p_sys
->
i_written
/
(
p_sys
->
i_size
/
(
double
)
100
);
if
(
i_level
!=
p_sys
->
i_level
)
{
p_sys
->
i_level
=
i_level
;
SendEventCache
(
p_demux
,
i_level
/
(
float
)
100
);
}
}
return
1
;
}
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
{
return
demux_vaControlHelper
(
p_demux
->
s
,
0
,
-
1
,
0
,
1
,
i_query
,
args
);
}
static
int
Open
(
vlc_object_t
*
p_this
)
{
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
/* Accept only if forced */
if
(
!
p_demux
->
b_force
)
return
VLC_EGENERIC
;
char
*
psz_path
=
var_InheritString
(
p_demux
,
"demuxdump-file"
);
if
(
psz_path
==
NULL
)
{
msg_Err
(
p_demux
,
"no dump file name given"
);
return
VLC_EGENERIC
;
}
int
i_fd
=
vlc_open
(
psz_path
,
O_CREAT
|
O_WRONLY
);
free
(
psz_path
);
if
(
i_fd
==
-
1
)
return
VLC_EGENERIC
;
demux_sys_t
*
p_sys
=
malloc
(
sizeof
(
*
p_sys
));
if
(
p_sys
==
NULL
)
{
vlc_close
(
i_fd
);
return
VLC_ENOMEM
;
}
p_sys
->
p_buf
=
malloc
(
READ_ONCE
);
if
(
p_sys
->
p_buf
==
NULL
)
{
vlc_close
(
i_fd
);
return
VLC_ENOMEM
;
}
if
(
stream_GetSize
(
p_demux
->
s
,
&
p_sys
->
i_size
)
!=
VLC_SUCCESS
)
p_sys
->
i_size
=
0
;
p_sys
->
i_written
=
0
;
p_sys
->
i_out_fd
=
i_fd
;
p_demux
->
p_sys
=
p_sys
;
p_demux
->
pf_demux
=
Demux
;
p_demux
->
pf_control
=
Control
;
return
VLC_SUCCESS
;
}
static
void
Close
(
vlc_object_t
*
p_this
)
{
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
vlc_close
(
p_sys
->
i_out_fd
);
free
(
p_sys
->
p_buf
);
free
(
p_sys
);
}
This diff is collapsed.
Click to expand it.
Thomas Guillem
@tguillem
mentioned in commit
5b999da8
·
8 years ago
mentioned in commit
5b999da8
mentioned in commit 5b999da862f02aaa7baf1310996dcf1f1e90d091
Toggle commit list
Thomas Guillem
@tguillem
mentioned in commit
128c5716
·
8 years ago
mentioned in commit
128c5716
mentioned in commit 128c5716d1e32ae35ddd04b378dc247b38c82eb3
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment