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
34c1ae55
Commit
34c1ae55
authored
Sep 29, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
en50221: avoid one memory copy (refs #12307)
parent
426d8273
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
48 deletions
+14
-48
modules/access/dtv/en50221.c
modules/access/dtv/en50221.c
+14
-48
No files found.
modules/access/dtv/en50221.c
View file @
34c1ae55
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include <assert.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <poll.h>
#include <poll.h>
#include <netinet/in.h>
#include <netinet/in.h>
...
@@ -243,64 +244,29 @@ static void Dump( bool b_outgoing, uint8_t *p_data, int i_size )
...
@@ -243,64 +244,29 @@ static void Dump( bool b_outgoing, uint8_t *p_data, int i_size )
* TPDUSend
* TPDUSend
*****************************************************************************/
*****************************************************************************/
static
int
TPDUSend
(
cam_t
*
p_cam
,
uint8_t
i_slot
,
uint8_t
i_tag
,
static
int
TPDUSend
(
cam_t
*
p_cam
,
uint8_t
i_slot
,
uint8_t
i_tag
,
const
uint8_t
*
p_content
,
in
t
i_length
)
const
uint8_t
*
p_content
,
size_
t
i_length
)
{
{
uint8_t
i_tcid
=
i_slot
+
1
;
uint8_t
p_data
[
9
],
*
p
=
p_data
;
uint8_t
p_data
[
MAX_TPDU_SIZE
];
int
i_size
;
i_size
=
0
;
p_data
[
0
]
=
i_slot
;
p_data
[
1
]
=
i_tcid
;
p_data
[
2
]
=
i_tag
;
switch
(
i_tag
)
{
case
T_RCV
:
case
T_CREATE_TC
:
case
T_CTC_REPLY
:
case
T_DELETE_TC
:
case
T_DTC_REPLY
:
case
T_REQUEST_TC
:
p_data
[
3
]
=
1
;
/* length */
p_data
[
4
]
=
i_tcid
;
i_size
=
5
;
break
;
case
T_NEW_TC
:
case
T_TC_ERROR
:
p_data
[
3
]
=
2
;
/* length */
p_data
[
4
]
=
i_tcid
;
p_data
[
5
]
=
p_content
[
0
];
i_size
=
6
;
break
;
case
T_DATA_LAST
:
*
(
p
++
)
=
i_slot
;
case
T_DATA_MORE
:
*
(
p
++
)
=
i_slot
+
1
;
/* TCID */
{
*
(
p
++
)
=
i_tag
;
/* i_length <= MAX_TPDU_DATA */
uint8_t
*
p
=
p_data
+
3
;
p
=
SetLength
(
p
,
i_length
+
1
);
p
=
SetLength
(
p
,
i_length
+
1
);
*
p
++
=
i_tcid
;
if
(
i_length
)
*
(
p
++
)
=
i_slot
+
1
;
memcpy
(
p
,
p_content
,
i_length
);
Dump
(
true
,
p_data
,
p
-
p_data
);
i_size
=
i_length
+
(
p
-
p_data
);
break
;
}
default:
const
struct
iovec
iov
[
2
]
=
{
break
;
{
p_data
,
p
-
p_data
},
}
{
(
void
*
)
p_content
,
i_length
},
Dump
(
true
,
p_data
,
i_size
)
;
}
;
if
(
write
(
p_cam
->
fd
,
p_data
,
i_size
)
!=
i_size
)
if
(
write
v
(
p_cam
->
fd
,
iov
,
2
)
<=
0
)
{
{
msg_Err
(
p_cam
->
obj
,
"cannot write to CAM device: %s"
,
msg_Err
(
p_cam
->
obj
,
"cannot write to CAM device: %s"
,
vlc_strerror_c
(
errno
)
);
vlc_strerror_c
(
errno
)
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
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