Merge Tizen specific modification 61/269861/2 accepted/tizen/unified/20220204.132356 submit/tizen/20220126.013721 submit/tizen/20220203.005627
authorJeongmo Yang <jm80.yang@samsung.com>
Fri, 21 Jan 2022 00:51:44 +0000 (09:51 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Fri, 21 Jan 2022 01:04:20 +0000 (10:04 +0900)
Change-Id: I1e0a63102f8bdf3dc8269f6ecb172c3b63d43634
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
ffbuild/pkgconfig_generate.sh
libavcodec/avcodec.h
libavcodec/avpacket.c
libavcodec/packet.h
libavformat/Makefile
libavformat/movenc.c
packaging/ffmpeg.spec

index e5de671..8d9d0b2 100755 (executable)
@@ -40,7 +40,7 @@ Requires.private: $($shared && echo $requires)
 Conflicts:
 Libs: -L\${libdir} $rpath -l${fullname#lib} $($shared || echo $libs)
 Libs.private: $($shared && echo $libs)
-Cflags: -I\${includedir}
+Cflags: -I\${includedir} -DTIZEN_FEATURE_LIBAV
 EOF
 
 mkdir -p doc/examples/pc-uninstalled
index 8a71c04..e43e29c 100644 (file)
@@ -772,6 +772,11 @@ typedef struct AVCodecContext {
                             const AVFrame *src, int offset[AV_NUM_DATA_POINTERS],
                             int y, int type, int height);
 
+#ifdef TIZEN_FEATURE_LIBAV
+    int i_frame_number;
+    int stts_count;
+#endif /* TIZEN_FEATURE_LIBAV */
+
     /**
      * callback to negotiate the pixelFormat
      * @param fmt is the list of formats which are supported by the codec,
index b5bac5c..873cc7c 100644 (file)
@@ -49,6 +49,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
     pkt->buf                  = NULL;
     pkt->side_data            = NULL;
     pkt->side_data_elems      = 0;
+#ifdef TIZEN_FEATURE_LIBAV
+    pkt->is_mux = 0;
+#endif /* TIZEN_FEATURE_LIBAV */
 }
 #endif
 
index ca18ae6..6a95436 100644 (file)
@@ -387,6 +387,9 @@ typedef struct AVPacket {
     int64_t duration;
 
     int64_t pos;                            ///< byte position in stream, -1 if unknown
+#ifdef TIZEN_FEATURE_LIBAV
+    int is_mux;
+#endif /* TIZEN_FEATURE_LIBAV */
 
 #if FF_API_CONVERGENCE_DURATION
     /**
index 0f340f7..5940e02 100644 (file)
@@ -4,6 +4,8 @@ DESC = FFmpeg container format library
 HEADERS = avformat.h                                                    \
           avio.h                                                        \
           version.h                                                     \
+          movenc.h                                                      \
+          movenccenc.h
 
 OBJS = allformats.o         \
        avio.o               \
index 2cd5773..8e23ae9 100644 (file)
@@ -118,6 +118,11 @@ static const AVClass flavor ## _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 utf8len(const uint8_t *b)
@@ -3019,6 +3024,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|
@@ -6636,6 +6653,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)
@@ -6645,6 +6666,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);
@@ -6849,9 +6871,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)
@@ -7180,6 +7206,9 @@ static int mov_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
 #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') },
@@ -7316,7 +7345,11 @@ AVOutputFormat ff_mp4_muxer = {
     .write_trailer     = mov_write_trailer,
     .deinit            = mov_free,
     .flags             = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH | AVFMT_TS_NEGATIVE,
+#ifdef TIZEN_FEATURE_LIBAV
+    .codec_tag         = ff_codec_movvideo_tags,
+#else /* TIZEN_FEATURE_LIBAV */
     .codec_tag         = mp4_codec_tags_list,
+#endif /* TIZEN_FEATURE_LIBAV */
     .check_bitstream   = mov_check_bitstream,
     .priv_class        = &mp4_muxer_class,
 };
index a2b06c0..94ce6ea 100644 (file)
@@ -1,7 +1,7 @@
 Name:       ffmpeg
 Summary:    AV codec lib
-Version: 4.4.1
-Release:    0
+Version:    4.4.1
+Release:    1
 Group:      Multimedia/Libraries
 URL:        https://ffmpeg.org/
 License:    LGPL-2.1+
@@ -176,7 +176,7 @@ export CONFIGURE_OPTIONS+="--disable-mmx "
 %endif
 
 CFLAGS="%{optflags} -fPIC -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" "; export CFLAGS
-export CFLAGS+=" -D__TIZEN__"
+export CFLAGS+=" -D__TIZEN__ -DTIZEN_FEATURE_LIBAV"
 
 %ifarch %{arm}
 export CONFIGURE_OPTIONS+="--extra-cflags=-mfpu=neon"