Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.io.base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.io.base
Commits
2cdc71e2
Commit
2cdc71e2
authored
11 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Fix supported vs available format descriptions
parent
3ea39232
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
xbob/io/externals.cpp
+29
-18
29 additions, 18 deletions
xbob/io/externals.cpp
xbob/io/script/video_test.py
+2
-0
2 additions, 0 deletions
xbob/io/script/video_test.py
xbob/io/utils.py
+1
-1
1 addition, 1 deletion
xbob/io/utils.py
with
32 additions
and
19 deletions
xbob/io/externals.cpp
+
29
−
18
View file @
2cdc71e2
...
...
@@ -677,10 +677,11 @@ built-in input formats for videos that are available, but **not\n\
necessarily supported** by this library.
\n
\
"
);
static
PyObject
*
get_video_oformats
(
void
(
*
f
)(
std
::
map
<
std
::
string
,
AVOutputFormat
*>&
)
)
{
static
PyObject
*
get_video_oformats
(
bool
supported
)
{
std
::
map
<
std
::
string
,
AVOutputFormat
*>
m
;
f
(
m
);
if
(
supported
)
bob
::
io
::
detail
::
ffmpeg
::
oformats_supported
(
m
);
else
bob
::
io
::
detail
::
ffmpeg
::
oformats_installed
(
m
);
PyObject
*
retval
=
PyDict_New
();
if
(
!
retval
)
return
0
;
...
...
@@ -723,6 +724,7 @@ static PyObject* get_video_oformats(void (*f)(std::map<std::string, AVOutputForm
}
for
(
auto
ext
=
exts
.
begin
();
ext
!=
exts
.
end
();
++
ext
)
{
if
(
!
list_append
(
ext_list
,
ext
->
c_str
()))
{
Py_DECREF
(
ext_list
);
Py_DECREF
(
property
);
...
...
@@ -763,30 +765,39 @@ static PyObject* get_video_oformats(void (*f)(std::map<std::string, AVOutputForm
}
/** get supported codec list **/
std
::
vector
<
const
AVCodec
*>
codecs
;
bob
::
io
::
detail
::
ffmpeg
::
oformat_supported_codecs
(
k
->
second
->
name
,
codecs
);
PyObject
*
supported_codecs
=
PyDict_New
();
for
(
auto
c
=
codecs
.
begin
();
c
!=
codecs
.
end
();
++
c
)
{
PyObject
*
codec_descr
=
describe_codec
(
*
c
);
if
(
!
codec_descr
)
{
Py_DECREF
(
supported_codecs
);
if
(
supported
)
{
std
::
vector
<
const
AVCodec
*>
codecs
;
bob
::
io
::
detail
::
ffmpeg
::
oformat_supported_codecs
(
k
->
second
->
name
,
codecs
);
PyObject
*
supported_codecs
=
PyDict_New
();
if
(
!
supported_codecs
)
{
Py_DECREF
(
property
);
Py_DECREF
(
retval
);
return
0
;
}
if
(
!
dict_steal
(
supported_codecs
,
(
*
c
)
->
name
,
codec_descr
))
{
for
(
auto
c
=
codecs
.
begin
();
c
!=
codecs
.
end
();
++
c
)
{
PyObject
*
codec_descr
=
describe_codec
(
*
c
);
if
(
!
codec_descr
)
{
Py_DECREF
(
supported_codecs
);
Py_DECREF
(
property
);
Py_DECREF
(
retval
);
return
0
;
}
if
(
!
dict_steal
(
supported_codecs
,
(
*
c
)
->
name
,
codec_descr
))
{
Py_DECREF
(
property
);
Py_DECREF
(
retval
);
return
0
;
}
}
if
(
!
dict_steal
(
property
,
"supported_codecs"
,
supported_codecs
))
{
Py_DECREF
(
property
);
Py_DECREF
(
retval
);
return
0
;
}
}
if
(
!
dict_steal
(
property
,
"supported_codecs"
,
supported_codecs
))
{
Py_DECREF
(
property
);
Py_DECREF
(
retval
);
return
0
;
}
if
(
!
dict_steal
(
retval
,
k
->
first
.
c_str
(),
property
))
{
Py_DECREF
(
retval
);
return
0
;
...
...
@@ -799,11 +810,11 @@ static PyObject* get_video_oformats(void (*f)(std::map<std::string, AVOutputForm
}
static
PyObject
*
PyBobIo_SupportedOutputFormats
(
PyObject
*
)
{
return
get_video_oformats
(
&
bob
::
io
::
detail
::
ffmpeg
::
oformats_supported
);
return
get_video_oformats
(
true
);
}
static
PyObject
*
PyBobIo_AvailableOutputFormats
(
PyObject
*
)
{
return
get_video_oformats
(
&
bob
::
io
::
detail
::
ffmpeg
::
oformats_installed
);
return
get_video_oformats
(
false
);
}
PyDoc_STRVAR
(
s_supported_oformats_str
,
"supported_videowriter_formats"
);
...
...
This diff is collapsed.
Click to expand it.
xbob/io/script/video_test.py
+
2
−
0
View file @
2cdc71e2
...
...
@@ -44,6 +44,8 @@ def list_codecs(*args, **kwargs):
def
list_all_codecs
(
*
args
,
**
kwargs
):
from
.._externals
import
supported_video_codecs
,
available_video_codecs
CODECS
=
supported_video_codecs
()
ALL_CODECS
=
available_video_codecs
()
...
...
This diff is collapsed.
Click to expand it.
xbob/io/utils.py
+
1
−
1
View file @
2cdc71e2
...
...
@@ -61,7 +61,7 @@ def print_numbers(frame, counter, format, fontsize):
img
=
Image
.
fromstring
(
'
RGB
'
,
(
frame
.
shape
[
1
],
frame
.
shape
[
2
]),
frame
.
transpose
(
1
,
2
,
0
).
tostring
())
draw
=
ImageDraw
.
Draw
(
img
)
draw
.
text
((
x_pos
,
y_pos
),
text
,
font
=
font
,
fill
=
(
255
,
255
,
255
))
return
numpy
.
asarray
(
img
).
transpose
(
2
,
0
,
1
)
.
copy
()
return
numpy
.
asarray
(
img
).
transpose
(
2
,
0
,
1
)
def
generate_colors
(
height
,
width
,
shift
):
"""
Generates an image that serves as a test pattern for encoding/decoding and
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment