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
1d12a545
Commit
1d12a545
authored
Nov 09, 2017
by
Mark Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cbs: Add an explicit type for coded bitstream unit types
Also fix conversion specifiers used for the unit type.
parent
26513529
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
12 deletions
+25
-12
cbs.c
libavcodec/cbs.c
+7
-5
cbs.h
libavcodec/cbs.h
+15
-4
cbs_h2645.c
libavcodec/cbs_h2645.c
+1
-1
cbs_mpeg2.c
libavcodec/cbs_mpeg2.c
+2
-2
No files found.
libavcodec/cbs.c
View file @
1d12a545
...
@@ -137,10 +137,10 @@ static int cbs_read_fragment_content(CodedBitstreamContext *ctx,
...
@@ -137,10 +137,10 @@ static int cbs_read_fragment_content(CodedBitstreamContext *ctx,
if
(
err
==
AVERROR
(
ENOSYS
))
{
if
(
err
==
AVERROR
(
ENOSYS
))
{
av_log
(
ctx
->
log_ctx
,
AV_LOG_WARNING
,
av_log
(
ctx
->
log_ctx
,
AV_LOG_WARNING
,
"Decomposition unimplemented for unit %d "
"Decomposition unimplemented for unit %d "
"(type %
d
).
\n
"
,
i
,
frag
->
units
[
i
].
type
);
"(type %
"
PRIu32
"
).
\n
"
,
i
,
frag
->
units
[
i
].
type
);
}
else
if
(
err
<
0
)
{
}
else
if
(
err
<
0
)
{
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Failed to read unit %d "
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Failed to read unit %d "
"(type %
d
).
\n
"
,
i
,
frag
->
units
[
i
].
type
);
"(type %
"
PRIu32
"
).
\n
"
,
i
,
frag
->
units
[
i
].
type
);
return
err
;
return
err
;
}
}
}
}
...
@@ -225,7 +225,7 @@ int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx,
...
@@ -225,7 +225,7 @@ int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx,
err
=
ctx
->
codec
->
write_unit
(
ctx
,
&
frag
->
units
[
i
]);
err
=
ctx
->
codec
->
write_unit
(
ctx
,
&
frag
->
units
[
i
]);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Failed to write unit %d "
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Failed to write unit %d "
"(type %
d
).
\n
"
,
i
,
frag
->
units
[
i
].
type
);
"(type %
"
PRIu32
"
).
\n
"
,
i
,
frag
->
units
[
i
].
type
);
return
err
;
return
err
;
}
}
}
}
...
@@ -421,7 +421,8 @@ static int cbs_insert_unit(CodedBitstreamContext *ctx,
...
@@ -421,7 +421,8 @@ static int cbs_insert_unit(CodedBitstreamContext *ctx,
int
ff_cbs_insert_unit_content
(
CodedBitstreamContext
*
ctx
,
int
ff_cbs_insert_unit_content
(
CodedBitstreamContext
*
ctx
,
CodedBitstreamFragment
*
frag
,
CodedBitstreamFragment
*
frag
,
int
position
,
uint32_t
type
,
int
position
,
CodedBitstreamUnitType
type
,
void
*
content
)
void
*
content
)
{
{
int
err
;
int
err
;
...
@@ -443,7 +444,8 @@ int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
...
@@ -443,7 +444,8 @@ int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
int
ff_cbs_insert_unit_data
(
CodedBitstreamContext
*
ctx
,
int
ff_cbs_insert_unit_data
(
CodedBitstreamContext
*
ctx
,
CodedBitstreamFragment
*
frag
,
CodedBitstreamFragment
*
frag
,
int
position
,
uint32_t
type
,
int
position
,
CodedBitstreamUnitType
type
,
uint8_t
*
data
,
size_t
data_size
)
uint8_t
*
data
,
size_t
data_size
)
{
{
int
err
;
int
err
;
...
...
libavcodec/cbs.h
View file @
1d12a545
...
@@ -27,6 +27,15 @@
...
@@ -27,6 +27,15 @@
struct
CodedBitstreamType
;
struct
CodedBitstreamType
;
/**
* The codec-specific type of a bitstream unit.
*
* H.264 / AVC: nal_unit_type
* H.265 / HEVC: nal_unit_type
* MPEG-2: start code value (without prefix)
*/
typedef
uint32_t
CodedBitstreamUnitType
;
/**
/**
* Coded bitstream unit structure.
* Coded bitstream unit structure.
*
*
...
@@ -40,7 +49,7 @@ typedef struct CodedBitstreamUnit {
...
@@ -40,7 +49,7 @@ typedef struct CodedBitstreamUnit {
/**
/**
* Codec-specific type of this unit.
* Codec-specific type of this unit.
*/
*/
uint32_t
type
;
CodedBitstreamUnitType
type
;
/**
/**
* Pointer to the bitstream form of this unit.
* Pointer to the bitstream form of this unit.
...
@@ -149,7 +158,7 @@ typedef struct CodedBitstreamContext {
...
@@ -149,7 +158,7 @@ typedef struct CodedBitstreamContext {
* Types not in this list will be available in bitstream form only.
* Types not in this list will be available in bitstream form only.
* If NULL, all supported types will be decomposed.
* If NULL, all supported types will be decomposed.
*/
*/
uint32_t
*
decompose_unit_types
;
CodedBitstreamUnitType
*
decompose_unit_types
;
/**
/**
* Length of the decompose_unit_types array.
* Length of the decompose_unit_types array.
*/
*/
...
@@ -250,7 +259,8 @@ void ff_cbs_fragment_uninit(CodedBitstreamContext *ctx,
...
@@ -250,7 +259,8 @@ void ff_cbs_fragment_uninit(CodedBitstreamContext *ctx,
*/
*/
int
ff_cbs_insert_unit_content
(
CodedBitstreamContext
*
ctx
,
int
ff_cbs_insert_unit_content
(
CodedBitstreamContext
*
ctx
,
CodedBitstreamFragment
*
frag
,
CodedBitstreamFragment
*
frag
,
int
position
,
uint32_t
type
,
int
position
,
CodedBitstreamUnitType
type
,
void
*
content
);
void
*
content
);
/**
/**
...
@@ -260,7 +270,8 @@ int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
...
@@ -260,7 +270,8 @@ int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
*/
*/
int
ff_cbs_insert_unit_data
(
CodedBitstreamContext
*
ctx
,
int
ff_cbs_insert_unit_data
(
CodedBitstreamContext
*
ctx
,
CodedBitstreamFragment
*
frag
,
CodedBitstreamFragment
*
frag
,
int
position
,
uint32_t
type
,
int
position
,
CodedBitstreamUnitType
type
,
uint8_t
*
data
,
size_t
data_size
);
uint8_t
*
data
,
size_t
data_size
);
/**
/**
...
...
libavcodec/cbs_h2645.c
View file @
1d12a545
...
@@ -1213,7 +1213,7 @@ static int cbs_h265_write_nal_unit(CodedBitstreamContext *ctx,
...
@@ -1213,7 +1213,7 @@ static int cbs_h265_write_nal_unit(CodedBitstreamContext *ctx,
default
:
default
:
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Write unimplemented for "
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Write unimplemented for "
"NAL unit type %
d
.
\n
"
,
unit
->
type
);
"NAL unit type %
"
PRIu32
"
.
\n
"
,
unit
->
type
);
return
AVERROR_PATCHWELCOME
;
return
AVERROR_PATCHWELCOME
;
}
}
...
...
libavcodec/cbs_mpeg2.c
View file @
1d12a545
...
@@ -220,7 +220,7 @@ static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx,
...
@@ -220,7 +220,7 @@ static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx,
START
(
0xb8
,
MPEG2RawGroupOfPicturesHeader
,
group_of_pictures_header
);
START
(
0xb8
,
MPEG2RawGroupOfPicturesHeader
,
group_of_pictures_header
);
#undef START
#undef START
default:
default:
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Unknown start code %02
x
.
\n
"
,
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Unknown start code %02
"
PRIx32
"
.
\n
"
,
unit
->
type
);
unit
->
type
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
@@ -248,7 +248,7 @@ static int cbs_mpeg2_write_header(CodedBitstreamContext *ctx,
...
@@ -248,7 +248,7 @@ static int cbs_mpeg2_write_header(CodedBitstreamContext *ctx,
#undef START
#undef START
default:
default:
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Write unimplemented for start "
av_log
(
ctx
->
log_ctx
,
AV_LOG_ERROR
,
"Write unimplemented for start "
"code %02
x
.
\n
"
,
unit
->
type
);
"code %02
"
PRIx32
"
.
\n
"
,
unit
->
type
);
return
AVERROR_PATCHWELCOME
;
return
AVERROR_PATCHWELCOME
;
}
}
...
...
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