Skip to content

Instantly share code, notes, and snippets.

@jifang
Last active January 30, 2020 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jifang/28762ff152eb1f5f02b0c52dd35a605f to your computer and use it in GitHub Desktop.
Save jifang/28762ff152eb1f5f02b0c52dd35a605f to your computer and use it in GitHub Desktop.
Trim down the ffmpeg library
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 2b20067211..f6ef244063 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -83,6 +83,7 @@ static int packet_alloc(AVBufferRef **buf, int size)
return 0;
}
+#if 0
int av_new_packet(AVPacket *pkt, int size)
{
AVBufferRef *buf = NULL;
@@ -148,6 +149,7 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
return 0;
}
+#endif //0
int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
{
@@ -165,6 +167,7 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
return 0;
}
+#if 0
#if FF_API_AVPACKET_OLD_API
FF_DISABLE_DEPRECATION_WARNINGS
#define ALLOC_MALLOC(data, size) data = av_malloc(size)
@@ -267,6 +270,7 @@ int av_copy_packet(AVPacket *dst, const AVPacket *src)
FF_ENABLE_DEPRECATION_WARNINGS
#endif
+#endif //0
void av_packet_free_side_data(AVPacket *pkt)
{
int i;
@@ -347,6 +351,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
return data;
}
+#if 0
uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
int *size)
{
@@ -561,6 +566,7 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
}
return AVERROR(ENOENT);
}
+#endif
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
{
@@ -639,6 +645,7 @@ fail:
return ret;
}
+#if 0
AVPacket *av_packet_clone(const AVPacket *src)
{
AVPacket *ret = av_packet_alloc();
@@ -741,3 +748,4 @@ int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, i
return 0;
}
+#endif
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index a6a646636d..30f30b1222 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -65,7 +65,7 @@
#include "libavutil/ffversion.h"
const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
-static AVMutex codec_mutex = AV_MUTEX_INITIALIZER;
+//static AVMutex codec_mutex = AV_MUTEX_INITIALIZER;
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
{
@@ -79,6 +79,7 @@ void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
memset(*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
}
+#if 0
void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
{
uint8_t **p = ptr;
@@ -2232,3 +2233,4 @@ int ff_int_from_list_or_default(void *ctx, const char * val_name, int val,
"%s %d are not supported. Set to default value : %d\n", val_name, val, default_value);
return default_value;
}
+#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment