Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (39)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (8040)

  • avutil/imgutils : Add wrapper for av_image_copy() to avoid casts

    6 septembre 2023, par Andreas Rheinhardt
    avutil/imgutils : Add wrapper for av_image_copy() to avoid casts
    

    av_image_copy() accepts const uint8_t* const * as source ;
    lots of user have uint8_t* const * and therefore either
    cast (the majority) or copy the array of pointers.

    This commit changes this by adding a static inline wrapper
    for av_image_copy() that casts between the two types
    so that we do not need to add casts everywhere else.

    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@outlook.com>

    • [DH] doc/APIchanges
    • [DH] doc/examples/demux_decode.c
    • [DH] libavcodec/amfenc.c
    • [DH] libavcodec/libkvazaar.c
    • [DH] libavcodec/libopenh264dec.c
    • [DH] libavcodec/libvpxdec.c
    • [DH] libavcodec/mediacodecenc.c
    • [DH] libavcodec/mmaldec.c
    • [DH] libavcodec/nuv.c
    • [DH] libavcodec/nvenc.c
    • [DH] libavcodec/omx.c
    • [DH] libavcodec/v210dec.c
    • [DH] libavdevice/xv.c
    • [DH] libavfilter/lavfutils.c
    • [DH] libavfilter/vf_framepack.c
    • [DH] libavfilter/vf_pullup.c
    • [DH] libavfilter/yadif_common.c
    • [DH] libavutil/frame.c
    • [DH] libavutil/hwcontext_d3d11va.c
    • [DH] libavutil/hwcontext_dxva2.c
    • [DH] libavutil/imgutils.h
    • [DH] libavutil/version.h
  • Compiling FFmpeg with Libass using MSVC

    2 avril 2019, par maxhap

    First a bit of background.

    I’m trying to compile ffmpeg on windows with the libass extensions/configuration option.

    Using the visual studio project libass-msvc I built libass using Visual Studio as a static lib.

    I then installed MinGW with MSYS and pkg-config. Following the instructions on the ffmpeg MSVC installation guide I configured the environment to build with the MSVC linker and to build in x64.

    When I try to configure libass for compilation using ./configure —enable-libass —toolchain=msvc I get the following error in the log file :

    File not found ass/ass.h

    pkg-config can not find libass

    I have tried the following to fix this.

    1. Create a .pc file for libass and add this to the PKG_CONFIG_PATH environment variable. See file content below. (After doing this pkg-config libass —version prints 0.81, not the right version number but at least something.)

    2. Copy libass .h files into a MinGW/include/ass folder and the .lib file into the MinGW/libs folder.

    3. Add libass include and bin folders to PATH environment variable

    4. Download libass and dependencies source then try to build it using MSYS with MSVC compiler. My aim here was to be able to use "make install" and let MinGW install libass to the correct locations. After hours of trying to fix linker errors, I abandoned this idea as some of the libass dependencies make files only work with the GCC GNU compiler.

    5. Compile libass with GCC GNU using MinGW make/make install then try and install libass using the GNU libs. Again this led to linker errors (I know this was a bad idea but was worth a try).

    6. Tried using extra lib and include build configuration options —extra-cflags="ffmpeg-dir/extra/include" \
      — extra-ldflags="ffmped-dir/extra/ffmpeg_build/lib" then adding the libs and .h files into those locations

    .pc file

    libass.pc:
    prefix=/MinGW
    includedir=libass-directory/include
    libdir=libass-director/x64/bin/

    Name: libass
    Description: Libass project
    Version: 0.13.7

    I am now completely stuck and out of ideas if anyone could give any insight or suggestions into what I’m doing wrong that would be fantastic.

    Update

    I created INCLUDE and LIBDIR environment path variable containing the libass paths. Which now correctly includes libass. However, I now get the following linker error for the function check_ass_library_init.

    check_func_headers ass/ass.h ass_library_init
    check_ld cc
    check_cc
    BEGIN ./ffconf.RZMYFWdc/test.c
    1 #include
    2 #include
    3 long check_ass_library_init(void) return (long)
    ass_library_init ;

    4 int main(void) int ret = 0 ;
    5 ret |= ((intptr_t)check_ass_library_init) & 0xFFFF ;
    6 return ret ;

    END ./ffconf.RZMYFWdc/test.c
    cl -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -
    D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -
    D_WIN32_WINNT=0x0502 -nologo -c -Fo./ffconf.RZMYFWdc/test.o
    ./ffconf.RZMYFWdc/test.c
    test.c
    ./ffconf.RZMYFWdc/test.c(3) : warning C4311 : ’type cast’ : pointer truncation
    from ’ASS_Library *(__cdecl *)(void)’ to ’long’
    ./compat/windows/mslink -nologo -out :./ffconf.RZMYFWdc/test.exe
    ./ffconf.RZMYFWdc/test.o psapi.lib advapi32.lib shell32.lib ole32.lib
    test.o : error LNK2019 : unresolved external symbol ass_library_init
    referenced in function check_ass_library_init
    ./ffconf.RZMYFWdc/test.exe : fatal error LNK1120 : 1 unresolved externals
    ERROR : libass not found using pkg-config

    The libass test project which uses ass_library_init compiles fine using the same lib files, the libs appear to be fine.

    From what I see from this line "./compat/windows/mslink -nologo -out:./ffconf.RZMYFWdc/test.exe ./ffconf.RZMYFWdc/test.o psapi.lib advapi32.lib shell32.lib ole32.lib" libass is not being passed to the linker.
    I suspect that the configuration file is not creating the link to libass in the make file when compiling with MSVC.

    Am I correct or am I going about compiling this in the wrong way ?

  • How do I write to a file in Golang using a pointer to the C data ?

    20 juillet 2020, par nevernew

    I'm writing an app for the windows platform using FFmpeg and it's golang wrapper goav, but I'm having trouble understanding how to use the C pointers to gain access to an array.

    &#xA;&#xA;

    I'm trying to write the frame data, pointed to by a uint8 pointer from C, to a .ppm file in golang.

    &#xA;&#xA;

    Once I have this done, for proof of concept that FFmpeg is doing what I expect it to, I want to set the frames to a texture in OpenGl to make a video player with cool transitions ; any pointers to do that nice and efficiently would be so very helpful ! I'm guessing I need to write some shader code to draw the ppm as a texture...

    &#xA;&#xA;

    The PPM file structure looks pretty simple just the header and then a byte of data for each red, green and blue value of each pixel in the frame from top left to bottom right

    &#xA;&#xA;

    I'm starting to understanding how to cast the pointers between C and Go types, but how can I access the data and write it in Go with the same result as C ? In C I just have to set the pointer offset for the data and state how much of it to write :

    &#xA;&#xA;

    for (y = 0; y &lt; height; y&#x2B;&#x2B;) {&#xA;    fwrite(pFrame->data[0]&#x2B;y*pFrame->linesize[0], 1, width*3, pFile);&#xA;}&#xA;

    &#xA;&#xA;

    I've stripped out all the relevant parts of the C code, the wrapper and my code, shown below :

    &#xA;&#xA;

    C code - libavutil/frame.h

    &#xA;&#xA;

    #include &#xA;&#xA;typedef struct AVFrame {&#xA;#define AV_NUM_DATA_POINTERS 8&#xA;    uint8_t *data[AV_NUM_DATA_POINTERS];&#xA;    int linesize[AV_NUM_DATA_POINTERS];&#xA;}&#xA;

    &#xA;&#xA;

    Golang goav wrapper

    &#xA;&#xA;

    package avutil&#xA;&#xA;/*&#xA;    #cgo pkg-config: libavutil&#xA;    #include <libavutil></libavutil>frame.h>&#xA;    #include &#xA;*/&#xA;import "C"&#xA;import (&#xA;    "unsafe"&#xA;)&#xA;&#xA;type Frame C.struct_AVFrame&#xA;&#xA;func Data(f *Frame) *uint8 {&#xA;    return (*uint8)(unsafe.Pointer((*C.uint8_t)(unsafe.Pointer(&amp;f.data))))&#xA;}&#xA;func Linesize(f *Frame) int {&#xA;    return int(*(*C.int)(unsafe.Pointer(&amp;f.linesize)))&#xA;}&#xA;

    &#xA;&#xA;

    My Golang code

    &#xA;&#xA;

    package main&#xA;&#xA;import "github.com/giorgisio/goav/avutil"&#xA;&#xA;func saveFrame(videoFrame *avutil.Frame, width int, height int, iFrame int) {&#xA;    var szFilename string&#xA;    var y int&#xA;    var file *os.File&#xA;    var err error&#xA;&#xA;    szFilename = ""&#xA;&#xA;    // Open file&#xA;    szFilename = fmt.Sprintf("frame%d.ppm", iFrame)&#xA;&#xA;    if file, err = os.Create(szFilename); err != nil {&#xA;        log.Println("Error Reading")&#xA;    }&#xA;&#xA;    // Write header&#xA;    fh := []byte(fmt.Sprintf("P6\n%d %d\n255\n", width, height))&#xA;    file.Write(fh)&#xA;    var b byte = 0&#xA;    // Write pixel data&#xA;    for y = 0; y &lt; height; y&#x2B;&#x2B; {&#xA;        d := avutil.Data(videoFrame) // d should be a pointer to the first byte of data&#xA;        l := avutil.Linesize(videoFrame)&#xA;&#xA;        // I&#x27;m basically lost trying to figure out how to correctly write&#xA;        // this to a file, the file is created, but when I open it in GIMP&#xA;        // the image is mostly black with glitchy fuzz - so it&#x27;s not being&#xA;        // written properly; the header seems to be ok, it knows the height&#xA;        // and width at least.&#xA;&#xA;        data := make([]byte, l*3)&#xA;&#xA;        ptr := unsafe.Pointer(d)&#xA;        for i := 0; i &lt; l; i&#x2B;&#x2B; {&#xA;            datum := (*uint8)(unsafe.Pointer(uintptr(ptr) &#x2B; (uintptr(i)&#x2B;(uintptr(y)*uintptr(l)))*unsafe.Sizeof(*d)))&#xA;            data = append(data, *datum)&#xA;            //fmt.Println(*datum)&#xA;        }&#xA;&#xA;        n, err := file.Write(data)&#xA;        if err != nil {&#xA;            log.Println("Error Writing:", szFilename, "-", n)&#xA;        }&#xA;    }&#xA;&#xA;    file.Close()&#xA;}&#xA;

    &#xA;&#xA;

    So, how can I write to a file using a pointer to the data, like you can do in C, and get the same result ?

    &#xA;&#xA;

    The first frame should be black so all 0's but I'm getting a glitchy fuzz, so it must be accessing some random data

    &#xA;&#xA;

    Update : My fix using a C function to save :

    &#xA;&#xA;

    package avutil&#xA;&#xA;/*&#xA;    #cgo pkg-config: libavutil&#xA;    #include <libavutil></libavutil>frame.h>&#xA;    #include &#xA;    #include &#xA;&#xA;    void SaveFrame(const char* location, AVFrame *pFrame, int width, int height) {&#xA;        FILE *pFile;&#xA;        int  y;&#xA;&#xA;        // Open file&#xA;        pFile=fopen(location, "wb");&#xA;        if(pFile==NULL)&#xA;            return;&#xA;&#xA;        // Write header&#xA;        fprintf(pFile, "P6\n%d %d\n255\n", width, height);&#xA;&#xA;        // Write pixel data&#xA;        for(y=0; ydata[0]&#x2B;y*pFrame->linesize[0], 1, width*3, pFile);&#xA;&#xA;        // Close file&#xA;        fclose(pFile);&#xA;    }&#xA;    uint8_t* GetData(AVFrame *pFrame) {&#xA;        return pFrame->data[0];&#xA;    }&#xA;*/&#xA;import "C"&#xA;

    &#xA;&#xA;

    I updated the avutil file, in the goav wrapper package, with this save function at the top, then pass it the frame context so it can get the data pointer from it. I also added this Go function to that avutil file to call the C function

    &#xA;&#xA;

    func SaveFrame(location string, f *Frame, width int, height int) {&#xA;    csLoc := C.CString(location)&#xA;    C.SaveFrame(csLoc, (*C.struct_AVFrame)(unsafe.Pointer(f)), C.int(width), C.int(height))&#xA;    C.free(unsafe.Pointer(csLoc))&#xA;}&#xA;

    &#xA;