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
ccc0ffb1
Commit
ccc0ffb1
authored
Aug 01, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
idcin: set start_time and packet duration instead of manually tracking pts.
Also, use 1 / sample_rate for audio stream time_base.
parent
4b840930
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
idcin.c
libavformat/idcin.c
+7
-8
No files found.
libavformat/idcin.c
View file @
ccc0ffb1
...
...
@@ -82,13 +82,12 @@ typedef struct IdcinDemuxContext {
int
audio_stream_index
;
int
audio_chunk_size1
;
int
audio_chunk_size2
;
int
block_align
;
/* demux state variables */
int
current_audio_chunk
;
int
next_chunk_is_video
;
int
audio_present
;
int64_t
pts
;
}
IdcinDemuxContext
;
static
int
idcin_probe
(
AVProbeData
*
p
)
...
...
@@ -181,6 +180,7 @@ static int idcin_read_header(AVFormatContext *s)
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
avpriv_set_pts_info
(
st
,
33
,
1
,
IDCIN_FPS
);
st
->
start_time
=
0
;
idcin
->
video_stream_index
=
st
->
index
;
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_VIDEO
;
st
->
codec
->
codec_id
=
AV_CODEC_ID_IDCIN
;
...
...
@@ -200,7 +200,8 @@ static int idcin_read_header(AVFormatContext *s)
st
=
avformat_new_stream
(
s
,
NULL
);
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
avpriv_set_pts_info
(
st
,
33
,
1
,
IDCIN_FPS
);
avpriv_set_pts_info
(
st
,
63
,
1
,
sample_rate
);
st
->
start_time
=
0
;
idcin
->
audio_stream_index
=
st
->
index
;
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
st
->
codec
->
codec_tag
=
1
;
...
...
@@ -210,7 +211,7 @@ static int idcin_read_header(AVFormatContext *s)
st
->
codec
->
sample_rate
=
sample_rate
;
st
->
codec
->
bits_per_coded_sample
=
bytes_per_sample
*
8
;
st
->
codec
->
bit_rate
=
sample_rate
*
bytes_per_sample
*
8
*
channels
;
st
->
codec
->
block_align
=
bytes_per_sample
*
channels
;
st
->
codec
->
block_align
=
idcin
->
block_align
=
bytes_per_sample
*
channels
;
if
(
bytes_per_sample
==
1
)
st
->
codec
->
codec_id
=
AV_CODEC_ID_PCM_U8
;
else
...
...
@@ -229,7 +230,6 @@ static int idcin_read_header(AVFormatContext *s)
}
idcin
->
next_chunk_is_video
=
1
;
idcin
->
pts
=
0
;
return
0
;
}
...
...
@@ -292,7 +292,7 @@ static int idcin_read_packet(AVFormatContext *s,
memcpy
(
pal
,
palette
,
AVPALETTE_SIZE
);
}
pkt
->
stream_index
=
idcin
->
video_stream_index
;
pkt
->
pts
=
idcin
->
pts
;
pkt
->
duration
=
1
;
}
else
{
/* send out the audio chunk */
if
(
idcin
->
current_audio_chunk
)
...
...
@@ -303,10 +303,9 @@ static int idcin_read_packet(AVFormatContext *s,
if
(
ret
<
0
)
return
ret
;
pkt
->
stream_index
=
idcin
->
audio_stream_index
;
pkt
->
pts
=
idcin
->
pts
;
pkt
->
duration
=
chunk_size
/
idcin
->
block_align
;
idcin
->
current_audio_chunk
^=
1
;
idcin
->
pts
++
;
}
if
(
idcin
->
audio_present
)
...
...
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