Project import generated by Copybara.

GitOrigin-RevId: 994446be2b5c859d086940991cb1d31df5f4d37c
diff --git a/LOCAL_MODIFICATIONS b/LOCAL_MODIFICATIONS
index 02dfb97..6cb2c8a 100644
--- a/LOCAL_MODIFICATIONS
+++ b/LOCAL_MODIFICATIONS
@@ -6,4 +6,39 @@
 libavutil/. This also required removing the line about avconfig.h from
 libavutil/.gitignore so that it could be checked into our repo.
 
+Added several enums to enable google hardware accelerated decoder "h264_gaccel"
+to be used from ffmpeg via Stadia Decoder API.
+    - in libavutil/pixfmt, added AV_PIX_FMT_GACCEL to enum AVPixelFormat
+    - in libavutil/pixdesc.c, added AV_PIX_FMT_GACCEL entry to
+      av_pix_fmt_descriptors list
+    - in libavutil/frame.h, added AV_FRAME_DATA_PROCESSING_STATS to enum
+      AVFrameSideDataType
+    - in libavutil/frame.c, added switch entry for AV_FRAME_DATA_PROCESSING_STATS
+      in av_frame_side_data_name
+    - in libavcodec/avcodec.h, added AV_PKT_DATA_PROCESSING_STATS to enum
+      AVPacketsSideDataType
+    - in libavcodec/decode.c, added entry for AV_PKT_DATA_PROCESSING_STATS in
+      ff_decode_frame_props
+
+Made small changes to expose three ffmpeg internal functions
+1) ff_decode_get_packet, 2) ff_get_buffer, and 3) ff_set_dimensions
+    - in libavcodec/Makefile, added decode.h and internal.h to HEADERS list
+    - in libavcodec/avcodec.h, defined 3 functions:
+          1) av_stadia_decode_get_packet, same function type as
+             ff_decode_get_packet
+          2) av_stadia_get_buffer, same function type as ff_decode_get_buffer
+          3) av_stadia_set_dimensions, same function type as
+             ff_decode_set_dimensions
+    - in libavcodec/decode.c, defined
+          1) av_stadia_decode_get_packet, to call ff_decode_get_packet
+          2) av_stadia_get_buffer, to call ff_get_buffer
+    - in libavcodec/utils.c, defined
+          1) av_stadia_set_dimensions, to call ff_set_dimensions
+
+Added extern "C" annotations to the following headers files:
+    - libavcodec/avcodec.h
+    - libavutil/avutil.h
+    - libavutil/buffer.h
+    - libavutil/frame.h
+
 Added custom BUILD file for Yeti.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3cd73fb..8c8614f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -7,9 +7,11 @@
           avdct.h                                                       \
           avfft.h                                                       \
           d3d11va.h                                                     \
+          decode.h                                                      \
           dirac.h                                                       \
           dv_profile.h                                                  \
           dxva2.h                                                       \
+          internal.h                                                    \
           jni.h                                                         \
           mediacodec.h                                                  \
           qsv.h                                                         \
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index d234271..388e52e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1,3 +1,6 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
 /*
  * copyright (c) 2001 Fabrice Bellard
  *
@@ -1405,6 +1408,12 @@
     AV_PKT_DATA_AFD,
 
     /**
+     * Google3-specific; additional end-to-end processing statistics about the
+     * particular PKT.
+     */
+    AV_PKT_DATA_PROCESSING_STATS,
+
+    /**
      * The number of side data types.
      * This is not part of the public API/ABI in the sense that it may
      * change when new side data types are added.
@@ -6222,7 +6231,25 @@
 AVCPBProperties *av_cpb_properties_alloc(size_t *size);
 
 /**
+ * Externally exposed thinly wrapped ff_get_buffer.
+ */
+int av_stadia_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags);
+
+/**
+ * Externally exposed thinly wrapped ff_set_dimensions.
+ */
+int av_stadia_set_dimensions(AVCodecContext *avctx, int width, int height);
+
+/**
+ * Externally exposed thinly wrapped ff_decode_get_packet.
+ */
+int av_stadia_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt);
+
+/**
  * @}
  */
 
 #endif /* AVCODEC_AVCODEC_H */
