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
bb89109a
Commit
bb89109a
authored
Mar 21, 2018
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/mxfenc: correctly set content package rate in system element
parent
84e8a87c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
2 deletions
+23
-2
mxf.c
libavformat/mxf.c
+17
-0
mxf.h
libavformat/mxf.h
+2
-0
mxfenc.c
libavformat/mxfenc.c
+3
-1
mxf
tests/ref/lavf/mxf
+1
-1
No files found.
libavformat/mxf.c
View file @
bb89109a
...
...
@@ -171,3 +171,20 @@ const MXFSamplesPerFrame *ff_mxf_get_samples_per_frame(AVFormatContext *s,
return
&
mxf_spf
[
idx
];
}
static
const
int
mxf_content_package_rates
[]
=
{
3
,
2
,
7
,
13
,
4
,
10
,
12
,
};
int
ff_mxf_get_content_package_rate
(
AVRational
time_base
)
{
int
idx
=
av_find_nearest_q_idx
(
time_base
,
mxf_time_base
);
AVRational
diff
=
av_sub_q
(
time_base
,
mxf_time_base
[
idx
]);
diff
.
num
=
FFABS
(
diff
.
num
);
if
(
av_cmp_q
(
diff
,
(
AVRational
){
1
,
1000
})
>=
0
)
return
-
1
;
return
mxf_content_package_rates
[
idx
];
}
libavformat/mxf.h
View file @
bb89109a
...
...
@@ -93,6 +93,8 @@ extern const MXFCodecUL ff_mxf_codec_tag_uls[];
int
ff_mxf_decode_pixel_layout
(
const
char
pixel_layout
[
16
],
enum
AVPixelFormat
*
pix_fmt
);
const
MXFSamplesPerFrame
*
ff_mxf_get_samples_per_frame
(
AVFormatContext
*
s
,
AVRational
time_base
);
int
ff_mxf_get_content_package_rate
(
AVRational
time_base
);
#define PRIxUID \
"%02x.%02x.%02x.%02x." \
...
...
libavformat/mxfenc.c
View file @
bb89109a
...
...
@@ -416,6 +416,7 @@ typedef struct MXFContext {
AVStream
*
timecode_track
;
int
timecode_base
;
///< rounded time code base (25 or 30)
int
edit_unit_byte_count
;
///< fixed edit unit byte count
int
content_package_rate
;
///< content package rate in system element, see SMPTE 326M
uint64_t
body_offset
;
uint32_t
instance_number
;
uint8_t
umid
[
16
];
///< unique material identifier
...
...
@@ -2462,6 +2463,7 @@ static int mxf_write_header(AVFormatContext *s)
tbc
.
den
,
tbc
.
num
);
return
AVERROR
(
EINVAL
);
}
mxf
->
content_package_rate
=
ff_mxf_get_content_package_rate
(
tbc
);
mxf
->
time_base
=
spf
->
time_base
;
rate
=
av_inv_q
(
mxf
->
time_base
);
avpriv_set_pts_info
(
st
,
64
,
mxf
->
time_base
.
num
,
mxf
->
time_base
.
den
);
...
...
@@ -2630,7 +2632,7 @@ static void mxf_write_system_item(AVFormatContext *s)
avio_write
(
pb
,
system_metadata_pack_key
,
16
);
klv_encode_ber4_length
(
pb
,
57
);
avio_w8
(
pb
,
0x5c
);
// UL, user date/time stamp, picture and sound item present
avio_w8
(
pb
,
0x04
);
// content package rate
avio_w8
(
pb
,
mxf
->
content_package_rate
);
// content package rate
avio_w8
(
pb
,
0x00
);
// content package type
avio_wb16
(
pb
,
0x00
);
// channel handle
avio_wb16
(
pb
,
(
mxf
->
tc
.
start
+
frame
)
&
0xFFFF
);
// continuity count, supposed to overflow
...
...
tests/ref/lavf/mxf
View file @
bb89109a
649009e3d3d62eb3b6c56334d057cc4d *./tests/data/lavf/lavf.mxf
526393 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
5025d7f79b638166b787b3cb8364e5d9
*./tests/data/lavf/lavf.mxf
9076b7015cffe8aa72883e900a2041a5
*./tests/data/lavf/lavf.mxf
561721 ./tests/data/lavf/lavf.mxf
./tests/data/lavf/lavf.mxf CRC=0x96ff1b48
02bf8f0cd8951a49e277306691cb1538 *./tests/data/lavf/lavf.mxf
...
...
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