
Recherche avancée
Autres articles (77)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...) -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)
Sur d’autres sites (7744)
-
Use SDL2 play yuv file but actually no display [closed]
14 juin 2024, par guan xiI use ffmpeg to demux and decode the media file, and then use SDL2 to play the raw data, everything is ok. no error no warning, but SDL2 windows does not dispaly video content.
All i know is frame dts is ordered in SDL2 play queue and data is good.


void VideoPlay::play_video() {
 while (is_running_) {
 refresh_loop_wait_event(&event_);

 switch (event_.type) {
 case SDL_KEYDOWN:
 if (event_.key.keysym.sym == SDLK_q) {
 LOG_INFO("Q quit");
 is_running_ = false;
 frame_queue_->abort();
 }
 break;
 case SDL_QUIT:
 LOG_INFO("SDL_QUIT");
 is_running_ = false;
 frame_queue_->abort();
 break;

 default:
 break;
 }
 }
}

void VideoPlay::refresh_loop_wait_event(SDL_Event *event) {
 SDL_PumpEvents();

 while (
 !SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) {
 video_refresh();
 SDL_PumpEvents();
 }
}

void VideoPlay::video_refresh() {
 int ret = 0;
 frame_queue_->pop(frame_);
 if (!frame_) {
 LOG_ERROR("frame_queue_ pop failed.");
 is_running_ = false;
 frame_queue_->abort();
 return;
 }

 rect_.x = 0;
 rect_.y = 0;
 rect_.w = video_width_;
 rect_.h = video_height_;

 ret = SDL_UpdateYUVTexture(
 texture_, &rect_, frame_->data[0], frame_->linesize[0], frame_->data[1],
 frame_->linesize[1], frame_->data[2], frame_->linesize[2]);

 LOG_DEBUG("frame pts: %ld, tot size: %d, Y size: %d, U size: %d, V size: %d",
 frame_->pts, video_width_ * video_height_, frame_->linesize[0],
 frame_->linesize[1], frame_->linesize[2]);
 if (ret != 0) {
 LOG_ERROR("SDL_UpdateYUVTexture failed. %s", SDL_GetError());
 is_running_ = false;
 frame_queue_->abort();
 return;
 }
 ret = SDL_RenderClear(renderer_);
 if (ret != 0) {
 LOG_ERROR("SDL_RenderClear failed. %s", SDL_GetError());
 is_running_ = false;
 frame_queue_->abort();
 return;
 }
 ret = SDL_RenderCopy(renderer_, texture_, nullptr, &rect_);
 if (ret != 0) {
 LOG_ERROR("SDL_RenderCopy failed. %s", SDL_GetError());
 is_running_ = false;
 frame_queue_->abort();
 return;
 }
 SDL_RenderPresent(renderer_);
 SDL_Delay(10);
 av_frame_free(&frame_);
 frame_ = nullptr;
}



log file out put


~/A_CODES/ffmpeg_official/cmake-build-debug ᐅ cat sdlplay.log
[info] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/core/sp_demux.cpp:50 init] audio idx 1 video idx 0
[info] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/core/sp_decode.cpp:39 init] codec: h264
[info] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/core/sp_decode.cpp:68 init] yuv fmt: yuv420p
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x1100
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x1100
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x200
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x200
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x200
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x200
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x200
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x300
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x300
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x301
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:100 play_video] event 0x200
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 67, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 133, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 200, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 267, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 333, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 400, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 467, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 533, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 600, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 667, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 733, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 800, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 867, tot size: 82944, Y size: 384, U size: 192, V size: 192
[debug] [2024-06-14 15:39:33] [/home/xiguan/A_CODES/ffmpeg_official/SDLPlayer/sdl/video_play.cpp:151 video_refresh] frame pts: 933, tot size: 82944, Y size: 384, U size: 192, V size: 192



I try to handle SDL2 events correctly as ffplay but no use.
I also gdb to search anything error but nothing happen too.


