Revision f368375c

View differences:

vhook/watermark.c
99 99
    if (0 == (*ctxp = av_mallocz(sizeof(ContextInfo)))) return -1;
100 100
    ci = (ContextInfo *) *ctxp;
101 101

  
102
    optind = 0;
102
    optind = 1;
103 103
    
104 104
    // Struct is mallocz:ed so no need to reset.
105 105
        
......
110 110
                ci->filename[1999] = 0;
111 111
                break;
112 112
            default:
113
                av_log(NULL, AV_LOG_DEBUG, "Unrecognized argument '%s'\n", argv[optind]);
113
                av_log(NULL, AV_LOG_ERROR, "Watermark: Unrecognized argument '%s'\n", argv[optind]);
114 114
                return -1;
115 115
        }
116 116
    }
117 117
    
118 118
    //
119
    if (0 == ci->filename[0]) return -1;
119
    if (0 == ci->filename[0]) {
120
        av_log(NULL, AV_LOG_ERROR, "Watermark: There is no filename specified.\n");
121
        return -1;
122
    }
120 123
        
121 124
    av_register_all();
122 125
    return get_watermark_picture(ci, 0);
123

  
124
    return 0;
125 126
}
126 127

  
127 128

  
......
268 269
            // NULL instead of file_iformat to av_open_input_file()
269 270
            ci->i = strlen(ci->filename);
270 271
            if (0 == ci->i) {
271
                av_log(NULL, AV_LOG_DEBUG, "get_watermark_picture() No filename to watermark vhook\n");
272
                av_log(NULL, AV_LOG_ERROR, "get_watermark_picture() No filename to watermark vhook\n");
272 273
                return -1;
273 274
            }
274 275
            while (ci->i > 0) {
......
281 282
               ci->p_ext = &(ci->filename[ci->i]);
282 283
            ci->file_iformat = av_find_input_format (ci->p_ext);
283 284
            if (0 == ci->file_iformat) {
284
                av_log(NULL, AV_LOG_DEBUG, "get_watermark_picture() Really failed to find iformat [%s]\n", ci->p_ext);
285
                av_log(NULL, AV_LOG_ERROR, "get_watermark_picture() Really failed to find iformat [%s]\n", ci->p_ext);
285 286
                return -1;
286 287
            }
287 288
            // now continues the Martin template.    
288 289
            
289 290
            if (av_open_input_file(&ci->pFormatCtx, ci->filename, ci->file_iformat, 0, NULL)!=0) {
290
                av_log(NULL, AV_LOG_DEBUG, "get_watermark_picture() Failed to open input file [%s]\n", ci->filename);
291
                av_log(NULL, AV_LOG_ERROR, "get_watermark_picture() Failed to open input file [%s]\n", ci->filename);
291 292
                return -1;
292 293
            }            
293 294
        }
......
296 297
         * This fills the streams field of the AVFormatContext with valid information.
297 298
         */
298 299
        if(av_find_stream_info(ci->pFormatCtx)<0) {
299
            av_log(NULL, AV_LOG_DEBUG, "get_watermark_picture() Failed to find stream info\n");
300
            av_log(NULL, AV_LOG_ERROR, "get_watermark_picture() Failed to find stream info\n");
300 301
            return -1;
301 302
        }
302 303
    
......
313 314
                break;
314 315
            }
315 316
        if(ci->videoStream == -1) {
316
            av_log(NULL, AV_LOG_DEBUG, "get_watermark_picture() Failed to find any video stream\n");
317
            av_log(NULL, AV_LOG_ERROR, "get_watermark_picture() Failed to find any video stream\n");
317 318
            return -1;
318 319
        }
319 320
        
......
332 333
        // Find the decoder for the video stream
333 334
        ci->pCodec = avcodec_find_decoder(ci->pCodecCtx->codec_id);
334 335
        if(ci->pCodec == NULL) {
335
            av_log(NULL, AV_LOG_DEBUG, "get_watermark_picture() Failed to find any codec\n");
336
            av_log(NULL, AV_LOG_ERROR, "get_watermark_picture() Failed to find any codec\n");
336 337
            return -1;
337 338
        }
338 339
        
......
343 344
        
344 345
        // Open codec
345 346
        if(avcodec_open(ci->pCodecCtx, ci->pCodec)<0) {
346
            av_log(NULL, AV_LOG_DEBUG, "get_watermark_picture() Failed to open codec\n");
347
            av_log(NULL, AV_LOG_ERROR, "get_watermark_picture() Failed to open codec\n");
347 348
            return -1;
348 349
        }
349 350
        
......
364 365
        // Allocate an AVFrame structure
365 366
        ci->pFrameRGB=avcodec_alloc_frame();
366 367
        if(ci->pFrameRGB==NULL) {
367
            av_log(NULL, AV_LOG_DEBUG, "get_watermark_picture() Failed to alloc pFrameRGB\n");
368
            av_log(NULL, AV_LOG_ERROR, "get_watermark_picture() Failed to alloc pFrameRGB\n");
368 369
            return -1;
369 370
        }
370 371
        

Also available in: Unified diff