summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/ae_lavc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs/ae_lavc.c')
-rw-r--r--libmpcodecs/ae_lavc.c47
1 files changed, 7 insertions, 40 deletions
diff --git a/libmpcodecs/ae_lavc.c b/libmpcodecs/ae_lavc.c
index b4e437fada..2122535ee2 100644
--- a/libmpcodecs/ae_lavc.c
+++ b/libmpcodecs/ae_lavc.c
@@ -34,7 +34,7 @@
#include "libaf/af_format.h"
#include "libaf/reorder_ch.h"
#include "libavcodec/avcodec.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
static AVCodec *lavc_acodec;
static AVCodecContext *lavc_actx;
@@ -44,10 +44,7 @@ extern int lavc_param_atag;
extern int lavc_param_audio_global_header;
extern int avcodec_initialized;
static int compressed_frame_size = 0;
-#ifdef CONFIG_LIBAVFORMAT
-#include "libavformat/avformat.h"
-extern const struct AVCodecTag *mp_wav_taglists[];
-#endif
+#include "libmpdemux/mp_taglists.h"
static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a)
{
@@ -151,32 +148,6 @@ static int get_frame_size(audio_encoder_t *encoder)
return sz;
}
-#ifndef CONFIG_LIBAVFORMAT
-static uint32_t lavc_find_atag(char *codec)
-{
- if(codec == NULL)
- return 0;
-
- if(! strcasecmp(codec, "mp2"))
- return 0x50;
-
- if(! strcasecmp(codec, "mp3"))
- return 0x55;
-
- if(! strcasecmp(codec, "ac3"))
- return 0x2000;
-
- if(! strcasecmp(codec, "adpcm_ima_wav"))
- return 0x11;
-
- if(! strncasecmp(codec, "bonk", 4))
- return 0x2048;
-
- return 0;
-}
-#endif
-
-
int mpae_init_lavc(audio_encoder_t *encoder)
{
encoder->params.samples_per_frame = encoder->params.sample_rate;
@@ -184,7 +155,7 @@ int mpae_init_lavc(audio_encoder_t *encoder)
if(!lavc_param_acodec)
{
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_NoLavcAudioCodecName);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Audio LAVC, Missing codec name!\n");
return 0;
}
@@ -197,16 +168,12 @@ int mpae_init_lavc(audio_encoder_t *encoder)
lavc_acodec = avcodec_find_encoder_by_name(lavc_param_acodec);
if (!lavc_acodec)
{
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_LavcAudioCodecNotFound, lavc_param_acodec);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Audio LAVC, couldn't find encoder for codec %s.\n", lavc_param_acodec);
return 0;
}
if(lavc_param_atag == 0)
{
-#ifdef CONFIG_LIBAVFORMAT
- lavc_param_atag = av_codec_get_tag(mp_wav_taglists, lavc_acodec->id);
-#else
- lavc_param_atag = lavc_find_atag(lavc_param_acodec);
-#endif
+ lavc_param_atag = mp_av_codec_get_tag(mp_wav_taglists, lavc_acodec->id);
if(!lavc_param_atag)
{
mp_msg(MSGT_MENCODER, MSGL_FATAL, "Couldn't find wav tag for specified codec, exit\n");
@@ -217,7 +184,7 @@ int mpae_init_lavc(audio_encoder_t *encoder)
lavc_actx = avcodec_alloc_context();
if(lavc_actx == NULL)
{
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CouldntAllocateLavcContext);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Audio LAVC, couldn't allocate context!\n");
return 0;
}
@@ -258,7 +225,7 @@ int mpae_init_lavc(audio_encoder_t *encoder)
if(avcodec_open(lavc_actx, lavc_acodec) < 0)
{
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CouldntOpenCodec, lavc_param_acodec, lavc_param_abitrate);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Couldn't open codec %s, br=%d.\n", lavc_param_acodec, lavc_param_abitrate);
return 0;
}