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
edc26bfa
Commit
edc26bfa
authored
Nov 14, 2011
by
Clément Bœsch
Committed by
Sebastien Zwickert
Nov 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vda: use K&R style.
parent
2b1a4c5b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
42 deletions
+32
-42
vda.c
libavcodec/vda.c
+31
-39
vda.h
libavcodec/vda.h
+1
-3
No files found.
libavcodec/vda.c
View file @
edc26bfa
...
@@ -38,21 +38,20 @@
...
@@ -38,21 +38,20 @@
/* Mutex manager callback. */
/* Mutex manager callback. */
static
int
vda_lock_operation
(
void
**
mtx
,
enum
AVLockOp
op
)
static
int
vda_lock_operation
(
void
**
mtx
,
enum
AVLockOp
op
)
{
{
switch
(
op
)
switch
(
op
)
{
{
case
AV_LOCK_CREATE
:
case
AV_LOCK_CREATE
:
*
mtx
=
av_malloc
(
sizeof
(
pthread_mutex_t
));
*
mtx
=
av_malloc
(
sizeof
(
pthread_mutex_t
));
if
(
!*
mtx
)
if
(
!*
mtx
)
return
1
;
return
1
;
return
!!
pthread_mutex_init
(
*
mtx
,
NULL
);
return
!!
pthread_mutex_init
(
*
mtx
,
NULL
);
case
AV_LOCK_OBTAIN
:
case
AV_LOCK_OBTAIN
:
return
!!
pthread_mutex_lock
(
*
mtx
);
return
!!
pthread_mutex_lock
(
*
mtx
);
case
AV_LOCK_RELEASE
:
case
AV_LOCK_RELEASE
:
return
!!
pthread_mutex_unlock
(
*
mtx
);
return
!!
pthread_mutex_unlock
(
*
mtx
);
case
AV_LOCK_DESTROY
:
case
AV_LOCK_DESTROY
:
pthread_mutex_destroy
(
*
mtx
);
pthread_mutex_destroy
(
*
mtx
);
av_freep
(
mtx
);
av_freep
(
mtx
);
return
0
;
return
0
;
}
}
return
1
;
return
1
;
}
}
...
@@ -62,12 +61,12 @@ static CFDictionaryRef vda_dictionary_with_pts(int64_t i_pts)
...
@@ -62,12 +61,12 @@ static CFDictionaryRef vda_dictionary_with_pts(int64_t i_pts)
{
{
CFStringRef
key
=
CFSTR
(
"FF_VDA_DECODER_PTS_KEY"
);
CFStringRef
key
=
CFSTR
(
"FF_VDA_DECODER_PTS_KEY"
);
CFNumberRef
value
=
CFNumberCreate
(
kCFAllocatorDefault
,
kCFNumberSInt64Type
,
&
i_pts
);
CFNumberRef
value
=
CFNumberCreate
(
kCFAllocatorDefault
,
kCFNumberSInt64Type
,
&
i_pts
);
CFDictionaryRef
user_info
=
CFDictionaryCreate
(
kCFAllocatorDefault
,
CFDictionaryRef
user_info
=
CFDictionaryCreate
(
kCFAllocatorDefault
,
(
const
void
**
)
&
key
,
(
const
void
**
)
&
key
,
(
const
void
**
)
&
value
,
(
const
void
**
)
&
value
,
1
,
1
,
&
kCFTypeDictionaryKeyCallBacks
,
&
kCFTypeDictionaryKeyCallBacks
,
&
kCFTypeDictionaryValueCallBacks
);
&
kCFTypeDictionaryValueCallBacks
);
CFRelease
(
value
);
CFRelease
(
value
);
return
user_info
;
return
user_info
;
}
}
...
@@ -96,8 +95,7 @@ static void vda_clear_queue(struct vda_context *vda_ctx)
...
@@ -96,8 +95,7 @@ static void vda_clear_queue(struct vda_context *vda_ctx)
vda_lock_operation
(
&
vda_ctx
->
queue_mutex
,
AV_LOCK_OBTAIN
);
vda_lock_operation
(
&
vda_ctx
->
queue_mutex
,
AV_LOCK_OBTAIN
);
while
(
vda_ctx
->
queue
)
while
(
vda_ctx
->
queue
)
{
{
top_frame
=
vda_ctx
->
queue
;
top_frame
=
vda_ctx
->
queue
;
vda_ctx
->
queue
=
top_frame
->
next_frame
;
vda_ctx
->
queue
=
top_frame
->
next_frame
;
ff_vda_release_vda_frame
(
top_frame
);
ff_vda_release_vda_frame
(
top_frame
);
...
@@ -136,23 +134,18 @@ static void vda_decoder_callback (void *vda_hw_ctx,
...
@@ -136,23 +134,18 @@ static void vda_decoder_callback (void *vda_hw_ctx,
queue_walker
=
vda_ctx
->
queue
;
queue_walker
=
vda_ctx
->
queue
;
if
(
!
queue_walker
||
(
new_frame
->
pts
<
queue_walker
->
pts
))
if
(
!
queue_walker
||
(
new_frame
->
pts
<
queue_walker
->
pts
))
{
{
/* we have an empty queue, or this frame earlier than the current queue head */
/* we have an empty queue, or this frame earlier than the current queue head */
new_frame
->
next_frame
=
queue_walker
;
new_frame
->
next_frame
=
queue_walker
;
vda_ctx
->
queue
=
new_frame
;
vda_ctx
->
queue
=
new_frame
;
}
}
else
{
else
{
/* walk the queue and insert this frame where it belongs in display order */
/* walk the queue and insert this frame where it belongs in display order */
vda_frame
*
next_frame
;
vda_frame
*
next_frame
;
while
(
1
)
while
(
1
)
{
{
next_frame
=
queue_walker
->
next_frame
;
next_frame
=
queue_walker
->
next_frame
;
if
(
!
next_frame
||
(
new_frame
->
pts
<
next_frame
->
pts
))
if
(
!
next_frame
||
(
new_frame
->
pts
<
next_frame
->
pts
))
{
{
new_frame
->
next_frame
=
next_frame
;
new_frame
->
next_frame
=
next_frame
;
queue_walker
->
next_frame
=
new_frame
;
queue_walker
->
next_frame
=
new_frame
;
break
;
break
;
...
@@ -219,11 +212,11 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx,
...
@@ -219,11 +212,11 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx,
kCVPixelBufferIOSurfacePropertiesKey
,
kCVPixelBufferIOSurfacePropertiesKey
,
io_surface_properties
);
io_surface_properties
);
status
=
VDADecoderCreate
(
config_info
,
status
=
VDADecoderCreate
(
config_info
,
buffer_attributes
,
buffer_attributes
,
(
VDADecoderOutputCallback
*
)
vda_decoder_callback
,
(
VDADecoderOutputCallback
*
)
vda_decoder_callback
,
vda_ctx
,
vda_ctx
,
&
vda_ctx
->
decoder
);
&
vda_ctx
->
decoder
);
CFRelease
(
height
);
CFRelease
(
height
);
CFRelease
(
width
);
CFRelease
(
width
);
...
@@ -278,8 +271,7 @@ vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx)
...
@@ -278,8 +271,7 @@ vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx)
void
ff_vda_release_vda_frame
(
vda_frame
*
frame
)
void
ff_vda_release_vda_frame
(
vda_frame
*
frame
)
{
{
if
(
frame
)
if
(
frame
)
{
{
CVPixelBufferRelease
(
frame
->
cv_buffer
);
CVPixelBufferRelease
(
frame
->
cv_buffer
);
av_freep
(
&
frame
);
av_freep
(
&
frame
);
}
}
...
...
libavcodec/vda.h
View file @
edc26bfa
...
@@ -36,8 +36,7 @@
...
@@ -36,8 +36,7 @@
/**
/**
* This structure is used to store a decoded frame information and data.
* This structure is used to store a decoded frame information and data.
*/
*/
typedef
struct
typedef
struct
{
{
/**
/**
* The PTS of the frame.
* The PTS of the frame.
*
*
...
@@ -71,7 +70,6 @@ typedef struct
...
@@ -71,7 +70,6 @@ typedef struct
* The application must make it available as AVCodecContext.hwaccel_context.
* The application must make it available as AVCodecContext.hwaccel_context.
*/
*/
struct
vda_context
{
struct
vda_context
{
/**
/**
* VDA decoder object.
* VDA decoder object.
*
*
...
...
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