]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg.c
Do not throw compiler error if asm code needs alignment, but we do not know
[ffmpeg] / ffmpeg.c
index fd7cef4137d264cd4fa4ec5ade403295d4013b12..22bfed8dc2ee479b75af795d690b0ca9373dbf5a 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -256,6 +256,7 @@ typedef struct AVOutputStream {
     struct SwsContext *img_resample_ctx; /* for image resampling */
     int resample_height;
     int resample_width;
+    int resample_pix_fmt;
 
     /* full frame size of first frame */
     int original_height;
@@ -938,9 +939,10 @@ static void do_video_out(AVFormatContext *s,
         padding_src = NULL;
         final_picture = &ost->pict_tmp;
         if(  (ost->resample_height != (ist->st->codec->height - (ost->topBand  + ost->bottomBand)))
-          || (ost->resample_width  != (ist->st->codec->width  - (ost->leftBand + ost->rightBand)))) {
+          || (ost->resample_width  != (ist->st->codec->width  - (ost->leftBand + ost->rightBand)))
+          || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
 
-            fprintf(stderr,"Input Stream #%d.%d frame size changed to %dx%d\n", ist->file_index, ist->index, ist->st->codec->width, ist->st->codec->height);
+            fprintf(stderr,"Input Stream #%d.%d frame size changed to %dx%d, %s\n", ist->file_index, ist->index, ist->st->codec->width, ist->st->codec->height,avcodec_get_pix_fmt_name(ist->st->codec->pix_fmt));
             /* keep bands proportional to the frame size */
             topBand    = ((int64_t)ist->st->codec->height * ost->original_topBand    / ost->original_height) & ~1;
             bottomBand = ((int64_t)ist->st->codec->height * ost->original_bottomBand / ost->original_height) & ~1;
@@ -960,6 +962,7 @@ static void do_video_out(AVFormatContext *s,
 
             ost->resample_height = ist->st->codec->height - (ost->topBand  + ost->bottomBand);
             ost->resample_width  = ist->st->codec->width  - (ost->leftBand + ost->rightBand);
+            ost->resample_pix_fmt= ist->st->codec->pix_fmt;
 
             /* initialize a new scaler context */
             sws_freeContext(ost->img_resample_ctx);
@@ -1937,6 +1940,7 @@ static int av_encode(AVFormatContext **output_files,
 
                     ost->resample_height = icodec->height - (frame_topBand  + frame_bottomBand);
                     ost->resample_width  = icodec->width  - (frame_leftBand + frame_rightBand);
+                    ost->resample_pix_fmt= icodec->pix_fmt;
                     codec->bits_per_raw_sample= 0;
                 }
                 ost->encoding_needed = 1;
@@ -2013,13 +2017,13 @@ static int av_encode(AVFormatContext **output_files,
             if (!codec)
                 codec = avcodec_find_encoder(ost->st->codec->codec_id);
             if (!codec) {
-                snprintf(error, sizeof(error), "Unsupported codec for output stream #%d.%d",
-                        ost->file_index, ost->index);
+                snprintf(error, sizeof(error), "Encoder (codec id %d) not found for output stream #%d.%d",
+                         ost->st->codec->codec_id, ost->file_index, ost->index);
                 ret = AVERROR(EINVAL);
                 goto dump_format;
             }
             if (avcodec_open(ost->st->codec, codec) < 0) {
-                snprintf(error, sizeof(error), "Error while opening codec for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height",
+                snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height",
                         ost->file_index, ost->index);
                 ret = AVERROR(EINVAL);
                 goto dump_format;
@@ -2036,13 +2040,13 @@ static int av_encode(AVFormatContext **output_files,
             if (!codec)
                 codec = avcodec_find_decoder(ist->st->codec->codec_id);
             if (!codec) {
-                snprintf(error, sizeof(error), "Unsupported codec (id=%d) for input stream #%d.%d",
+                snprintf(error, sizeof(error), "Decoder (codec id %d) not found for input stream #%d.%d",
                         ist->st->codec->codec_id, ist->file_index, ist->index);
                 ret = AVERROR(EINVAL);
                 goto dump_format;
             }
             if (avcodec_open(ist->st->codec, codec) < 0) {
-                snprintf(error, sizeof(error), "Error while opening codec for input stream #%d.%d",
+                snprintf(error, sizeof(error), "Error while opening decoder for input stream #%d.%d",
                         ist->file_index, ist->index);
                 ret = AVERROR(EINVAL);
                 goto dump_format;
@@ -3047,7 +3051,7 @@ static void new_video_stream(AVFormatContext *oc)
 {
     AVStream *st;
     AVCodecContext *video_enc;
-    int codec_id;
+    enum CodecID codec_id;
 
     st = av_new_stream(oc, oc->nb_streams);
     if (!st) {
@@ -3189,7 +3193,7 @@ static void new_audio_stream(AVFormatContext *oc)
 {
     AVStream *st;
     AVCodecContext *audio_enc;
-    int codec_id;
+    enum CodecID codec_id;
 
     st = av_new_stream(oc, oc->nb_streams);
     if (!st) {