]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/truespeech.c
lavc: remove disabled FF_API_COLOR_TABLE_ID cruft
[ffmpeg] / libavcodec / truespeech.c
index efe5f457069fb4273d540a4a217fc687696d2167..859983c574bcab7c459115bf7a44d2030d90cb9e 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/audioconvert.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "get_bits.h"
+#include "internal.h"
 
 #include "truespeech_data.h"
 /**
@@ -35,7 +36,6 @@
  * TrueSpeech decoder context
  */
 typedef struct {
-    AVFrame frame;
     DSPContext dsp;
     /* input data */
     DECLARE_ALIGNED(16, uint8_t, buffer)[32];
@@ -64,7 +64,7 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx)
 
     if (avctx->channels != 1) {
         av_log_ask_for_sample(avctx, "Unsupported channel count: %d\n", avctx->channels);
-        return AVERROR(EINVAL);
+        return AVERROR_PATCHWELCOME;
     }
 
     avctx->channel_layout = AV_CH_LAYOUT_MONO;
@@ -72,9 +72,6 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx)
 
     ff_dsputil_init(&c->dsp, avctx);
 
-    avcodec_get_frame_defaults(&c->frame);
-    avctx->coded_frame = &c->frame;
-
     return 0;
 }
 
@@ -309,6 +306,7 @@ static void truespeech_save_prevvec(TSContext *c)
 static int truespeech_decode_frame(AVCodecContext *avctx, void *data,
                                    int *got_frame_ptr, AVPacket *avpkt)
 {
+    AVFrame *frame     = data;
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     TSContext *c = avctx->priv_data;
@@ -326,12 +324,12 @@ static int truespeech_decode_frame(AVCodecContext *avctx, void *data,
     }
 
     /* get output buffer */
-    c->frame.nb_samples = iterations * 240;
-    if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) {
+    frame->nb_samples = iterations * 240;
+    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return ret;
     }
-    samples = (int16_t *)c->frame.data[0];
+    samples = (int16_t *)frame->data[0];
 
     memset(samples, 0, iterations * 240 * sizeof(*samples));
 
@@ -353,8 +351,7 @@ static int truespeech_decode_frame(AVCodecContext *avctx, void *data,
         truespeech_save_prevvec(c);
     }
 
-    *got_frame_ptr   = 1;
-    *(AVFrame *)data = c->frame;
+    *got_frame_ptr = 1;
 
     return buf_size;
 }