Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
preview-generator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
mediaflix
preview-generator
Commits
3ce91376
Verified
Commit
3ce91376
authored
5 years ago
by
Janne Mareike Koschinski
Browse files
Options
Downloads
Patches
Plain Diff
Remove unnecessary metadata file
parent
c28c69bf
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib.rs
+0
-14
0 additions, 14 deletions
src/lib.rs
src/stream_metadata.rs
+0
-41
0 additions, 41 deletions
src/stream_metadata.rs
with
0 additions
and
55 deletions
src/lib.rs
+
0
−
14
View file @
3ce91376
#![allow(dead_code)]
pub
mod
spritesheet
;
pub
mod
stream_metadata
;
use
std
::
path
::
Path
;
...
...
@@ -62,14 +61,6 @@ pub fn extract(
local_codec
.name
()
?
);
let
mut
metadata
=
stream_metadata
::
StreamMetadata
::
new
(
avformat_context
.input_format
()
?
.determine_mime
(
local_codec
.name
()
?
)
?
,
duration
,
codec_parameters
.bit_rate
()
/
1000
,
);
let
mut
output_frame
=
AVFrame
::
new
()
.map_err
(|
error
|
format_err!
(
"Could not create output frame: {}"
,
error
))
?
;
...
...
@@ -110,7 +101,6 @@ pub fn extract(
if
!
spritesheet_manager
.initialized
()
{
spritesheet_manager
.initialize
(
frame
.width
()
as
u32
,
frame
.height
()
as
u32
);
metadata
.set_frame_size
(
frame
.width
(),
frame
.height
());
output_frame
.init
(
spritesheet_manager
.sprite_width
()
as
i32
,
...
...
@@ -147,9 +137,5 @@ pub fn extract(
spritesheet_manager
.save
()
?
;
}
metadata
.save
(
output_folder
.join
(
"media.json"
))
.map_err
(|
error
|
format_err!
(
"Could not write stream metadata: {}"
,
error
))
?
;
Ok
(())
}
This diff is collapsed.
Click to expand it.
src/stream_metadata.rs
deleted
100644 → 0
+
0
−
41
View file @
c28c69bf
use
std
::
fs
::
File
;
use
std
::
io
::
BufWriter
;
use
std
::
path
::
Path
;
use
serde
::{
Deserialize
,
Serialize
};
use
media_time
::
MediaTime
;
#[derive(Serialize,
Deserialize)]
pub
struct
StreamMetadata
{
content_type
:
String
,
duration
:
i64
,
bitrate
:
i64
,
aspect_ratio
:
f32
,
width
:
i32
,
height
:
i32
,
}
impl
StreamMetadata
{
pub
fn
new
(
content_type
:
impl
AsRef
<
str
>
,
duration
:
MediaTime
,
bitrate
:
i64
)
->
StreamMetadata
{
StreamMetadata
{
content_type
:
String
::
from
(
content_type
.as_ref
()),
duration
:
duration
.seconds
(),
bitrate
,
aspect_ratio
:
0.0
,
width
:
0
,
height
:
0
,
}
}
pub
fn
set_frame_size
(
&
mut
self
,
width
:
i32
,
height
:
i32
)
{
self
.width
=
width
;
self
.height
=
height
;
self
.aspect_ratio
=
(
width
as
f64
/
height
as
f64
)
as
f32
;
}
pub
fn
save
(
&
self
,
path
:
impl
AsRef
<
Path
>
)
->
Result
<
(),
std
::
io
::
Error
>
{
serde_json
::
to_writer
(
BufWriter
::
new
(
File
::
create
(
path
)
?
),
self
)
?
;
Ok
(())
}
}
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