Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
f591b7b5
Commit
f591b7b5
authored
May 03, 2016
by
Thomas Volkert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rtpenc: packetizer for VC-2 HQ RTP payload format (draft v1)
parent
1ef267b8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
157 additions
and
2 deletions
+157
-2
Changelog
Changelog
+1
-1
MAINTAINERS
MAINTAINERS
+1
-0
Makefile
libavformat/Makefile
+1
-0
rtpenc.c
libavformat/rtpenc.c
+15
-0
rtpenc.h
libavformat/rtpenc.h
+1
-0
rtpenc_vc2hq.c
libavformat/rtpenc_vc2hq.c
+134
-0
sdp.c
libavformat/sdp.c
+3
-0
version.h
libavformat/version.h
+1
-1
No files found.
Changelog
View file @
f591b7b5
...
...
@@ -12,7 +12,7 @@ version <next>:
- ciescope filter
- protocol blacklisting API
- MediaCodec H264 decoding
- VC-2 HQ RTP payload format (draft v1) depacketizer
- VC-2 HQ RTP payload format (draft v1) depacketizer
and packetizer
- AudioToolbox audio decoders
- AudioToolbox audio encoders
- coreimage filter (GPU based image filtering on OSX)
...
...
MAINTAINERS
View file @
f591b7b5
...
...
@@ -502,6 +502,7 @@ Muxers/Demuxers:
rtpdec_hevc.*, rtpenc_hevc.* Thomas Volkert
rtpdec_mpa_robust.* Gilles Chanteperdrix
rtpdec_asf.* Ronald S. Bultje
rtpdec_vc2hq.*, rtpenc_vc2hq.* Thomas Volkert
rtpdec_vp9.c Thomas Volkert
rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo
rtsp.c Luca Barbato
...
...
libavformat/Makefile
View file @
f591b7b5
...
...
@@ -408,6 +408,7 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o \
rtpenc_jpeg.o
\
rtpenc_mpv.o
\
rtpenc.o
\
rtpenc_vc2hq.o
\
rtpenc_vp8.o
\
rtpenc_xiph.o
\
avc.o
hevc.o
...
...
libavformat/rtpenc.c
View file @
f591b7b5
...
...
@@ -49,6 +49,7 @@ static const AVClass rtp_muxer_class = {
static
int
is_supported
(
enum
AVCodecID
id
)
{
switch
(
id
)
{
case
AV_CODEC_ID_DIRAC
:
case
AV_CODEC_ID_H261
:
case
AV_CODEC_ID_H263
:
case
AV_CODEC_ID_H263P
:
...
...
@@ -173,6 +174,17 @@ static int rtp_write_header(AVFormatContext *s1)
n
=
1
;
s
->
max_payload_size
=
n
*
TS_PACKET_SIZE
;
break
;
case
AV_CODEC_ID_DIRAC
:
if
(
s1
->
strict_std_compliance
>
FF_COMPLIANCE_EXPERIMENTAL
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Packetizing VC-2 is experimental and does not use all values "
"of the specification "
"(even though most receivers may handle it just fine). "
"Please set -strict experimental in order to enable it.
\n
"
);
ret
=
AVERROR_EXPERIMENTAL
;
goto
fail
;
}
break
;
case
AV_CODEC_ID_H261
:
if
(
s1
->
strict_std_compliance
>
FF_COMPLIANCE_EXPERIMENTAL
)
{
av_log
(
s
,
AV_LOG_ERROR
,
...
...
@@ -550,6 +562,9 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
case
AV_CODEC_ID_MPEG2TS
:
rtp_send_mpegts_raw
(
s1
,
pkt
->
data
,
size
);
break
;
case
AV_CODEC_ID_DIRAC
:
ff_rtp_send_vc2hq
(
s1
,
pkt
->
data
,
size
,
st
->
codecpar
->
field_order
!=
AV_FIELD_PROGRESSIVE
?
1
:
0
);
break
;
case
AV_CODEC_ID_H264
:
ff_rtp_send_h264_hevc
(
s1
,
pkt
->
data
,
size
);
break
;
...
...
libavformat/rtpenc.h
View file @
f591b7b5
...
...
@@ -91,6 +91,7 @@ void ff_rtp_send_latm(AVFormatContext *s1, const uint8_t *buff, int size);
void
ff_rtp_send_amr
(
AVFormatContext
*
s1
,
const
uint8_t
*
buff
,
int
size
);
void
ff_rtp_send_mpegvideo
(
AVFormatContext
*
s1
,
const
uint8_t
*
buf1
,
int
size
);
void
ff_rtp_send_xiph
(
AVFormatContext
*
s1
,
const
uint8_t
*
buff
,
int
size
);
void
ff_rtp_send_vc2hq
(
AVFormatContext
*
s1
,
const
uint8_t
*
buf
,
int
size
,
int
interlaced
);
void
ff_rtp_send_vp8
(
AVFormatContext
*
s1
,
const
uint8_t
*
buff
,
int
size
);
void
ff_rtp_send_jpeg
(
AVFormatContext
*
s1
,
const
uint8_t
*
buff
,
int
size
);
...
...
libavformat/rtpenc_vc2hq.c
0 → 100644
View file @
f591b7b5
/*
* RTP packetizer for VC-2 HQ payload format (draft version 1) - experimental
* Copyright (c) 2016 Thomas Volkert <thomas@netzeal.de>
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/intreadwrite.h"
#include "libavcodec/dirac.h"
#include "libavcodec/get_bits.h"
#include "libavcodec/golomb.h"
#include "avformat.h"
#include "rtpenc.h"
#define RTP_VC2HQ_PL_HEADER_SIZE 4
#define DIRAC_DATA_UNIT_HEADER_SIZE 13
#define DIRAC_PIC_NR_SIZE 4
#define DIRAC_RTP_PCODE_HQ_PIC_FRAGMENT 0xEC
static
void
send_packet
(
AVFormatContext
*
ctx
,
uint8_t
parse_code
,
int
info_hdr_size
,
const
uint8_t
*
buf
,
int
size
,
int
i
,
int
f
,
int
rtp_m
)
{
RTPMuxContext
*
rtp_ctx
=
ctx
->
priv_data
;
AV_WB16
(
&
rtp_ctx
->
buf
[
0
],
0
);
/* extended sequence number */
AV_WB8
(
&
rtp_ctx
->
buf
[
2
],
i
?
(
f
?
(
0x03
)
:
(
0x02
))
:
0x00
);
/* flags: interlaced, second field */
AV_WB8
(
&
rtp_ctx
->
buf
[
3
],
parse_code
);
if
(
size
>
0
)
memcpy
(
&
rtp_ctx
->
buf
[
4
+
info_hdr_size
],
buf
,
size
);
ff_rtp_send_data
(
ctx
,
rtp_ctx
->
buf
,
RTP_VC2HQ_PL_HEADER_SIZE
+
info_hdr_size
+
size
,
rtp_m
);
}
static
void
send_picture
(
AVFormatContext
*
ctx
,
const
uint8_t
*
buf
,
int
size
,
int
interlaced
)
{
RTPMuxContext
*
rtp_ctx
=
ctx
->
priv_data
;
GetBitContext
gc
;
int
lvl
,
second_field
;
uint32_t
pic_nr
,
wavelet_depth
,
prefix_bytes
,
size_scaler
;
uint16_t
frag_len
;
char
*
info_hdr
=
&
rtp_ctx
->
buf
[
4
];
pic_nr
=
AV_RB32
(
&
buf
[
0
]);
buf
+=
DIRAC_PIC_NR_SIZE
;
size
-=
DIRAC_PIC_NR_SIZE
;
second_field
=
interlaced
&&
(
pic_nr
&
0x01
);
init_get_bits
(
&
gc
,
buf
,
8
*
size
);
svq3_get_ue_golomb
(
&
gc
);
/* wavelet_idx */
wavelet_depth
=
svq3_get_ue_golomb
(
&
gc
);
svq3_get_ue_golomb
(
&
gc
);
/* num_x */
svq3_get_ue_golomb
(
&
gc
);
/* num_y */
prefix_bytes
=
svq3_get_ue_golomb
(
&
gc
);
size_scaler
=
svq3_get_ue_golomb
(
&
gc
);
/* pass the quantization matrices */
svq3_get_ue_golomb
(
&
gc
);
for
(
lvl
=
0
;
lvl
<
wavelet_depth
;
lvl
++
)
{
svq3_get_ue_golomb
(
&
gc
);
svq3_get_ue_golomb
(
&
gc
);
svq3_get_ue_golomb
(
&
gc
);
}
frag_len
=
(
get_bits_count
(
&
gc
)
+
7
)
/
8
;
/* length of transform parameters */
AV_WB32
(
&
info_hdr
[
0
],
pic_nr
);
AV_WB16
(
&
info_hdr
[
4
],
prefix_bytes
);
AV_WB16
(
&
info_hdr
[
6
],
size_scaler
);
AV_WB16
(
&
info_hdr
[
8
],
frag_len
);
AV_WB16
(
&
info_hdr
[
10
],
0
/* nr. of slices */
);
send_packet
(
ctx
,
DIRAC_RTP_PCODE_HQ_PIC_FRAGMENT
,
12
,
buf
,
frag_len
,
interlaced
,
second_field
,
0
);
buf
+=
frag_len
;
size
-=
frag_len
;
while
(
size
>
0
)
{
frag_len
=
FFMIN
(
rtp_ctx
->
max_payload_size
-
20
/* pl header */
,
size
);
AV_WB16
(
&
info_hdr
[
8
],
frag_len
);
AV_WB16
(
&
info_hdr
[
10
],
1
/* nr. of slices */
);
AV_WB16
(
&
info_hdr
[
12
],
0
/* slice x */
);
AV_WB16
(
&
info_hdr
[
14
],
0
/* slice y */
);
size
-=
frag_len
;
send_packet
(
ctx
,
DIRAC_RTP_PCODE_HQ_PIC_FRAGMENT
,
16
,
buf
,
frag_len
,
interlaced
,
second_field
,
size
>
0
?
0
:
1
);
buf
+=
frag_len
;
}
}
void
ff_rtp_send_vc2hq
(
AVFormatContext
*
ctx
,
const
uint8_t
*
frame_buf
,
int
frame_size
,
int
interlaced
)
{
const
uint8_t
*
end
=
frame_buf
+
frame_size
;
const
uint8_t
*
unit
=
frame_buf
;
uint8_t
parse_code
;
uint32_t
unit_size
;
while
(
unit
<
end
)
{
parse_code
=
unit
[
4
];
unit_size
=
AV_RB32
(
&
unit
[
5
]);
switch
(
parse_code
)
{
/* sequence header */
/* end of sequence */
case
DIRAC_PCODE_SEQ_HEADER
:
case
DIRAC_PCODE_END_SEQ
:
send_packet
(
ctx
,
parse_code
,
0
,
unit
+
DIRAC_DATA_UNIT_HEADER_SIZE
,
unit_size
-
DIRAC_DATA_UNIT_HEADER_SIZE
,
0
,
0
,
0
);
break
;
/* HQ picture */
case
DIRAC_PCODE_PICTURE_HQ
:
send_picture
(
ctx
,
unit
+
DIRAC_DATA_UNIT_HEADER_SIZE
,
unit_size
-
DIRAC_DATA_UNIT_HEADER_SIZE
,
interlaced
);
break
;
/* parse codes without specification */
case
DIRAC_PCODE_AUX
:
case
DIRAC_PCODE_PAD
:
break
;
default:
avpriv_report_missing_feature
(
ctx
,
"VC-2 parse code %d"
,
parse_code
);
break
;
}
unit
+=
unit_size
;
}
}
libavformat/sdp.c
View file @
f591b7b5
...
...
@@ -485,6 +485,9 @@ static char *sdp_write_media_attributes(char *buff, int size, AVStream *st, int
AVCodecParameters
*
p
=
st
->
codecpar
;
switch
(
p
->
codec_id
)
{
case
AV_CODEC_ID_DIRAC
:
av_strlcatf
(
buff
,
size
,
"a=rtpmap:%d VC2/90000
\r\n
"
,
payload_type
);
break
;
case
AV_CODEC_ID_H264
:
{
int
mode
=
1
;
if
(
fmt
&&
fmt
->
oformat
&&
fmt
->
oformat
->
priv_class
&&
...
...
libavformat/version.h
View file @
f591b7b5
...
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 3
5
#define LIBAVFORMAT_VERSION_MINOR 3
6
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
...
...
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