Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
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
Container Registry
Model registry
Operate
Environments
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
libremedia
Tethys
FFmpeg
Commits
b84f3a40
Commit
b84f3a40
authored
8 years ago
by
Martin Storsjö
Browse files
Options
Downloads
Patches
Plain Diff
movenc: Write 'loci' geotag metadata for 3gp and mp4
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
f12a705e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/movenc.c
+53
-0
53 additions, 0 deletions
libavformat/movenc.c
with
53 additions
and
0 deletions
libavformat/movenc.c
+
53
−
0
View file @
b84f3a40
...
@@ -2040,6 +2040,57 @@ static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb,
...
@@ -2040,6 +2040,57 @@ static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb,
return
mov_write_string_tag
(
pb
,
name
,
t
->
value
,
lang
,
long_style
);
return
mov_write_string_tag
(
pb
,
name
,
t
->
value
,
lang
,
long_style
);
}
}
/* 3GPP TS 26.244 */
static
int
mov_write_loci_tag
(
AVFormatContext
*
s
,
AVIOContext
*
pb
)
{
int
lang
;
int64_t
pos
=
avio_tell
(
pb
);
double
latitude
,
longitude
,
altitude
;
int32_t
latitude_fix
,
longitude_fix
,
altitude_fix
;
AVDictionaryEntry
*
t
=
get_metadata_lang
(
s
,
"location"
,
&
lang
);
const
char
*
ptr
,
*
place
=
""
;
char
*
end
;
const
char
*
astronomical_body
=
"earth"
;
if
(
!
t
)
return
0
;
ptr
=
t
->
value
;
longitude
=
strtod
(
ptr
,
&
end
);
if
(
end
==
ptr
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"malformed location metadata
\n
"
);
return
0
;
}
ptr
=
end
;
latitude
=
strtod
(
ptr
,
&
end
);
if
(
end
==
ptr
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"malformed location metadata
\n
"
);
return
0
;
}
ptr
=
end
;
altitude
=
strtod
(
ptr
,
&
end
);
/* If no altitude was present, the default 0 should be fine */
if
(
*
end
==
'/'
)
place
=
end
+
1
;
latitude_fix
=
(
int32_t
)
((
1
<<
16
)
*
latitude
);
longitude_fix
=
(
int32_t
)
((
1
<<
16
)
*
longitude
);
altitude_fix
=
(
int32_t
)
((
1
<<
16
)
*
altitude
);
avio_wb32
(
pb
,
0
);
/* size */
ffio_wfourcc
(
pb
,
"loci"
);
/* type */
avio_wb32
(
pb
,
0
);
/* version + flags */
avio_wb16
(
pb
,
lang
);
avio_write
(
pb
,
place
,
strlen
(
place
)
+
1
);
avio_w8
(
pb
,
0
);
/* role of place (0 == shooting location, 1 == real location, 2 == fictional location) */
avio_wb32
(
pb
,
latitude_fix
);
avio_wb32
(
pb
,
longitude_fix
);
avio_wb32
(
pb
,
altitude_fix
);
avio_write
(
pb
,
astronomical_body
,
strlen
(
astronomical_body
)
+
1
);
avio_w8
(
pb
,
0
);
/* additional notes, null terminated string */
return
update_size
(
pb
,
pos
);
}
/* iTunes track number */
/* iTunes track number */
static
int
mov_write_trkn_tag
(
AVIOContext
*
pb
,
MOVMuxContext
*
mov
,
static
int
mov_write_trkn_tag
(
AVIOContext
*
pb
,
MOVMuxContext
*
mov
,
AVFormatContext
*
s
)
AVFormatContext
*
s
)
...
@@ -2194,6 +2245,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
...
@@ -2194,6 +2245,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
mov_write_3gp_udta_tag
(
pb_buf
,
s
,
"albm"
,
"album"
);
mov_write_3gp_udta_tag
(
pb_buf
,
s
,
"albm"
,
"album"
);
mov_write_3gp_udta_tag
(
pb_buf
,
s
,
"cprt"
,
"copyright"
);
mov_write_3gp_udta_tag
(
pb_buf
,
s
,
"cprt"
,
"copyright"
);
mov_write_3gp_udta_tag
(
pb_buf
,
s
,
"yrrc"
,
"date"
);
mov_write_3gp_udta_tag
(
pb_buf
,
s
,
"yrrc"
,
"date"
);
mov_write_loci_tag
(
s
,
pb_buf
);
}
else
if
(
mov
->
mode
==
MODE_MOV
)
{
// the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4
}
else
if
(
mov
->
mode
==
MODE_MOV
)
{
// the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4
mov_write_string_metadata
(
s
,
pb_buf
,
"
\251
ART"
,
"artist"
,
0
);
mov_write_string_metadata
(
s
,
pb_buf
,
"
\251
ART"
,
"artist"
,
0
);
mov_write_string_metadata
(
s
,
pb_buf
,
"
\251
nam"
,
"title"
,
0
);
mov_write_string_metadata
(
s
,
pb_buf
,
"
\251
nam"
,
"title"
,
0
);
...
@@ -2211,6 +2263,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
...
@@ -2211,6 +2263,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
}
else
{
}
else
{
/* iTunes meta data */
/* iTunes meta data */
mov_write_meta_tag
(
pb_buf
,
mov
,
s
);
mov_write_meta_tag
(
pb_buf
,
mov
,
s
);
mov_write_loci_tag
(
s
,
pb_buf
);
}
}
if
(
s
->
nb_chapters
&&
!
(
mov
->
flags
&
FF_MOV_FLAG_DISABLE_CHPL
))
if
(
s
->
nb_chapters
&&
!
(
mov
->
flags
&
FF_MOV_FLAG_DISABLE_CHPL
))
...
...
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