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
c74f8178
Commit
c74f8178
authored
Nov 27, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nuv: cosmetics: pretty-printing
parent
5c7bf2dd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
147 additions
and
132 deletions
+147
-132
nuv.c
libavformat/nuv.c
+147
-132
No files found.
libavformat/nuv.c
View file @
c74f8178
...
...
@@ -46,7 +46,8 @@ typedef enum {
NUV_MYTHEXT
=
'X'
}
nuv_frametype
;
static
int
nuv_probe
(
AVProbeData
*
p
)
{
static
int
nuv_probe
(
AVProbeData
*
p
)
{
if
(
!
memcmp
(
p
->
buf
,
"NuppelVideo"
,
12
))
return
AVPROBE_SCORE_MAX
;
if
(
!
memcmp
(
p
->
buf
,
"MythTVVideo"
,
12
))
...
...
@@ -65,12 +66,15 @@ static int nuv_probe(AVProbeData *p) {
* @return 1 if all required codec data was found
*/
static
int
get_codec_data
(
AVIOContext
*
pb
,
AVStream
*
vst
,
AVStream
*
ast
,
int
myth
)
{
AVStream
*
ast
,
int
myth
)
{
nuv_frametype
frametype
;
if
(
!
vst
&&
!
myth
)
return
1
;
// no codec data needed
while
(
!
pb
->
eof_reached
)
{
int
size
,
subtype
;
frametype
=
avio_r8
(
pb
);
switch
(
frametype
)
{
case
NUV_EXTRADATA
:
...
...
@@ -113,8 +117,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
id
=
ff_wav_codec_get_id
(
ast
->
codec
->
codec_tag
,
ast
->
codec
->
bits_per_coded_sample
);
if
(
id
==
AV_CODEC_ID_NONE
)
{
id
=
ff_codec_get_id
(
nuv_audio_tags
,
ast
->
codec
->
codec_tag
);
id
=
ff_codec_get_id
(
nuv_audio_tags
,
ast
->
codec
->
codec_tag
);
if
(
id
==
AV_CODEC_ID_PCM_S16LE
)
id
=
ff_get_pcm_codec_id
(
ast
->
codec
->
bits_per_coded_sample
,
0
,
0
,
~
1
);
...
...
@@ -138,10 +141,12 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
}
avio_skip
(
pb
,
size
);
}
return
0
;
}
static
int
nuv_header
(
AVFormatContext
*
s
)
{
static
int
nuv_header
(
AVFormatContext
*
s
)
{
NUVContext
*
ctx
=
s
->
priv_data
;
AVIOContext
*
pb
=
s
->
pb
;
char
id_string
[
12
];
...
...
@@ -149,6 +154,7 @@ static int nuv_header(AVFormatContext *s) {
int
is_mythtv
,
width
,
height
,
v_packs
,
a_packs
;
int
stream_nr
=
0
;
AVStream
*
vst
=
NULL
,
*
ast
=
NULL
;
avio_read
(
pb
,
id_string
,
12
);
is_mythtv
=
!
memcmp
(
id_string
,
"MythTVVideo"
,
12
);
avio_skip
(
pb
,
5
);
// version string
...
...
@@ -181,7 +187,8 @@ static int nuv_header(AVFormatContext *s) {
vst
->
codec
->
width
=
width
;
vst
->
codec
->
height
=
height
;
vst
->
codec
->
bits_per_coded_sample
=
10
;
vst
->
sample_aspect_ratio
=
av_d2q
(
aspect
*
height
/
width
,
10000
);
vst
->
sample_aspect_ratio
=
av_d2q
(
aspect
*
height
/
width
,
10000
);
#if FF_API_R_FRAME_RATE
vst
->
r_frame_rate
=
#endif
...
...
@@ -209,25 +216,31 @@ static int nuv_header(AVFormatContext *s) {
get_codec_data
(
pb
,
vst
,
ast
,
is_mythtv
);
ctx
->
rtjpg_video
=
vst
&&
vst
->
codec
->
codec_id
==
AV_CODEC_ID_NUV
;
return
0
;
}
#define HDRSIZE 12
static
int
nuv_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
static
int
nuv_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
NUVContext
*
ctx
=
s
->
priv_data
;
AVIOContext
*
pb
=
s
->
pb
;
uint8_t
hdr
[
HDRSIZE
];
nuv_frametype
frametype
;
int
ret
,
size
;
while
(
!
pb
->
eof_reached
)
{
int
copyhdrsize
=
ctx
->
rtjpg_video
?
HDRSIZE
:
0
;
uint64_t
pos
=
avio_tell
(
pb
);
ret
=
avio_read
(
pb
,
hdr
,
HDRSIZE
);
if
(
ret
<
HDRSIZE
)
return
ret
<
0
?
ret
:
AVERROR
(
EIO
);
frametype
=
hdr
[
0
];
size
=
PKTSIZE
(
AV_RL32
(
&
hdr
[
8
]));
switch
(
frametype
)
{
case
NUV_EXTRADATA
:
if
(
!
ctx
->
rtjpg_video
)
{
...
...
@@ -269,7 +282,8 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
pkt
->
pos
=
pos
;
pkt
->
pts
=
AV_RL32
(
&
hdr
[
4
]);
pkt
->
stream_index
=
ctx
->
a_id
;
if
(
ret
<
0
)
return
ret
;
if
(
ret
<
0
)
return
ret
;
return
0
;
case
NUV_SEEKP
:
// contains no data, size value is invalid
...
...
@@ -279,6 +293,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
break
;
}
}
return
AVERROR
(
EIO
);
}
...
...
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