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
6f551562
Commit
6f551562
authored
Jan 16, 2012
by
Clément Bœsch
Committed by
Clément Bœsch
Feb 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dvenc: use new public timecode API.
parent
bf6e83a8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
20 deletions
+12
-20
dvenc.c
libavformat/dvenc.c
+12
-20
No files found.
libavformat/dvenc.c
View file @
6f551562
...
@@ -33,12 +33,12 @@
...
@@ -33,12 +33,12 @@
#include "avformat.h"
#include "avformat.h"
#include "internal.h"
#include "internal.h"
#include "libavcodec/dvdata.h"
#include "libavcodec/dvdata.h"
#include "libavcodec/timecode.h"
#include "dv.h"
#include "dv.h"
#include "libavutil/fifo.h"
#include "libavutil/fifo.h"
#include "libavutil/mathematics.h"
#include "libavutil/mathematics.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/opt.h"
#include "libavutil/timecode.h"
struct
DVMuxContext
{
struct
DVMuxContext
{
AVClass
*
av_class
;
AVClass
*
av_class
;
...
@@ -51,7 +51,8 @@ struct DVMuxContext {
...
@@ -51,7 +51,8 @@ struct DVMuxContext {
int
has_audio
;
/* frame under contruction has audio */
int
has_audio
;
/* frame under contruction has audio */
int
has_video
;
/* frame under contruction has video */
int
has_video
;
/* frame under contruction has video */
uint8_t
frame_buf
[
DV_MAX_FRAME_SIZE
];
/* frame under contruction */
uint8_t
frame_buf
[
DV_MAX_FRAME_SIZE
];
/* frame under contruction */
struct
ff_timecode
tc
;
char
*
tc_opt_str
;
/* timecode option string */
AVTimecode
tc
;
/* timecode context */
};
};
static
const
int
dv_aaux_packs_dist
[
12
][
9
]
=
{
static
const
int
dv_aaux_packs_dist
[
12
][
9
]
=
{
...
@@ -79,22 +80,13 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
...
@@ -79,22 +80,13 @@ static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* bu
{
{
struct
tm
tc
;
struct
tm
tc
;
time_t
ct
;
time_t
ct
;
int
ltc_frame
;
uint32_t
timecode
;
uint32_t
timecode
;
va_list
ap
;
va_list
ap
;
buf
[
0
]
=
(
uint8_t
)
pack_id
;
buf
[
0
]
=
(
uint8_t
)
pack_id
;
switch
(
pack_id
)
{
switch
(
pack_id
)
{
case
dv_timecode
:
case
dv_timecode
:
/*
timecode
=
av_timecode_get_smpte_from_framenum
(
&
c
->
tc
,
c
->
frames
);
* LTC drop-frame frame counter drops two frames (0 and 1) every
* minute, unless it is exactly divisible by 10
*/
ltc_frame
=
c
->
tc
.
start
+
c
->
frames
;
if
(
c
->
tc
.
drop
)
ltc_frame
=
avpriv_framenum_to_drop_timecode
(
ltc_frame
);
timecode
=
avpriv_framenum_to_smpte_timecode
(
ltc_frame
,
c
->
sys
->
ltc_divisor
,
c
->
tc
.
drop
);
timecode
|=
1
<<
23
|
1
<<
15
|
1
<<
7
|
1
<<
6
;
// biphase and binary group flags
timecode
|=
1
<<
23
|
1
<<
15
|
1
<<
7
|
1
<<
6
;
// biphase and binary group flags
AV_WB32
(
buf
+
1
,
timecode
);
AV_WB32
(
buf
+
1
,
timecode
);
break
;
break
;
...
@@ -361,6 +353,7 @@ static void dv_delete_mux(DVMuxContext *c)
...
@@ -361,6 +353,7 @@ static void dv_delete_mux(DVMuxContext *c)
static
int
dv_write_header
(
AVFormatContext
*
s
)
static
int
dv_write_header
(
AVFormatContext
*
s
)
{
{
AVRational
rate
;
DVMuxContext
*
dvc
=
s
->
priv_data
;
DVMuxContext
*
dvc
=
s
->
priv_data
;
if
(
!
dv_init_mux
(
s
))
{
if
(
!
dv_init_mux
(
s
))
{
...
@@ -370,13 +363,12 @@ static int dv_write_header(AVFormatContext *s)
...
@@ -370,13 +363,12 @@ static int dv_write_header(AVFormatContext *s)
" (50Mbps allows an optional second audio stream)
\n
"
);
" (50Mbps allows an optional second audio stream)
\n
"
);
return
-
1
;
return
-
1
;
}
}
if
(
dvc
->
tc
.
str
)
{
rate
.
num
=
dvc
->
sys
->
ltc_divisor
;
dvc
->
tc
.
rate
.
num
=
dvc
->
sys
->
time_base
.
den
;
rate
.
den
=
1
;
dvc
->
tc
.
rate
.
den
=
dvc
->
sys
->
time_base
.
num
;
if
(
dvc
->
tc_opt_str
)
if
(
avpriv_init_smpte_timecode
(
s
,
&
dvc
->
tc
)
<
0
)
return
av_timecode_init_from_string
(
&
dvc
->
tc
,
rate
,
return
-
1
;
dvc
->
tc_opt_str
,
s
);
}
return
av_timecode_init
(
&
dvc
->
tc
,
rate
,
0
,
0
,
s
);
return
0
;
}
}
static
int
dv_write_packet
(
struct
AVFormatContext
*
s
,
AVPacket
*
pkt
)
static
int
dv_write_packet
(
struct
AVFormatContext
*
s
,
AVPacket
*
pkt
)
...
@@ -410,7 +402,7 @@ static const AVClass class = {
...
@@ -410,7 +402,7 @@ static const AVClass class = {
.
item_name
=
av_default_item_name
,
.
item_name
=
av_default_item_name
,
.
version
=
LIBAVUTIL_VERSION_INT
,
.
version
=
LIBAVUTIL_VERSION_INT
,
.
option
=
(
const
AVOption
[]){
.
option
=
(
const
AVOption
[]){
{
TIMECODE_OPT
(
DVMuxContext
,
AV_OPT_FLAG_ENCODING_PARAM
)},
{
AV_TIMECODE_OPTION
(
DVMuxContext
,
tc_opt_str
,
AV_OPT_FLAG_ENCODING_PARAM
)},
{
NULL
},
{
NULL
},
},
},
};
};
...
...
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