diff options
Diffstat (limited to 'libaf')
-rw-r--r-- | libaf/af.c | 4 | ||||
-rw-r--r-- | libaf/af.h | 2 | ||||
-rw-r--r-- | libaf/af_ladspa.c | 31 | ||||
-rw-r--r-- | libaf/af_lavcac3enc.c | 32 | ||||
-rw-r--r-- | libaf/af_scaletempo.c | 34 | ||||
-rw-r--r-- | libaf/format.c | 3 |
6 files changed, 59 insertions, 47 deletions
diff --git a/libaf/af.c b/libaf/af.c index 0601bd03a4..f8dde983e0 100644 --- a/libaf/af.c +++ b/libaf/af.c @@ -70,10 +70,8 @@ static af_info_t* filter_list[]={ #endif &af_info_volnorm, &af_info_extrastereo, -#ifdef CONFIG_LIBAVCODEC_A - &af_info_lavcac3enc, -#endif #ifdef CONFIG_LIBAVCODEC + &af_info_lavcac3enc, &af_info_lavcresample, #endif &af_info_sweep, diff --git a/libaf/af.h b/libaf/af.h index b6b546525e..fe146906e9 100644 --- a/libaf/af.h +++ b/libaf/af.h @@ -106,7 +106,7 @@ typedef struct af_cfg_s{ }af_cfg_t; // Current audio stream -typedef struct af_stream_s +typedef struct af_stream { // The first and last filter in the list af_instance_t* first; diff --git a/libaf/af_ladspa.c b/libaf/af_ladspa.c index e343d1ded7..bab44191be 100644 --- a/libaf/af_ladspa.c +++ b/libaf/af_ladspa.c @@ -41,7 +41,6 @@ /* Local Includes */ #include "af.h" -#include "help_mp.h" /* ------------------------------------------------------------------------- */ @@ -213,7 +212,7 @@ static int af_ladspa_parse_plugin(af_ladspa_t *setup) { if (setup->ninputs == 0) { mp_msg(MSGT_AFILTER, MSGL_WARN, "%s: %s\n", setup->myname, - MSGTR_AF_LADSPA_WarnNoInputs); + _("WARNING! This LADSPA plugin has no audio inputs.\n The incoming audio signal will be lost.")); } else if (setup->ninputs == 1) { mp_msg(MSGT_AFILTER, MSGL_V, "%s: this is a mono effect\n", setup->myname); } else if (setup->ninputs == 2) { @@ -225,13 +224,13 @@ static int af_ladspa_parse_plugin(af_ladspa_t *setup) { if (setup->noutputs == 0) { mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, - MSGTR_AF_LADSPA_ErrNoOutputs); + _("This LADSPA plugin has no audio outputs.")); return AF_ERROR; } if (setup->noutputs != setup->ninputs ) { mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, - MSGTR_AF_LADSPA_ErrInOutDiff); + _("The number of audio inputs and audio outputs of the LADSPA plugin differ.")); return AF_ERROR; } @@ -391,7 +390,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) { if (!setup->libhandle) { mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s %s\n\t%s\n", setup->myname, - MSGTR_AF_LADSPA_ErrFailedToLoad, setup->file, dlerror() ); + _("failed to load"), setup->file, dlerror() ); return AF_ERROR; } @@ -404,7 +403,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) { if (!descriptor_function) { mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n\t%s\n", setup->myname, - MSGTR_AF_LADSPA_ErrNoDescriptor, dlerror()); + _("Couldn't find ladspa_descriptor() function in the specified library file."), dlerror()); return AF_ERROR; } @@ -412,7 +411,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) { if (strcmp(setup->label, "help") == 0) { mp_msg(MSGT_AFILTER, MSGL_INFO, "%s: %s %s:\n", setup->myname, - MSGTR_AF_LADSPA_AvailableLabels, setup->file); + _("available labels in"), setup->file); for (i=0; ; i++) { ladspa_descriptor = descriptor_function(i); if (ladspa_descriptor == NULL) { @@ -432,7 +431,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) { ladspa_descriptor = descriptor_function(i); if (ladspa_descriptor == NULL) { mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, - MSGTR_AF_LADSPA_ErrLabelNotFound); + _("Couldn't find label in plugin library.")); return AF_ERROR; } if (strcmp(ladspa_descriptor->Label, setup->label) == 0) { @@ -458,7 +457,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) { */ static int af_ladspa_malloc_failed(char *myname) { - mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s", myname, MSGTR_MemAllocFailed); + mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s", myname, "Memory allocation failed.\n"); return AF_ERROR; } @@ -520,7 +519,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { if (!arg) { mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, - MSGTR_AF_LADSPA_ErrNoSuboptions); + _("No suboptions specified.")); return AF_ERROR; } @@ -532,7 +531,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { sscanf(arg, "%[^:]", buf); if (buf[0] == '\0') { mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, - MSGTR_AF_LADSPA_ErrNoLibFile); + _("No library file specified.")); free(buf); return AF_ERROR; } @@ -548,7 +547,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { sscanf(arg, "%[^:]", buf); if (buf[0] == '\0') { mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, - MSGTR_AF_LADSPA_ErrNoLabel); + _("No filter label specified.")); free(buf); return AF_ERROR; } @@ -584,14 +583,14 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { for(i=0; i<setup->ninputcontrols; i++) { if (!arg || (*(char*)arg != ':') ) { mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, - MSGTR_AF_LADSPA_ErrNotEnoughControls); + _("Not enough controls specified on the command line.")); return AF_ERROR; } arg++; r = sscanf(arg, "%f", &val); if (r!=1) { mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname, - MSGTR_AF_LADSPA_ErrNotEnoughControls); + _("Not enough controls specified on the command line.")); return AF_ERROR; } setup->inputcontrols[setup->inputcontrolsmap[i]] = val; @@ -617,13 +616,13 @@ static int control(struct af_instance_s *af, int cmd, void *arg) { if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) && val < hint.LowerBound) { - mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlBelow, + mp_tmsg(MSGT_AFILTER, MSGL_ERR, "%s: Input control #%d is below lower boundary of %0.4f.\n", setup->myname, i, hint.LowerBound); return AF_ERROR; } if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor) && val > hint.UpperBound) { - mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlAbove, + mp_tmsg(MSGT_AFILTER, MSGL_ERR, "%s: Input control #%d is above upper boundary of %0.4f.\n", setup->myname, i, hint.UpperBound); return AF_ERROR; } diff --git a/libaf/af_lavcac3enc.c b/libaf/af_lavcac3enc.c index 3d2d9e3b82..59eb08ac3b 100644 --- a/libaf/af_lavcac3enc.c +++ b/libaf/af_lavcac3enc.c @@ -24,15 +24,22 @@ #include <stdlib.h> #include <string.h> #include <inttypes.h> +#include <assert.h> #include "config.h" #include "af.h" -#include "help_mp.h" #include "reorder_ch.h" #include "libavcodec/avcodec.h" -#include "libavcodec/ac3.h" -#include "libavutil/intreadwrite.h" +#include "ffmpeg_files/intreadwrite.h" + +#define AC3_MAX_CHANNELS 6 +#define AC3_MAX_CODED_FRAME_SIZE 3840 +#define AC3_FRAME_SIZE (6 * 256) +const uint16_t ac3_bitrate_tab[19] = { + 32, 40, 48, 56, 64, 80, 96, 112, 128, + 160, 192, 224, 256, 320, 384, 448, 512, 576, 640 +}; // Data for specific instances of this filter typedef struct af_ac3enc_s { @@ -40,6 +47,7 @@ typedef struct af_ac3enc_s { struct AVCodecContext *lavc_actx; int add_iec61937_header; int bit_rate; + int pending_data_size; char *pending_data; int pending_len; int expect_len; @@ -64,6 +72,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) s->pending_len = 0; s->expect_len = AC3_FRAME_SIZE * data->nch * data->bps; + assert(s->expect_len <= s->pending_data_size); if (s->add_iec61937_header) af->mul = (double)AC3_FRAME_SIZE * 2 * 2 / s->expect_len; else @@ -99,10 +108,15 @@ static int control(struct af_instance_s *af, int cmd, void *arg) s->lavc_actx->bit_rate = bit_rate; if(avcodec_open(s->lavc_actx, s->lavc_acodec) < 0) { - mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_CouldntOpenCodec, "ac3", bit_rate); + mp_tmsg(MSGT_AFILTER, MSGL_ERR, "Couldn't open codec %s, br=%d.\n", "ac3", bit_rate); return AF_ERROR; } } + if (s->lavc_actx->frame_size != AC3_FRAME_SIZE) { + mp_msg(MSGT_AFILTER, MSGL_ERR, "lavcac3enc: unexpected ac3 " + "encoder frame size %d\n", s->lavc_actx->frame_size); + return AF_ERROR; + } af->data->format = AF_FORMAT_AC3_BE; af->data->nch = 2; return test_output_res; @@ -117,7 +131,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) s->bit_rate *= 1000; if (s->bit_rate) { for (i = 0; i < 19; ++i) - if (ff_ac3_bitrate_tab[i] * 1000 == s->bit_rate) + if (ac3_bitrate_tab[i] * 1000 == s->bit_rate) break; if (i >= 19) { mp_msg(MSGT_AFILTER, MSGL_WARN, "af_lavcac3enc unable set unsupported " @@ -263,8 +277,8 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data) static int af_open(af_instance_t* af){ af_ac3enc_t *s = calloc(1,sizeof(af_ac3enc_t)); - int pending_space = 2 * AC3_MAX_CHANNELS * AC3_FRAME_SIZE; - s->pending_data = calloc(pending_space, sizeof(char)); + s->pending_data_size = 2 * AF_NCH * AC3_FRAME_SIZE; + s->pending_data = malloc(s->pending_data_size); af->control=control; af->uninit=uninit; @@ -281,13 +295,13 @@ static int af_open(af_instance_t* af){ s->lavc_acodec = avcodec_find_encoder_by_name("ac3"); if (!s->lavc_acodec) { - mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_LavcAudioCodecNotFound, "ac3"); + mp_tmsg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, couldn't find encoder for codec %s.\n", "ac3"); return AF_ERROR; } s->lavc_actx = avcodec_alloc_context(); if (!s->lavc_actx) { - mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_CouldntAllocateLavcContext); + mp_tmsg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, couldn't allocate context!\n"); return AF_ERROR; } diff --git a/libaf/af_scaletempo.c b/libaf/af_scaletempo.c index 8b39290efa..4ea25bf9e3 100644 --- a/libaf/af_scaletempo.c +++ b/libaf/af_scaletempo.c @@ -38,7 +38,6 @@ #include "af.h" #include "libavutil/common.h" #include "subopt-helper.h" -#include "help_mp.h" // Data for specific instances of this filter typedef struct af_scaletempo_s @@ -226,6 +225,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data) int8_t* pout; if (s->scale == 1.0) { + af->delay = 0; return data; } @@ -470,27 +470,28 @@ static int control(struct af_instance_s* af, int cmd, void* arg) return AF_ERROR; } if (s->scale_nominal <= 0) { - mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] " - MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange - ": scale > 0\n"); + mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] %s: %s: scale > 0\n", + mp_gtext("error parsing command line"), + mp_gtext("value out of range")); return AF_ERROR; } if (s->ms_stride <= 0) { - mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] " - MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange - ": stride > 0\n"); + mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] %s: %s: stride > 0\n", + mp_gtext("error parsing command line"), + mp_gtext("value out of range")); return AF_ERROR; } if (s->percent_overlap < 0 || s->percent_overlap > 1) { - mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] " - MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange - ": 0 <= overlap <= 1\n"); + mp_msg(MSGT_AFILTER, MSGL_ERR, + "[scaletempo] %s: %s: 0 <= overlap <= 1\n", + mp_gtext("error parsing command line"), + mp_gtext("value out of range")); return AF_ERROR; } if (s->ms_search < 0) { - mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] " - MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange - ": search >= 0\n"); + mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] %s: %s: search >= 0\n", + mp_gtext("error parsing command line"), + mp_gtext("value out of range")); return AF_ERROR; } if (speed.len > 0) { @@ -507,9 +508,10 @@ static int control(struct af_instance_s* af, int cmd, void* arg) s->speed_tempo = 1; s->speed_pitch = 1; } else { - mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] " - MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange - ": speed=[pitch|tempo|none|both]\n"); + mp_msg(MSGT_AFILTER, MSGL_ERR, + "[scaletempo] %s: %s: speed=[pitch|tempo|none|both]\n", + mp_gtext("error parsing command line"), + mp_gtext("value out of range")); return AF_ERROR; } } diff --git a/libaf/format.c b/libaf/format.c index 21494f43b4..56766d2a2e 100644 --- a/libaf/format.c +++ b/libaf/format.c @@ -25,7 +25,6 @@ #include <limits.h> #include "af.h" -#include "help_mp.h" // Convert from string to format int af_str2fmt(const char* str) @@ -124,7 +123,7 @@ char* af_fmt2str(int format, char* str, int size) case(AF_FORMAT_IMA_ADPCM): i+=snprintf(&str[i],size-i,"IMA-ADPCM "); break; default: - i+=snprintf(&str[i],size-i,MSGTR_AF_FORMAT_UnknownFormat); + i+=snprintf(&str[i],size-i,mp_gtext("unknown format ")); } } else{ |