diff mbox series

[FFmpeg-devel] avformat/hashenc: Reuse hash_free() for framehash muxers

Message ID 20201207001119.524526-1-andreas.rheinhardt@gmail.com
State Accepted
Commit e0e9c94c2b51a3512b9a035a2dd9a5a399c68702
Headers show
Series [FFmpeg-devel] avformat/hashenc: Reuse hash_free() for framehash muxers
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Dec. 7, 2020, 12:11 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/hashenc.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Comments

Paul B Mahol Dec. 8, 2020, 11:14 a.m. UTC | #1
LGTM

On Mon, Dec 7, 2020 at 1:11 AM Andreas Rheinhardt <
andreas.rheinhardt@gmail.com> wrote:

> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/hashenc.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
> index ce609f6efa..5523dfd1cd 100644
> --- a/libavformat/hashenc.c
> +++ b/libavformat/hashenc.c
> @@ -156,6 +156,7 @@ static int hash_write_trailer(struct AVFormatContext
> *s)
>
>      return 0;
>  }
> +#endif
>
>  static void hash_free(struct AVFormatContext *s)
>  {
> @@ -168,7 +169,6 @@ static void hash_free(struct AVFormatContext *s)
>      }
>      av_freep(&c->hashes);
>  }
> -#endif
>
>  #if CONFIG_HASH_MUXER
>  static const AVClass hashenc_class = {
> @@ -326,14 +326,6 @@ static int framehash_write_packet(struct
> AVFormatContext *s, AVPacket *pkt)
>      avio_printf(s->pb, "\n");
>      return 0;
>  }
> -
> -static void framehash_free(struct AVFormatContext *s)
> -{
> -    struct HashContext *c = s->priv_data;
> -    if (c->hashes)
> -        av_hash_freep(&c->hashes[0]);
> -    av_freep(&c->hashes);
> -}
>  #endif
>
>  #if CONFIG_FRAMEHASH_MUXER
> @@ -353,7 +345,7 @@ AVOutputFormat ff_framehash_muxer = {
>      .init              = framehash_init,
>      .write_header      = framehash_write_header,
>      .write_packet      = framehash_write_packet,
> -    .deinit            = framehash_free,
> +    .deinit            = hash_free,
>      .flags             = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT |
>                           AVFMT_TS_NEGATIVE,
>      .priv_class        = &framehash_class,
> @@ -377,7 +369,7 @@ AVOutputFormat ff_framemd5_muxer = {
>      .init              = framehash_init,
>      .write_header      = framehash_write_header,
>      .write_packet      = framehash_write_packet,
> -    .deinit            = framehash_free,
> +    .deinit            = hash_free,
>      .flags             = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT |
>                           AVFMT_TS_NEGATIVE,
>      .priv_class        = &framemd5_class,
> --
> 2.25.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
index ce609f6efa..5523dfd1cd 100644
--- a/libavformat/hashenc.c
+++ b/libavformat/hashenc.c
@@ -156,6 +156,7 @@  static int hash_write_trailer(struct AVFormatContext *s)
 
     return 0;
 }
+#endif
 
 static void hash_free(struct AVFormatContext *s)
 {
@@ -168,7 +169,6 @@  static void hash_free(struct AVFormatContext *s)
     }
     av_freep(&c->hashes);
 }
-#endif
 
 #if CONFIG_HASH_MUXER
 static const AVClass hashenc_class = {
@@ -326,14 +326,6 @@  static int framehash_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     avio_printf(s->pb, "\n");
     return 0;
 }
-
-static void framehash_free(struct AVFormatContext *s)
-{
-    struct HashContext *c = s->priv_data;
-    if (c->hashes)
-        av_hash_freep(&c->hashes[0]);
-    av_freep(&c->hashes);
-}
 #endif
 
 #if CONFIG_FRAMEHASH_MUXER
@@ -353,7 +345,7 @@  AVOutputFormat ff_framehash_muxer = {
     .init              = framehash_init,
     .write_header      = framehash_write_header,
     .write_packet      = framehash_write_packet,
-    .deinit            = framehash_free,
+    .deinit            = hash_free,
     .flags             = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT |
                          AVFMT_TS_NEGATIVE,
     .priv_class        = &framehash_class,
@@ -377,7 +369,7 @@  AVOutputFormat ff_framemd5_muxer = {
     .init              = framehash_init,
     .write_header      = framehash_write_header,
     .write_packet      = framehash_write_packet,
-    .deinit            = framehash_free,
+    .deinit            = hash_free,
     .flags             = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT |
                          AVFMT_TS_NEGATIVE,
     .priv_class        = &framemd5_class,