VirtualBox

Ignore:
Timestamp:
Mar 10, 2008 2:45:46 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28841
Message:

VBoxHeadless: added (disabled) code for showing all available formats+codecs

Location:
trunk/src/VBox/Frontends/VBoxHeadless/VideoCapture
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxHeadless/VideoCapture/FFmpegFB.cpp

    r7400 r7408  
    2727#include <png.h>
    2828#include <iprt/stream.h>
     29
     30//#define VBOX_SHOW_AVAILABLE_FORMATS
    2931
    3032// external constructor for dynamic loading
     
    702704    AVOutputFormat *pOutFormat = guess_format(0, com::Utf8Str(mFileName),
    703705                                              0);
     706#ifdef VBOX_SHOW_AVAILABLE_FORMATS
     707    if (!pOutFormat)
     708    {
     709        RTPrintf("Could not guess an output format for that extension.\n"
     710                 "Available formats:\n");
     711        list_formats();
     712    }
     713#endif
    704714    AssertMsgReturn(pOutFormat != 0,
    705715                    ("Could not deduce output format from file name\n"),
     
    730740
    731741
     742HRESULT FFmpegFB::list_formats()
     743{
     744    AVCodec *codec;
     745    for (codec = first_avcodec; codec != NULL; codec = codec->next)
     746    {
     747        if (codec->type == CODEC_TYPE_VIDEO && codec->encode)
     748        {
     749            AVOutputFormat *ofmt;
     750            for (ofmt = first_oformat; ofmt != NULL; ofmt = ofmt->next)
     751            {
     752                if (ofmt->video_codec == codec->id)
     753                    RTPrintf(" %20s: %20s => '%s'\n", codec->name, ofmt->extensions, ofmt->long_name);
     754            }
     755        }
     756    }
     757}
     758
     759
    732760/**
    733761 * Open the FFmpeg codec and set it up (width, etc) for our MPEG file.
     
    746774    AssertReturn(pCodecContext != 0, E_UNEXPECTED);
    747775    AVCodec *pCodec = avcodec_find_encoder(pOutFormat->video_codec);
     776#ifdef VBOX_SHOW_AVAILABLE_FORMATS
     777    if (!pCodec)
     778    {
     779        RTPrintf("Could not find a suitable codec for the output format on your system\n"
     780                 "Available formats:\n");
     781        list_formats();
     782    }
     783#endif
    748784    AssertReturn(pCodec != 0, E_UNEXPECTED);
    749785    pCodecContext->codec_id = pOutFormat->video_codec;
  • trunk/src/VBox/Frontends/VBoxHeadless/VideoCapture/FFmpegFB.h

    r7400 r7408  
    173173    HRESULT setup_library();
    174174    HRESULT setup_output_format();
     175    HRESULT list_formats();
    175176    HRESULT open_codec();
    176177    HRESULT open_output_file();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette