Bump to 6.1
[platform/upstream/ffmpeg.git] / libavformat / movenc.c
index e39f1ac..252082c 100644 (file)
@@ -130,6 +130,11 @@ static const AVClass mov_isobmff_muxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
+#ifdef TIZEN_FEATURE_LIBAV
+#include <time.h>
+#define globalTimescale 1000
+#endif /* TIZEN_FEATURE_LIBAV */
+
 static int get_moov_size(AVFormatContext *s);
 static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt);
 
@@ -3373,6 +3378,18 @@ static int mov_write_mdia_tag(AVFormatContext *s, AVIOContext *pb,
     return update_size(pb, pos);
 }
 
+#ifdef TIZEN_FEATURE_LIBAV
+static int64_t get_current_time(AVFormatContext *s)
+{
+    time_t timep = time(NULL);
+    if (timep == -1) {
+        av_log(s, AV_LOG_ERROR, "fatal error, time function returns error\n");
+        return 0;
+    }
+    return timep + 0x7C25B080;//1904 based
+}
+#endif /* TIZEN_FEATURE_LIBAV */
+
 /* transformation matrix
      |a  b  u|
      |c  d  v|
@@ -7211,6 +7228,10 @@ static int mov_init(AVFormatContext *s)
                 }
                 track->height = track->tag >> 24 == 'n' ? 486 : 576;
             }
+#ifdef TIZEN_FEATURE_LIBAV
+            track->timescale = globalTimescale;
+            avpriv_set_pts_info(st, 64, 1, globalTimescale);
+#else /* TIZEN_FEATURE_LIBAV */
             if (mov->video_track_timescale) {
                 track->timescale = mov->video_track_timescale;
                 if (mov->mode == MODE_ISM && mov->video_track_timescale != 10000000)
@@ -7220,6 +7241,7 @@ static int mov_init(AVFormatContext *s)
                 while(track->timescale < 10000)
                     track->timescale *= 2;
             }
+#endif /* TIZEN_FEATURE_LIBAV */
             if (st->codecpar->width > 65535 || st->codecpar->height > 65535) {
                 av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for mov/mp4\n", st->codecpar->width, st->codecpar->height);
                 return AVERROR(EINVAL);
@@ -7473,9 +7495,13 @@ static int mov_write_header(AVFormatContext *s)
         mov_write_mdat_tag(pb, mov);
     }
 
+#ifdef TIZEN_FEATURE_LIBAV
+    mov->time = get_current_time(s);
+#else /* TIZEN_FEATURE_LIBAV */
     ff_parse_creation_time_metadata(s, &mov->time, 1);
     if (mov->time)
         mov->time += 0x7C25B080; // 1970 based -> 1904 based
+#endif /* TIZEN_FEATURE_LIBAV */
 
     if (mov->chapter_track)
         if ((ret = mov_create_chapter_track(s, mov->chapter_track)) < 0)
@@ -7814,6 +7840,9 @@ static int avif_write_trailer(AVFormatContext *s)
 #if CONFIG_TGP_MUXER || CONFIG_TG2_MUXER
 static const AVCodecTag codec_3gp_tags[] = {
     { AV_CODEC_ID_H263,     MKTAG('s','2','6','3') },
+#ifdef TIZEN_FEATURE_LIBAV
+    { AV_CODEC_ID_H263P,    MKTAG('s','2','6','3') },
+#endif /* TIZEN_FEATURE_LIBAV */
     { AV_CODEC_ID_H264,     MKTAG('a','v','c','1') },
     { AV_CODEC_ID_MPEG4,    MKTAG('m','p','4','v') },
     { AV_CODEC_ID_AAC,      MKTAG('m','p','4','a') },
@@ -7863,6 +7892,11 @@ static const AVCodecTag codec_mp4_tags[] = {
     { AV_CODEC_ID_MPEGH_3D_AUDIO,  MKTAG('m', 'h', 'm', '1') },
     { AV_CODEC_ID_TTML,            MOV_MP4_TTML_TAG          },
     { AV_CODEC_ID_TTML,            MOV_ISMV_TTML_TAG         },
+#ifdef TIZEN_FEATURE_LIBAV
+    { AV_CODEC_ID_H263,            MKTAG('h', '2', '6', '3') },
+    { AV_CODEC_ID_H263,            MKTAG('s', '2', '6', '3') },
+    { AV_CODEC_ID_MJPEG,           MKTAG('j', 'p', 'e', 'g') },
+#endif
 
     /* ISO/IEC 23003-5 integer formats */
     { AV_CODEC_ID_PCM_S16BE,       MOV_MP4_IPCM_TAG          },