Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
351e28f9
Commit
351e28f9
authored
Aug 22, 2017
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffprobe: Fix NULL pointer handling in color parameter printing
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
837cb432
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
39 deletions
+49
-39
ffprobe.c
ffprobe.c
+49
-39
No files found.
ffprobe.c
View file @
351e28f9
...
...
@@ -1925,6 +1925,26 @@ static void print_pkt_side_data(WriterContext *w,
writer_print_section_footer
(
w
);
}
static
void
print_color_range
(
WriterContext
*
w
,
enum
AVColorRange
color_range
,
const
char
*
fallback
)
{
const
char
*
val
=
av_color_range_name
(
color_range
);
if
(
!
val
||
color_range
==
AVCOL_RANGE_UNSPECIFIED
)
{
print_str_opt
(
"color_range"
,
fallback
);
}
else
{
print_str
(
"color_range"
,
val
);
}
}
static
void
print_color_space
(
WriterContext
*
w
,
enum
AVColorSpace
color_space
)
{
const
char
*
val
=
av_color_space_name
(
color_space
);
if
(
!
val
||
color_space
==
AVCOL_SPC_UNSPECIFIED
)
{
print_str_opt
(
"color_space"
,
"unknown"
);
}
else
{
print_str
(
"color_space"
,
val
);
}
}
static
void
print_primaries
(
WriterContext
*
w
,
enum
AVColorPrimaries
color_primaries
)
{
const
char
*
val
=
av_color_primaries_name
(
color_primaries
);
...
...
@@ -1935,6 +1955,27 @@ static void print_primaries(WriterContext *w, enum AVColorPrimaries color_primar
}
}
static
void
print_color_trc
(
WriterContext
*
w
,
enum
AVColorTransferCharacteristic
color_trc
)
{
const
char
*
val
=
av_color_transfer_name
(
color_trc
);
if
(
!
val
||
color_trc
==
AVCOL_TRC_UNSPECIFIED
)
{
print_str_opt
(
"color_transfer"
,
"unknown"
);
}
else
{
print_str
(
"color_transfer"
,
val
);
}
}
static
void
print_chroma_location
(
WriterContext
*
w
,
enum
AVChromaLocation
chroma_location
)
{
const
char
*
val
=
av_chroma_location_name
(
chroma_location
);
if
(
!
val
||
chroma_location
==
AVCHROMA_LOC_UNSPECIFIED
)
{
print_str_opt
(
"chroma_location"
,
"unspecified"
);
}
else
{
print_str
(
"chroma_location"
,
val
);
}
}
static
void
clear_log
(
int
need_lock
)
{
int
i
;
...
...
@@ -2116,27 +2157,11 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
print_int
(
"top_field_first"
,
frame
->
top_field_first
);
print_int
(
"repeat_pict"
,
frame
->
repeat_pict
);
if
(
frame
->
color_range
!=
AVCOL_RANGE_UNSPECIFIED
)
print_str
(
"color_range"
,
av_color_range_name
(
frame
->
color_range
));
else
print_str_opt
(
"color_range"
,
av_color_range_name
(
frame
->
color_range
));
if
(
frame
->
colorspace
!=
AVCOL_SPC_UNSPECIFIED
)
print_str
(
"color_space"
,
av_color_space_name
(
frame
->
colorspace
));
else
print_str_opt
(
"color_space"
,
av_color_space_name
(
frame
->
colorspace
));
print_color_range
(
w
,
frame
->
color_range
,
"unknown"
);
print_color_space
(
w
,
frame
->
colorspace
);
print_primaries
(
w
,
frame
->
color_primaries
);
if
(
frame
->
color_trc
!=
AVCOL_TRC_UNSPECIFIED
)
print_str
(
"color_transfer"
,
av_color_transfer_name
(
frame
->
color_trc
));
else
print_str_opt
(
"color_transfer"
,
av_color_transfer_name
(
frame
->
color_trc
));
if
(
frame
->
chroma_location
!=
AVCHROMA_LOC_UNSPECIFIED
)
print_str
(
"chroma_location"
,
av_chroma_location_name
(
frame
->
chroma_location
));
else
print_str_opt
(
"chroma_location"
,
av_chroma_location_name
(
frame
->
chroma_location
));
print_color_trc
(
w
,
frame
->
color_trc
);
print_chroma_location
(
w
,
frame
->
chroma_location
);
break
;
case
AVMEDIA_TYPE_AUDIO
:
...
...
@@ -2508,27 +2533,12 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
if
(
s
)
print_str
(
"pix_fmt"
,
s
);
else
print_str_opt
(
"pix_fmt"
,
"unknown"
);
print_int
(
"level"
,
par
->
level
);
if
(
par
->
color_range
!=
AVCOL_RANGE_UNSPECIFIED
)
print_str
(
"color_range"
,
av_color_range_name
(
par
->
color_range
));
else
print_str_opt
(
"color_range"
,
"N/A"
);
if
(
par
->
color_space
!=
AVCOL_SPC_UNSPECIFIED
)
print_str
(
"color_space"
,
av_color_space_name
(
par
->
color_space
));
else
print_str_opt
(
"color_space"
,
av_color_space_name
(
par
->
color_space
));
if
(
par
->
color_trc
!=
AVCOL_TRC_UNSPECIFIED
)
print_str
(
"color_transfer"
,
av_color_transfer_name
(
par
->
color_trc
));
else
print_str_opt
(
"color_transfer"
,
av_color_transfer_name
(
par
->
color_trc
));
print_color_range
(
w
,
par
->
color_range
,
"N/A"
);
print_color_space
(
w
,
par
->
color_space
);
print_color_trc
(
w
,
par
->
color_trc
);
print_primaries
(
w
,
par
->
color_primaries
);
if
(
par
->
chroma_location
!=
AVCHROMA_LOC_UNSPECIFIED
)
print_str
(
"chroma_location"
,
av_chroma_location_name
(
par
->
chroma_location
));
else
print_str_opt
(
"chroma_location"
,
av_chroma_location_name
(
par
->
chroma_location
));
print_chroma_location
(
w
,
par
->
chroma_location
);
if
(
par
->
field_order
==
AV_FIELD_PROGRESSIVE
)
print_str
(
"field_order"
,
"progressive"
);
...
...
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