[FFmpeg-devel,3/3] avformat/movenc: use mov_write_int_metadata() in place of mov_write_tmpo_tag()

Submitted by Moritz Barsnick on Sept. 19, 2018, 1:58 p.m.

Details

Message ID 7e5a464694286c640d8c8b855371e81bc10699a3.1537349317.git.barsnick@gmx.net
State New
Headers show

Commit Message

Moritz Barsnick Sept. 19, 2018, 1:58 p.m.
Removes code duplication.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
---
 libavformat/movenc.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 0bb66e5fd1..52f661e061 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3356,24 +3356,6 @@  static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb,
     return mov_write_string_tag(pb, name, t->value, lang, long_style);
 }
 
-/* iTunes bpm number */
-static int mov_write_tmpo_tag(AVIOContext *pb, AVFormatContext *s)
-{
-    AVDictionaryEntry *t = av_dict_get(s->metadata, "tmpo", NULL, 0);
-    int size = 0, tmpo = t ? atoi(t->value) : 0;
-    if (tmpo) {
-        size = 26;
-        avio_wb32(pb, size);
-        ffio_wfourcc(pb, "tmpo");
-        avio_wb32(pb, size-8); /* size */
-        ffio_wfourcc(pb, "data");
-        avio_wb32(pb, 0x15);  //type specifier
-        avio_wb32(pb, 0);
-        avio_wb16(pb, tmpo);        // data
-    }
-    return size;
-}
-
 /* 3GPP TS 26.244 */
 static int mov_write_loci_tag(AVFormatContext *s, AVIOContext *pb)
 {
@@ -3552,7 +3534,7 @@  static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
     mov_write_covr(pb, s);
     mov_write_trkn_tag(pb, mov, s, 0); // track number
     mov_write_trkn_tag(pb, mov, s, 1); // disc number
-    mov_write_tmpo_tag(pb, s);
+    mov_write_int_metadata   (s, pb, "tmpo",    "tmpo"     , 2, 2);
     return update_size(pb, pos);
 }