-
Adventures in Unicode
Tangential to multimedia hacking is proper metadata handling. Recently, I have gathered an interest in processing a large corpus of multimedia files which are likely to contain metadata strings which do not fall into the lower ASCII set. This is significant because the lower ASCII set intersects perfectly with my own programming comfort zone. Indeed, all of my programming life, I have insisted on covering my ears and loudly asserting “LA LA LA LA LA ! ALL TEXT EVERYWHERE IS ASCII !” I suspect I’m not alone in this.
Thus, I took this as an opportunity to conquer my longstanding fear of Unicode. I developed a self-learning course comprised of a series of exercises which add up to this diagram :
Part 1 : Understanding Text Encoding
Python has regular strings by default and then it has Unicode strings. The latter are prefixed by the letter ‘u’. This is what ‘ö’ looks like encoded in each type.-
>>> ’ö’, u’ö’
-
(’\xc3\xb6’, u’\xf6’)
A large part of my frustration with Unicode comes from Python yelling at me about UnicodeDecodeErrors and an inability to handle the number 0xc3 for some reason. This usually comes when I’m trying to wrap my head around an unrelated problem and don’t care to get sidetracked by text encoding issues. However, when I studied the above output, I finally understood where the 0xc3 comes from. I just didn’t understand what the encoding represents exactly.
I can see from assorted tables that ‘ö’ is character 0xF6 in various encodings (in Unicode and Latin-1), so u’\xf6′ makes sense. But what does ‘\xc3\xb6′ mean ? It’s my style to excavate straight down to the lowest levels, and I wanted to understand exactly how characters are represented in memory. The UTF-8 encoding tables inform us that any Unicode code point above 0x7F but less than 0×800 will be encoded with 2 bytes :
110xxxxx 10xxxxxx
Applying this pattern to the \xc3\xb6 encoding :
hex : 0xc3 0xb6 bits : 11000011 10110110 important bits : ---00011 —110110 assembled : 00011110110 code point : 0xf6
I was elated when I drew that out and made the connection. Maybe I’m the last programmer to figure this stuff out. But I’m still happy that I actually understand those Python errors pertaining to the number 0xc3 and that I won’t have to apply canned solutions without understanding the core problem.
I’m cheating on this part of this exercise just a little bit since the diagram implied that the Unicode text needs to come from a binary file. I’ll return to that in a bit. For now, I’ll just contrive the following Unicode string from the Python REPL :
-
>>> u = u’Üñìçôđé’
-
>>> u
-
u’\xdc\xf1\xec\xe7\xf4\u0111\xe9’
Part 2 : From Python To SQLite3
The next step is to see what happens when I use Python’s SQLite3 module to dump the string into a new database. Will the Unicode encoding be preserved on disk ? What will UTF-8 look like on disk anyway ?-
>>> import sqlite3
-
>>> conn = sqlite3.connect(’unicode.db’)
-
>>> conn.execute("CREATE TABLE t (t text)")
-
>>> conn.execute("INSERT INTO t VALUES (?)", (u, ))
-
>>> conn.commit()
-
>>> conn.close()
Next, I manually view the resulting database file (unicode.db) using a hex editor and look for strings. Here we go :
000007F0 02 29 C3 9C C3 B1 C3 AC C3 A7 C3 B4 C4 91 C3 A9
Look at that ! It’s just like the \xc3\xf6 encoding we see in the regular Python strings.
Part 3 : From SQLite3 To A Web Page Via PHP
Finally, use PHP (love it or hate it, but it’s what’s most convenient on my hosting provider) to query the string from the database and display it on a web page, completing the outlined processing pipeline.-
< ?php
-
$dbh = new PDO("sqlite:unicode.db") ;
-
foreach ($dbh->query("SELECT t from t") as $row) ;
-
$unicode_string = $row[’t’] ;
-
?>
-
-
<html>
-
<head><meta http-equiv="Content-Type" content="text/html ; charset=utf-8"></meta></head>
-
<body><h1>< ?=$unicode_string ?></h1></body>
-
</html>
I tested the foregoing PHP script on 3 separate browsers that I had handy (Firefox, Internet Explorer, and Chrome) :
I’d say that counts as success ! It’s important to note that the “meta http-equiv” tag is absolutely necessary. Omit and see something like this :
Since we know what the UTF-8 stream looks like, it’s pretty obvious how the mapping is operating here : 0xc3 and 0xc4 correspond to ‘Ã’ and ‘Ä’, respectively. This corresponds to an encoding named ISO/IEC 8859-1, a.k.a. Latin-1. Speaking of which…
Part 4 : Converting Binary Data To Unicode
At the start of the experiment, I was trying to extract metadata strings from these binary multimedia files and I noticed characters like our friend ‘ö’ from above. In the bytestream, this was represented simply with 0xf6. I mistakenly believed that this was the on-disk representation of UTF-8. Wrong. Turns out it’s Latin-1.However, I still need to solve the problem of transforming such strings into Unicode to be shoved through the pipeline diagrammed above. For this experiment, I created a 9-byte file with the Latin-1 string ‘Üñìçôdé’ couched by 0′s, to simulate yanking a string out of a binary file. Here’s unicode.file :
00000000 00 DC F1 EC E7 F4 64 E9 00 ......d..
(Aside : this experiment uses plain ‘d’ since the ‘đ’ with a bar through it doesn’t occur in Latin-1 ; shows up all over the place in Vietnamese, at least.)
I’ve been mashing around Python code via the REPL, trying to get this string into a Unicode-friendly format. This is a successful method but it’s probably not the best :
-
>>> import struct
-
>>> f = open(’unicode.file’, ’r’).read()
-
>>> u = u’’
-
>>> for c in struct.unpack("B"*7, f[1 :8]) :
-
... u += unichr(c)
-
...
-
>>> u
-
u’\xdc\xf1\xec\xe7\xf4d\xe9’
-
>>> print u
-
Üñìçôdé
Conclusion
Dealing with text encoding matters reminds me of dealing with integer endian-ness concerns. When you’re just dealing with one system, you probably don’t need to think too much about it because the system is usually handling everything consistently underneath the covers.However, when the data leaves one system and will be interpreted by another system, that’s when a programmer needs to be cognizant of matters such as integer endianness or text encoding.
-
-
Anomalie #3991 : Erreur compression CSS et base64
29 août 2017, par tcharlss (*´_ゝ`)La ligne fautive se trouve ici : https://zone.spip.org/trac/spip-zone/browser/_core_/plugins/compresseur/inc/compresseur_minifier.php#L100
// zero est zero, quelle que soit l’unite (sauf pour % car casse les @keyframes cf https://core.spip.net/issues/3128) $contenu = preg_replace("/([^0-9.]0)(em|px|pt)/ms", "$1", $contenu) ;
Ça cherche le nombre zéro précédé de n’importe quel caractère (autre qu’un chiffre) ou d’un point.
Du coup ça peut matcher avec les data URIs :@font-facefont-family :’spip’ ;src:url("data:application/font-woff ;base64,abc0pxyz") ;
Pour éviter ce souci, on pourrait préciser exactement quels caractères peuvent précéder le zéro pour considérer qu’il s’agit d’une unité. On peut avoir :
1) deux points
font-size:0px ;
2) un ou plusieurs espaces
font-size : 0px ; font-size : calc(10px + 0px) ;
3) une parenthèse dans le cas de
calc()
font-size : calc(0px) ;
4) Autres unités
À noter qu’il y a aussi pas mal d’autres unités qui ne sont pas prises en compte dans la regex actuelle : https://www.w3schools.com/cssref/css_units.asp
rem ex pc vh vw vmin vmax cm mm in ch
Ce qui donne au final la regex suivante, qui laisse mes data URIs tranquilles :
$contenu = preg_replace("/((?: :|\s+|\()0)(em|px|pt|rem|ex|pc|vh|vw|vmin|vmax|cm|mm|in|ch)/ms", "$1", $contenu) ;