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
b605b123
Commit
b605b123
authored
Nov 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mxpegdec: use the AVFrame API properly.
parent
afa21a12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
22 deletions
+29
-22
mxpegdec.c
libavcodec/mxpegdec.c
+29
-22
No files found.
libavcodec/mxpegdec.c
View file @
b605b123
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
typedef
struct
MXpegDecodeContext
{
typedef
struct
MXpegDecodeContext
{
MJpegDecodeContext
jpg
;
MJpegDecodeContext
jpg
;
AVFrame
picture
[
2
];
/* pictures array */
AVFrame
*
picture
[
2
];
/* pictures array */
int
picture_index
;
/* index of current picture */
int
picture_index
;
/* index of current picture */
int
got_sof_data
;
/* true if SOF data successfully parsed */
int
got_sof_data
;
/* true if SOF data successfully parsed */
int
got_mxm_bitmask
;
/* true if MXM bitmask available */
int
got_mxm_bitmask
;
/* true if MXM bitmask available */
...
@@ -42,11 +42,36 @@ typedef struct MXpegDecodeContext {
...
@@ -42,11 +42,36 @@ typedef struct MXpegDecodeContext {
unsigned
mb_width
,
mb_height
;
/* size of picture in MB's from MXM header */
unsigned
mb_width
,
mb_height
;
/* size of picture in MB's from MXM header */
}
MXpegDecodeContext
;
}
MXpegDecodeContext
;
static
av_cold
int
mxpeg_decode_end
(
AVCodecContext
*
avctx
)
{
MXpegDecodeContext
*
s
=
avctx
->
priv_data
;
MJpegDecodeContext
*
jpg
=
&
s
->
jpg
;
int
i
;
jpg
->
picture_ptr
=
NULL
;
ff_mjpeg_decode_end
(
avctx
);
for
(
i
=
0
;
i
<
2
;
++
i
)
av_frame_free
(
&
s
->
picture
[
i
]);
av_freep
(
&
s
->
mxm_bitmask
);
av_freep
(
&
s
->
completion_bitmask
);
return
0
;
}
static
av_cold
int
mxpeg_decode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
mxpeg_decode_init
(
AVCodecContext
*
avctx
)
{
{
MXpegDecodeContext
*
s
=
avctx
->
priv_data
;
MXpegDecodeContext
*
s
=
avctx
->
priv_data
;
s
->
jpg
.
picture_ptr
=
&
s
->
picture
[
0
];
s
->
picture
[
0
]
=
av_frame_alloc
();
s
->
picture
[
1
]
=
av_frame_alloc
();
if
(
!
s
->
picture
[
0
]
||
!
s
->
picture
[
1
])
{
mxpeg_decode_end
(
avctx
);
return
AVERROR
(
ENOMEM
);
}
s
->
jpg
.
picture_ptr
=
s
->
picture
[
0
];
return
ff_mjpeg_decode_init
(
avctx
);
return
ff_mjpeg_decode_init
(
avctx
);
}
}
...
@@ -261,7 +286,7 @@ static int mxpeg_decode_frame(AVCodecContext *avctx,
...
@@ -261,7 +286,7 @@ static int mxpeg_decode_frame(AVCodecContext *avctx,
}
}
if
(
s
->
got_mxm_bitmask
)
{
if
(
s
->
got_mxm_bitmask
)
{
AVFrame
*
reference_ptr
=
&
s
->
picture
[
s
->
picture_index
^
1
];
AVFrame
*
reference_ptr
=
s
->
picture
[
s
->
picture_index
^
1
];
if
(
mxpeg_check_dimensions
(
s
,
jpg
,
reference_ptr
)
<
0
)
if
(
mxpeg_check_dimensions
(
s
,
jpg
,
reference_ptr
)
<
0
)
break
;
break
;
...
@@ -298,7 +323,7 @@ the_end:
...
@@ -298,7 +323,7 @@ the_end:
*
got_frame
=
1
;
*
got_frame
=
1
;
s
->
picture_index
^=
1
;
s
->
picture_index
^=
1
;
jpg
->
picture_ptr
=
&
s
->
picture
[
s
->
picture_index
];
jpg
->
picture_ptr
=
s
->
picture
[
s
->
picture_index
];
if
(
!
s
->
has_complete_frame
)
{
if
(
!
s
->
has_complete_frame
)
{
if
(
!
s
->
got_mxm_bitmask
)
if
(
!
s
->
got_mxm_bitmask
)
...
@@ -311,24 +336,6 @@ the_end:
...
@@ -311,24 +336,6 @@ the_end:
return
buf_ptr
-
buf
;
return
buf_ptr
-
buf
;
}
}
static
av_cold
int
mxpeg_decode_end
(
AVCodecContext
*
avctx
)
{
MXpegDecodeContext
*
s
=
avctx
->
priv_data
;
MJpegDecodeContext
*
jpg
=
&
s
->
jpg
;
int
i
;
jpg
->
picture_ptr
=
NULL
;
ff_mjpeg_decode_end
(
avctx
);
for
(
i
=
0
;
i
<
2
;
++
i
)
av_frame_unref
(
&
s
->
picture
[
i
]);
av_freep
(
&
s
->
mxm_bitmask
);
av_freep
(
&
s
->
completion_bitmask
);
return
0
;
}
AVCodec
ff_mxpeg_decoder
=
{
AVCodec
ff_mxpeg_decoder
=
{
.
name
=
"mxpeg"
,
.
name
=
"mxpeg"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Mobotix MxPEG video"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Mobotix MxPEG video"
),
...
...
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