+#ifdef __cplusplus
+}
+#endif
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 6c31166..6a1b90c 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -357,6 +357,11 @@
     return ret;
 }
 
+int av_stadia_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
+{
+  return ff_decode_get_packet(avctx, pkt);
+}
+
 /**
  * Attempt to guess proper monotonic timestamps for decoded video frames
  * which might have incorrect times. Input timestamps may wrap around, in
@@ -1751,6 +1756,7 @@
         { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
         { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,        AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
         { AV_PKT_DATA_A53_CC,                     AV_FRAME_DATA_A53_CC },
+        { AV_PKT_DATA_PROCESSING_STATS,           AV_FRAME_DATA_PROCESSING_STATS },
     };
 
     if (pkt) {
@@ -1971,6 +1977,12 @@
     return ret;
 }
 
+int av_stadia_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
+{
+  return ff_get_buffer(avctx, frame, flags);
+}
+
+
 static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
 {
     AVFrame *tmp;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index a6a6466..f94de5a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -116,6 +116,11 @@
     return ret;
 }
 
+int av_stadia_set_dimensions(AVCodecContext *s, int width, int height)
+{
+  return ff_set_dimensions(s, width, height);
+}
+
 int ff_set_sar(AVCodecContext *avctx, AVRational sar)
 {
     int ret = av_image_check_sar(avctx->width, avctx->height, sar);
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 4d63315..459eeba 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -1,3 +1,6 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
 /*
  * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  *
@@ -363,3 +366,6 @@
  */
 
 #endif /* AVUTIL_AVUTIL_H */
+#ifdef __cplusplus
+}
+#endif
diff --git a/libavutil/buffer.h b/libavutil/buffer.h
index 73b6bd0..a6a6328 100644
--- a/libavutil/buffer.h
+++ b/libavutil/buffer.h
@@ -1,3 +1,6 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
 /*
  * This file is part of FFmpeg.
  *
@@ -289,3 +292,6 @@
  */
 
 #endif /* AVUTIL_BUFFER_H */
+#ifdef __cplusplus
+}
+#endif
diff --git a/libavutil/frame.c b/libavutil/frame.c
index dcf1fc3..898a999 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -842,6 +842,7 @@
 #endif
     case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";
     case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
+    case AV_FRAME_DATA_PROCESSING_STATS:            return "Processing stats";
     }
     return NULL;
 }
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 5d3231e..22a74a7 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -1,3 +1,6 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
 /*
  * This file is part of FFmpeg.
  *
@@ -179,6 +182,12 @@
      * array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
      */
     AV_FRAME_DATA_REGIONS_OF_INTEREST,
+
+    /**
+     * Google-specific; additional end-to-end processing statistics about the
+     * particular frame.
+     */
+    AV_FRAME_DATA_PROCESSING_STATS,
 };
 
 enum AVActiveFormatDescription {
@@ -969,3 +978,6 @@
  */
 
 #endif /* AVUTIL_FRAME_H */
+#ifdef __cplusplus
+}
+#endif
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index b97b066..30a890e 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2344,6 +2344,10 @@
         },
         .flags = AV_PIX_FMT_FLAG_PLANAR,
     },
+    [AV_PIX_FMT_GACCEL] = {
+        .name = "gaccel",
+        .flags = AV_PIX_FMT_FLAG_HWACCEL,
+    },
 };
 #if FF_API_PLUS1_MINUS1
 FF_ENABLE_DEPRECATION_WARNINGS
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 8b54c94..964d57f 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -348,6 +348,8 @@
     AV_PIX_FMT_NV24,      ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
     AV_PIX_FMT_NV42,      ///< as above, but U and V bytes are swapped
 
+    AV_PIX_FMT_GACCEL,    ///< hardware acceleration through GAccel.
+
     AV_PIX_FMT_NB         ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
 };