]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mlpdec.c
avcodec: Drop long-deprecated imgconvert.h header
[ffmpeg] / libavcodec / mlpdec.c
index 9a2496dcb58f21295003e452c350470f8d485de4..afd8f887ec6471f02b89a4e7ebe4b26fadfb4523 100644 (file)
 /** number of bits used for VLC lookup - longest Huffman code is 9 */
 #define VLC_BITS            9
 
-
-static const char* sample_message =
-    "Please file a bug report following the instructions at "
-    "http://libav.org/bugreports.html and include "
-    "a sample of this file.";
-
 typedef struct SubStream {
     /// Set if a valid restart header has been read. Otherwise the substream cannot be decoded.
     uint8_t     restart_seen;
@@ -300,15 +294,15 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
 
     if (mh.num_substreams == 0)
         return AVERROR_INVALIDDATA;
-    if (m->avctx->codec_id == CODEC_ID_MLP && mh.num_substreams > 2) {
+    if (m->avctx->codec_id == AV_CODEC_ID_MLP && mh.num_substreams > 2) {
         av_log(m->avctx, AV_LOG_ERROR, "MLP only supports up to 2 substreams.\n");
         return AVERROR_INVALIDDATA;
     }
     if (mh.num_substreams > MAX_SUBSTREAMS) {
-        av_log(m->avctx, AV_LOG_ERROR,
+        av_log_ask_for_sample(m->avctx,
                "Number of substreams %d is larger than the maximum supported "
-               "by the decoder. %s\n", mh.num_substreams, sample_message);
-        return AVERROR_INVALIDDATA;
+               "by the decoder.\n", mh.num_substreams);
+        return AVERROR_PATCHWELCOME;
     }
 
     m->access_unit_size      = mh.access_unit_size;
@@ -346,7 +340,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
     uint8_t checksum;
     uint8_t lossless_check;
     int start_count = get_bits_count(gbp);
-    const int max_matrix_channel = m->avctx->codec_id == CODEC_ID_MLP
+    const int max_matrix_channel = m->avctx->codec_id == AV_CODEC_ID_MLP
                                  ? MAX_MATRIX_CHANNEL_MLP
                                  : MAX_MATRIX_CHANNEL_TRUEHD;
 
@@ -360,7 +354,7 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
 
     s->noise_type = get_bits1(gbp);
 
-    if (m->avctx->codec_id == CODEC_ID_MLP && s->noise_type) {
+    if (m->avctx->codec_id == AV_CODEC_ID_MLP && s->noise_type) {
         av_log(m->avctx, AV_LOG_ERROR, "MLP must have 0x31ea sync word.\n");
         return AVERROR_INVALIDDATA;
     }
@@ -387,10 +381,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
     /* This should happen for TrueHD streams with >6 channels and MLP's noise
      * type. It is not yet known if this is allowed. */
     if (s->max_channel > MAX_MATRIX_CHANNEL_MLP && !s->noise_type) {
-        av_log(m->avctx, AV_LOG_ERROR,
+        av_log_ask_for_sample(m->avctx,
                "Number of channels %d is larger than the maximum supported "
-               "by the decoder. %s\n", s->max_channel+2, sample_message);
-        return AVERROR_INVALIDDATA;
+               "by the decoder.\n", s->max_channel + 2);
+        return AVERROR_PATCHWELCOME;
     }
 
     if (s->min_channel > s->max_channel) {
@@ -432,10 +426,10 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
     for (ch = 0; ch <= s->max_matrix_channel; ch++) {
         int ch_assign = get_bits(gbp, 6);
         if (ch_assign > s->max_matrix_channel) {
-            av_log(m->avctx, AV_LOG_ERROR,
-                   "Assignment of matrix channel %d to invalid output channel %d. %s\n",
-                   ch, ch_assign, sample_message);
-            return AVERROR_INVALIDDATA;
+            av_log_ask_for_sample(m->avctx,
+                   "Assignment of matrix channel %d to invalid output channel %d.\n",
+                   ch, ch_assign);
+            return AVERROR_PATCHWELCOME;
         }
         s->ch_assign[ch_assign] = ch;
     }
@@ -555,7 +549,7 @@ static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitCo
 {
     SubStream *s = &m->substream[substr];
     unsigned int mat, ch;
-    const int max_primitive_matrices = m->avctx->codec_id == CODEC_ID_MLP
+    const int max_primitive_matrices = m->avctx->codec_id == AV_CODEC_ID_MLP
                                      ? MAX_MATRICES_MLP
                                      : MAX_MATRICES_TRUEHD;
 
@@ -763,8 +757,8 @@ static int read_block_data(MLPDecodeContext *m, GetBitContext *gbp,
     if (s->data_check_present) {
         expected_stream_pos  = get_bits_count(gbp);
         expected_stream_pos += get_bits(gbp, 16);
-        av_log(m->avctx, AV_LOG_WARNING, "This file contains some features "
-               "we have not tested yet. %s\n", sample_message);
+        av_log_ask_for_sample(m->avctx, "This file contains some features "
+                              "we have not tested yet.\n");
     }
 
     if (s->blockpos + s->blocksize > m->access_unit_size) {
@@ -1010,7 +1004,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
         substr_header_size += 2;
 
         if (extraword_present) {
-            if (m->avctx->codec_id == CODEC_ID_MLP) {
+            if (m->avctx->codec_id == AV_CODEC_ID_MLP) {
                 av_log(m->avctx, AV_LOG_ERROR, "There must be no extraword for MLP.\n");
                 goto error;
             }
@@ -1099,9 +1093,9 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
                 return AVERROR_INVALIDDATA;
 
             shorten_by = get_bits(&gb, 16);
-            if      (m->avctx->codec_id == CODEC_ID_TRUEHD && shorten_by  & 0x2000)
+            if      (m->avctx->codec_id == AV_CODEC_ID_TRUEHD && shorten_by  & 0x2000)
                 s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos);
-            else if (m->avctx->codec_id == CODEC_ID_MLP    && shorten_by != 0xD234)
+            else if (m->avctx->codec_id == AV_CODEC_ID_MLP    && shorten_by != 0xD234)
                 return AVERROR_INVALIDDATA;
 
             if (substr == m->max_decoded_substream)
@@ -1153,23 +1147,23 @@ error:
 AVCodec ff_mlp_decoder = {
     .name           = "mlp",
     .type           = AVMEDIA_TYPE_AUDIO,
-    .id             = CODEC_ID_MLP,
+    .id             = AV_CODEC_ID_MLP,
     .priv_data_size = sizeof(MLPDecodeContext),
     .init           = mlp_decode_init,
     .decode         = read_access_unit,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("MLP (Meridian Lossless Packing)"),
+    .long_name      = NULL_IF_CONFIG_SMALL("MLP (Meridian Lossless Packing)"),
 };
 
 #if CONFIG_TRUEHD_DECODER
 AVCodec ff_truehd_decoder = {
     .name           = "truehd",
     .type           = AVMEDIA_TYPE_AUDIO,
-    .id             = CODEC_ID_TRUEHD,
+    .id             = AV_CODEC_ID_TRUEHD,
     .priv_data_size = sizeof(MLPDecodeContext),
     .init           = mlp_decode_init,
     .decode         = read_access_unit,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
+    .long_name      = NULL_IF_CONFIG_SMALL("TrueHD"),
 };
 #endif /* CONFIG_TRUEHD_DECODER */