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
095bb638
Commit
095bb638
authored
Jan 31, 2015
by
Tristan Matthews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add encoder for YCbCr 4:2:0 over RTP (RFC 4175)
parent
8fee495d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
0 deletions
+116
-0
include/vlc_fourcc.h
include/vlc_fourcc.h
+2
-0
modules/codec/Makefile.am
modules/codec/Makefile.am
+6
-0
modules/codec/rtpvideo.c
modules/codec/rtpvideo.c
+108
-0
No files found.
include/vlc_fourcc.h
View file @
095bb638
...
...
@@ -275,6 +275,8 @@
#define VLC_CODEC_CYUV VLC_FOURCC('c','y','u','v')
/* 10-bit 4:2:2 Component YCbCr */
#define VLC_CODEC_V210 VLC_FOURCC('v','2','1','0')
/* I420 packed for RTP (RFC 4175) */
#define VLC_CODEC_R420 VLC_FOURCC('r','4','2','0')
/* RGB */
...
...
modules/codec/Makefile.am
View file @
095bb638
...
...
@@ -99,6 +99,12 @@ codec_LTLIBRARIES += $(LTLIBlibmpeg2)
librawvideo_plugin_la_SOURCES
=
codec/rawvideo.c
codec_LTLIBRARIES
+=
librawvideo_plugin.la
librtpvideo_plugin_la_SOURCES
=
codec/rtpvideo.c
if
ENABLE_SOUT
codec_LTLIBRARIES
+=
librtpvideo_plugin.la
endif
libschroedinger_plugin_la_SOURCES
=
codec/schroedinger.c
libschroedinger_plugin_la_CFLAGS
=
$(AM_CFLAGS)
$(CFLAGS_schroedinger)
libschroedinger_plugin_la_LDFLAGS
=
$(AM_LDFLAGS)
-rpath
'
$(codecdir)
'
...
...
modules/codec/rtpvideo.c
0 → 100644
View file @
095bb638
/*****************************************************************************
* rtpvideo.c: video encoder for raw video for RTP (see RFC 4175)
*****************************************************************************
* Copyright (C) 2015 VLC authors and VideoLAN
* $Id$
*
* Authors: Tristan Matthews <tmatth@videolan.org>
*
* 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
/****************************************************************************
* Local prototypes
****************************************************************************/
static
int
OpenEncoder
(
vlc_object_t
*
);
static
block_t
*
Encode
(
encoder_t
*
p_enc
,
picture_t
*
p_pict
);
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin
()
set_description
(
N_
(
"Raw video encoder for RTP"
)
)
set_capability
(
"encoder"
,
50
)
set_category
(
CAT_INPUT
)
set_subcategory
(
SUBCAT_INPUT_VCODEC
)
set_callbacks
(
OpenEncoder
,
NULL
)
add_shortcut
(
"rtpvideo"
)
vlc_module_end
()
static
int
OpenEncoder
(
vlc_object_t
*
p_this
)
{
encoder_t
*
p_enc
=
(
encoder_t
*
)
p_this
;
if
(
p_enc
->
fmt_out
.
i_codec
!=
VLC_CODEC_R420
&&
!
p_enc
->
b_force
)
return
VLC_EGENERIC
;
p_enc
->
pf_encode_video
=
Encode
;
p_enc
->
fmt_in
.
i_codec
=
VLC_CODEC_I420
;
p_enc
->
fmt_out
.
i_codec
=
VLC_CODEC_R420
;
return
VLC_SUCCESS
;
}
static
block_t
*
Encode
(
encoder_t
*
p_enc
,
picture_t
*
p_pict
)
{
VLC_UNUSED
(
p_enc
);
if
(
!
p_pict
)
return
NULL
;
const
int
i_length
=
p_pict
->
p
[
0
].
i_visible_lines
*
p_pict
->
p
[
0
].
i_visible_pitch
+
p_pict
->
p
[
1
].
i_visible_lines
*
p_pict
->
p
[
1
].
i_visible_pitch
+
p_pict
->
p
[
2
].
i_visible_lines
*
p_pict
->
p
[
2
].
i_visible_pitch
;
block_t
*
p_block
=
block_Alloc
(
i_length
);
if
(
!
p_block
)
return
NULL
;
p_block
->
i_dts
=
p_block
->
i_pts
=
p_pict
->
date
;
uint8_t
*
p_outdata
=
p_block
->
p_buffer
;
const
int
i_xdec
=
2
;
const
int
i_ydec
=
2
;
const
uint8_t
*
p_yd1
=
p_pict
->
p
[
0
].
p_pixels
;
const
uint8_t
*
p_u
=
p_pict
->
p
[
1
].
p_pixels
;
const
uint8_t
*
p_v
=
p_pict
->
p
[
2
].
p_pixels
;
/* Y00-Y01-Y10-Y11-U00-V00...luma from adjacent lines */
for
(
int
i_lin
=
0
;
i_lin
<
p_pict
->
p
[
0
].
i_visible_lines
;
i_lin
+=
i_ydec
)
{
const
uint8_t
*
p_yd2
=
p_yd1
+
p_pict
->
p
[
0
].
i_pitch
;
for
(
int
i_pix
=
0
;
i_pix
<
p_pict
->
p
[
0
].
i_visible_pitch
;
i_pix
+=
i_xdec
)
{
*
p_outdata
++
=
*
p_yd1
++
;
*
p_outdata
++
=
*
p_yd1
++
;
*
p_outdata
++
=
*
p_yd2
++
;
*
p_outdata
++
=
*
p_yd2
++
;
*
p_outdata
++
=
*
p_u
++
;
*
p_outdata
++
=
*
p_v
++
;
}
/* Skip a line + padding */
p_yd1
+=
p_pict
->
p
[
0
].
i_pitch
+
(
p_pict
->
p
[
0
].
i_pitch
-
p_pict
->
p
[
0
].
i_visible_pitch
);
p_u
+=
p_pict
->
p
[
1
].
i_pitch
-
p_pict
->
p
[
1
].
i_visible_pitch
;
p_v
+=
p_pict
->
p
[
2
].
i_pitch
-
p_pict
->
p
[
2
].
i_visible_pitch
;
}
return
p_block
;
}
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