mp3enc: remove mp3_write_packet(), use ff_raw_write_packet() instead

Message ID 1300258357-14802-1-git-send-email-anton@khirnov.net
State Superseded
Headers show

Commit Message

Anton Khirnov March 16, 2011, 6:52 a.m.
The two functions are identical, no point in duplicating code here.
---
 libavformat/mp3enc.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

Comments

Luca Barbato March 16, 2011, 12:44 p.m. | #1
On 03/16/2011 07:52 AM, Anton Khirnov wrote:
> The two functions are identical, no point in duplicating code here.

ok
Justin Ruggles March 16, 2011, 1:19 p.m. | #2
On 03/16/2011 02:52 AM, Anton Khirnov wrote:

> The two functions are identical, no point in duplicating code here.
> ---
>  libavformat/mp3enc.c |   13 +++----------
>  1 files changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
> index 27d25f5..67ec826 100644
> --- a/libavformat/mp3enc.c
> +++ b/libavformat/mp3enc.c
> @@ -23,6 +23,7 @@
>  #include "avformat.h"
>  #include "id3v1.h"
>  #include "id3v2.h"
> +#include "rawenc.h"
>  #include "libavutil/intreadwrite.h"
>  #include "libavutil/opt.h"
>  
> @@ -125,14 +126,6 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
>      return len + ID3v2_HEADER_SIZE;
>  }
>  
> -
> -static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
> -{
> -    avio_write(s->pb, pkt->data, pkt->size);
> -    put_flush_packet(s->pb);
> -    return 0;
> -}
> -
>  static int mp3_write_trailer(struct AVFormatContext *s)
>  {
>      uint8_t buf[ID3v1_TAG_SIZE];
> @@ -155,7 +148,7 @@ AVOutputFormat ff_mp2_muxer = {
>      CODEC_ID_MP2,
>      CODEC_ID_NONE,
>      NULL,
> -    mp3_write_packet,
> +    ff_raw_write_packet,
>      mp3_write_trailer,
>  };
>  #endif
> @@ -254,7 +247,7 @@ AVOutputFormat ff_mp3_muxer = {
>      CODEC_ID_MP3,
>      CODEC_ID_NONE,
>      mp3_write_header,
> -    mp3_write_packet,
> +    ff_raw_write_packet,
>      mp3_write_trailer,
>      AVFMT_NOTIMESTAMPS,
>      .priv_class = &mp3_muxer_class,


missing Makefile dependency on rawenc.o

-Justin

Patch

diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 27d25f5..67ec826 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -23,6 +23,7 @@ 
 #include "avformat.h"
 #include "id3v1.h"
 #include "id3v2.h"
+#include "rawenc.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
 
@@ -125,14 +126,6 @@  static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
     return len + ID3v2_HEADER_SIZE;
 }
 
-
-static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    avio_write(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
-    return 0;
-}
-
 static int mp3_write_trailer(struct AVFormatContext *s)
 {
     uint8_t buf[ID3v1_TAG_SIZE];
@@ -155,7 +148,7 @@  AVOutputFormat ff_mp2_muxer = {
     CODEC_ID_MP2,
     CODEC_ID_NONE,
     NULL,
-    mp3_write_packet,
+    ff_raw_write_packet,
     mp3_write_trailer,
 };
 #endif
@@ -254,7 +247,7 @@  AVOutputFormat ff_mp3_muxer = {
     CODEC_ID_MP3,
     CODEC_ID_NONE,
     mp3_write_header,
-    mp3_write_packet,
+    ff_raw_write_packet,
     mp3_write_trailer,
     AVFMT_NOTIMESTAMPS,
     .priv_class = &mp3_muxer_class,