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
4c3c6e60
Commit
4c3c6e60
authored
Jul 06, 2011
by
Clément Bœsch
Committed by
Clément Bœsch
Aug 13, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mxf: move framenum to timecode convert to timecode helpers.
This is based on the original work by Baptiste Coudurier.
parent
b7b72963
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
19 deletions
+30
-19
timecode.c
libavcodec/timecode.c
+18
-0
timecode.h
libavcodec/timecode.h
+9
-0
mxfenc.c
libavformat/mxfenc.c
+3
-19
No files found.
libavcodec/timecode.c
View file @
4c3c6e60
...
@@ -37,6 +37,24 @@ int ff_framenum_to_drop_timecode(int frame_num)
...
@@ -37,6 +37,24 @@ int ff_framenum_to_drop_timecode(int frame_num)
return
frame_num
+
18
*
d
+
2
*
((
m
-
2
)
/
1798
);
return
frame_num
+
18
*
d
+
2
*
((
m
-
2
)
/
1798
);
}
}
uint32_t
ff_framenum_to_smtpe_timecode
(
unsigned
frame
,
int
fps
,
int
drop
)
{
return
(
0
<<
31
)
|
// color frame flag
(
drop
<<
30
)
|
// drop frame flag
(
((
frame
%
fps
)
/
10
)
<<
28
)
|
// tens of frames
(
((
frame
%
fps
)
%
10
)
<<
24
)
|
// units of frames
(
0
<<
23
)
|
// field phase (NTSC), b0 (PAL)
((((
frame
/
fps
)
%
60
)
/
10
)
<<
20
)
|
// tens of seconds
((((
frame
/
fps
)
%
60
)
%
10
)
<<
16
)
|
// units of seconds
(
0
<<
15
)
|
// b0 (NTSC), b2 (PAL)
((((
frame
/
(
fps
*
60
))
%
60
)
/
10
)
<<
12
)
|
// tens of minutes
((((
frame
/
(
fps
*
60
))
%
60
)
%
10
)
<<
8
)
|
// units of minutes
(
0
<<
7
)
|
// b1
(
0
<<
6
)
|
// b2 (NTSC), field phase (PAL)
((((
frame
/
(
fps
*
3600
)
%
24
))
/
10
)
<<
4
)
|
// tens of hours
(
(
frame
/
(
fps
*
3600
)
%
24
))
%
10
;
// units of hours
}
int
ff_init_smtpe_timecode
(
void
*
avcl
,
struct
ff_timecode
*
tc
)
int
ff_init_smtpe_timecode
(
void
*
avcl
,
struct
ff_timecode
*
tc
)
{
{
int
hh
,
mm
,
ss
,
ff
,
fps
;
int
hh
,
mm
,
ss
,
ff
,
fps
;
...
...
libavcodec/timecode.h
View file @
4c3c6e60
...
@@ -51,6 +51,15 @@ struct ff_timecode {
...
@@ -51,6 +51,15 @@ struct ff_timecode {
*/
*/
int
ff_framenum_to_drop_timecode
(
int
frame_num
);
int
ff_framenum_to_drop_timecode
(
int
frame_num
);
/**
* @brief Convert frame id (timecode) to SMPTE 12M binary representation
* @param frame Frame number
* @param fps Frame rate
* @param drop Drop flag
* @return The actual binary representation
*/
uint32_t
ff_framenum_to_smtpe_timecode
(
unsigned
frame
,
int
fps
,
int
drop
);
/**
/**
* Parse SMTPE 12M time representation (hh:mm:ss[:;.]ff). str and rate fields
* Parse SMTPE 12M time representation (hh:mm:ss[:;.]ff). str and rate fields
* from tc struct must be set.
* from tc struct must be set.
...
...
libavformat/mxfenc.c
View file @
4c3c6e60
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include "libavutil/random_seed.h"
#include "libavutil/random_seed.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/timecode.h"
#include "audiointerleave.h"
#include "audiointerleave.h"
#include "avformat.h"
#include "avformat.h"
#include "internal.h"
#include "internal.h"
...
@@ -1546,24 +1547,6 @@ static int mxf_write_header(AVFormatContext *s)
...
@@ -1546,24 +1547,6 @@ static int mxf_write_header(AVFormatContext *s)
static
const
uint8_t
system_metadata_pack_key
[]
=
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x05
,
0x01
,
0x01
,
0x0D
,
0x01
,
0x03
,
0x01
,
0x04
,
0x01
,
0x01
,
0x00
};
static
const
uint8_t
system_metadata_pack_key
[]
=
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x05
,
0x01
,
0x01
,
0x0D
,
0x01
,
0x03
,
0x01
,
0x04
,
0x01
,
0x01
,
0x00
};
static
const
uint8_t
system_metadata_package_set_key
[]
=
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x43
,
0x01
,
0x01
,
0x0D
,
0x01
,
0x03
,
0x01
,
0x04
,
0x01
,
0x02
,
0x01
};
static
const
uint8_t
system_metadata_package_set_key
[]
=
{
0x06
,
0x0E
,
0x2B
,
0x34
,
0x02
,
0x43
,
0x01
,
0x01
,
0x0D
,
0x01
,
0x03
,
0x01
,
0x04
,
0x01
,
0x02
,
0x01
};
static
uint32_t
ff_framenum_to_12m_time_code
(
unsigned
frame
,
int
drop
,
int
fps
)
{
return
(
0
<<
31
)
|
// color frame flag
(
drop
<<
30
)
|
// drop frame flag
(
((
frame
%
fps
)
/
10
)
<<
28
)
|
// tens of frames
(
((
frame
%
fps
)
%
10
)
<<
24
)
|
// units of frames
(
0
<<
23
)
|
// field phase (NTSC), b0 (PAL)
((((
frame
/
fps
)
%
60
)
/
10
)
<<
20
)
|
// tens of seconds
((((
frame
/
fps
)
%
60
)
%
10
)
<<
16
)
|
// units of seconds
(
0
<<
15
)
|
// b0 (NTSC), b2 (PAL)
((((
frame
/
(
fps
*
60
))
%
60
)
/
10
)
<<
12
)
|
// tens of minutes
((((
frame
/
(
fps
*
60
))
%
60
)
%
10
)
<<
8
)
|
// units of minutes
(
0
<<
7
)
|
// b1
(
0
<<
6
)
|
// b2 (NTSC), field phase (PAL)
((((
frame
/
(
fps
*
3600
)
%
24
))
/
10
)
<<
4
)
|
// tens of hours
(
(
frame
/
(
fps
*
3600
)
%
24
))
%
10
;
// units of hours
}
static
void
mxf_write_system_item
(
AVFormatContext
*
s
)
static
void
mxf_write_system_item
(
AVFormatContext
*
s
)
{
{
MXFContext
*
mxf
=
s
->
priv_data
;
MXFContext
*
mxf
=
s
->
priv_data
;
...
@@ -1592,7 +1575,8 @@ static void mxf_write_system_item(AVFormatContext *s)
...
@@ -1592,7 +1575,8 @@ static void mxf_write_system_item(AVFormatContext *s)
avio_wb64
(
pb
,
0
);
// creation date/time stamp
avio_wb64
(
pb
,
0
);
// creation date/time stamp
avio_w8
(
pb
,
0x81
);
// SMPTE 12M time code
avio_w8
(
pb
,
0x81
);
// SMPTE 12M time code
time_code
=
ff_framenum_to_12m_time_code
(
frame
,
mxf
->
timecode_drop_frame
,
mxf
->
timecode_base
);
time_code
=
ff_framenum_to_smtpe_timecode
(
frame
,
mxf
->
timecode_base
,
mxf
->
timecode_drop_frame
);
avio_wb32
(
pb
,
time_code
);
avio_wb32
(
pb
,
time_code
);
avio_wb32
(
pb
,
0
);
// binary group data
avio_wb32
(
pb
,
0
);
// binary group data
avio_wb64
(
pb
,
0
);
avio_wb64
(
pb
,
0
);
...
...
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